43 lines
1.1 KiB
Dart
43 lines
1.1 KiB
Dart
// Author: fruit.com.cn
|
|
|
|
import 'package:flutter_test/flutter_test.dart';
|
|
import 'package:fruitshorts/core/data/models/reward.dart';
|
|
|
|
void main() {
|
|
test('should_parse_string_numbers_when_reward_overview_is_received', () {
|
|
final overview = RewardOverview.fromJson({
|
|
'serverDate': '2026-11-05',
|
|
'timezone': 'Asia/Jakarta',
|
|
'coinBalance': '135',
|
|
'checkin': {
|
|
'taskId': '9',
|
|
'checkedInToday': true,
|
|
'streak': 2,
|
|
'currentDay': 3,
|
|
'days': [
|
|
{'dayIndex': 1, 'rewardCoin': '35', 'checked': true},
|
|
],
|
|
},
|
|
'sections': [
|
|
{
|
|
'code': 'DAILY',
|
|
'title': 'Tugas harian',
|
|
'tasks': [
|
|
{
|
|
'id': '18',
|
|
'targetValue': '300',
|
|
'progressValue': '120',
|
|
'rewardCoin': '20',
|
|
'status': 'IN_PROGRESS',
|
|
},
|
|
],
|
|
},
|
|
],
|
|
});
|
|
|
|
expect(overview.coinBalance, 135);
|
|
expect(overview.checkin.days.single.rewardCoin, 35);
|
|
expect(overview.sections.single.tasks.single.progress, 0.4);
|
|
});
|
|
}
|