// ignore_for_file: no-magic-number import 'package:test/test.dart'; import 'package:x_haven_server/core/commands/enhance_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(() { SetCampaignCommand('Frosthaven').execute(); SetScenarioCommand( '#0 Howling in the Snow', false, gameState: getIt(), ).execute(); }); group('EnhanceLootCardCommand', () { test('should add an enhancement to a loot card', () { final lootDeck = getIt().lootDeck; // Get any existing card id from the draw pile if (lootDeck.drawPileIsNotEmpty) { final cardId = lootDeck.drawPileContents.toList().first.id; EnhanceLootCardCommand( cardId, 2, 'coin', gameState: getIt(), ).execute(); // After enhancement the deck is rebuilt; verify it doesn't crash expect(lootDeck.drawPileIsNotEmpty, isTrue); checkSaveState(); } }); test('describe returns "Add Loot Enhancement" when value is positive', () { expect( EnhanceLootCardCommand( 1, 1, 'coin', gameState: getIt(), ).describe(), 'Add Loot Enhancement', ); }); test( 'describe returns "Remove Loot Enhancement" when value is zero or negative', () { expect( EnhanceLootCardCommand( 1, 0, 'coin', gameState: getIt(), ).describe(), 'Remove Loot Enhancement', ); expect( EnhanceLootCardCommand( 1, -1, 'coin', gameState: getIt(), ).describe(), 'Remove Loot Enhancement', ); }, ); }); }