blob: 7ff8c0dd1ed78dba3bd64cd28732939ae88ca88a (
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
52
53
54
55
|
import 'package:test/test.dart';
import 'package:x_haven_server/core/commands/add_loot_card_command.dart';
import 'package:x_haven_server/core/commands/set_campaign_command.dart';
import 'package:x_haven_server/core/commands/set_scenario_command.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();
// A scenario is needed to initialize the loot deck
SetCampaignCommand("Frosthaven").execute();
SetScenarioCommand(
'#0 Howling in the Snow',
false,
gameState: getIt<GameState>(),
).execute();
});
group('AddLootCardCommand', () {
test('should add a specified loot card to the deck', () {
// Arrange
final command = AddLootCardCommand(
'lumber',
gameState: getIt<GameState>(),
);
final lootDeck = getIt<GameState>().lootDeck;
final initialCardCount = lootDeck.drawPileSize;
// Act
command.execute();
// Assert
expect(lootDeck.drawPileSize, initialCardCount + 1);
checkSaveState();
});
test('describe should return the correct string', () {
// Arrange
final command = AddLootCardCommand(
'hides',
gameState: getIt<GameState>(),
);
// Act & Assert
expect(command.describe(), 'Add hides Loot Card');
});
});
}
|