init
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:hakemsho/features/lobby/wallet.dart';
|
||||
|
||||
void main() {
|
||||
test('Wallet.fromJson parses server response', () {
|
||||
final w = Wallet.fromJson(const {
|
||||
'coins': 4560,
|
||||
'tickets': 3,
|
||||
'xp': 325,
|
||||
'trophies': 12,
|
||||
'level': 8,
|
||||
'xp_into_level': 325,
|
||||
'xp_for_next': 400,
|
||||
'vip': true,
|
||||
'selected_card': 'swiss',
|
||||
});
|
||||
expect(w.coins, 4560);
|
||||
expect(w.tickets, 3);
|
||||
expect(w.level, 8);
|
||||
expect(w.vip, true);
|
||||
expect(w.selectedCard, 'swiss');
|
||||
});
|
||||
|
||||
test('Wallet.fromJson uses defaults for missing fields', () {
|
||||
final w = Wallet.fromJson(const {});
|
||||
expect(w.coins, 0);
|
||||
expect(w.level, 1);
|
||||
expect(w.selectedCard, 'simple');
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user