blob: 4c73d08fab3219216103ade5c92e1ac7ac837b18 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
|
// ignore_for_file: avoid-non-null-assertion
import 'package:test/test.dart';
import 'package:x_haven_server/core/commands/add_monster_command.dart';
import 'package:x_haven_server/core/commands/draw_ability_card_command.dart';
import 'package:x_haven_server/core/game_methods.dart';
import 'package:x_haven_server/core/state/game_state.dart';
import 'package:x_haven_server/core/service_locator.dart';
import 'test_helpers.dart';
void main() {
setUpAll(() async {
await setUpGame();
});
setUp(() {
getIt<GameState>().clearList();
AddMonsterCommand(
'Ancient Artillery (FH)',
1,
false,
gameState: getIt<GameState>(),
).execute();
});
group('DrawAbilityCardCommand', () {
test('should move a card from draw pile to discard pile', () {
final monster =
getIt<GameState>().currentList.firstWhere((e) => e is Monster)
as Monster;
final deck = GameMethods.getDeck(monster.type.deck)!;
final drawBefore = deck.drawPileSize;
final discardBefore = deck.discardPileSize;
DrawAbilityCardCommand(monster.id).execute();
expect(deck.drawPileSize, drawBefore - 1);
expect(deck.discardPileSize, discardBefore + 1);
checkSaveState();
});
test('describe returns correct string', () {
final monster =
getIt<GameState>().currentList.firstWhere((e) => e is Monster)
as Monster;
final command = DrawAbilityCardCommand(monster.id);
expect(command.describe(), 'Draw extra ability card');
});
});
}
|