summaryrefslogtreecommitdiff
path: root/server/test/command/set_loot_owner_command_test.dart
diff options
context:
space:
mode:
Diffstat (limited to 'server/test/command/set_loot_owner_command_test.dart')
-rw-r--r--server/test/command/set_loot_owner_command_test.dart48
1 files changed, 48 insertions, 0 deletions
diff --git a/server/test/command/set_loot_owner_command_test.dart b/server/test/command/set_loot_owner_command_test.dart
new file mode 100644
index 0000000..00d95a9
--- /dev/null
+++ b/server/test/command/set_loot_owner_command_test.dart
@@ -0,0 +1,48 @@
+import 'package:test/test.dart';
+import 'package:x_haven_server/core/commands/add_character_command.dart';
+import 'package:x_haven_server/core/commands/draw_loot_card_command.dart';
+import 'package:x_haven_server/core/commands/set_campaign_command.dart';
+import 'package:x_haven_server/core/commands/set_loot_owner_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();
+ AddCharacterCommand('Blinkblade', 'Frosthaven', 'blinky', 1).execute();
+ SetCampaignCommand('Frosthaven').execute();
+ SetScenarioCommand(
+ 'custom',
+ false,
+ gameState: getIt<GameState>(),
+ ).execute();
+ DrawLootCardCommand(gameState: getIt<GameState>()).execute();
+ });
+
+ group('SetLootOwnerCommand', () {
+ test('should set owner on the loot card', () {
+ final lootDeck = getIt<GameState>().lootDeck;
+ final card = lootDeck.discardPileTop;
+ expect(card.owner, isEmpty);
+
+ SetLootOwnerCommand('Blinkblade', card).execute();
+
+ expect(card.owner, 'Blinkblade');
+ checkSaveState();
+ });
+
+ test('describe returns correct string', () {
+ final lootDeck = getIt<GameState>().lootDeck;
+ final card = lootDeck.discardPileTop;
+ final command = SetLootOwnerCommand('Blinkblade', card);
+ expect(command.describe(), 'Set loot card owner');
+ });
+ });
+}