feat(reward): 新增客户端奖励中心
This commit is contained in:
1 parent
67670d46b1
commit
bea08110c9
68 files changed
+3987
-332
No files matched your search
@@ -0,0 +1,42 @@
|
||||
// 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);
|
||||
});
|
||||
}
|
||||
Reference in new issue
Block a user