summaryrefslogtreecommitdiff
path: root/server/test/command/add_loot_card_command_test.dart
diff options
context:
space:
mode:
Diffstat (limited to 'server/test/command/add_loot_card_command_test.dart')
-rw-r--r--server/test/command/add_loot_card_command_test.dart55
1 files changed, 55 insertions, 0 deletions
diff --git a/server/test/command/add_loot_card_command_test.dart b/server/test/command/add_loot_card_command_test.dart
new file mode 100644
index 0000000..7ff8c0d
--- /dev/null
+++ b/server/test/command/add_loot_card_command_test.dart
@@ -0,0 +1,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');
+ });
+ });
+}