// ignore_for_file: no-magic-number, avoid-late-keyword import 'package:test/test.dart'; import 'package:x_haven_server/core/commands/add_character_command.dart'; import 'package:x_haven_server/core/commands/set_init_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(); }); late Character character; setUp(() { getIt().clearList(); AddCharacterCommand('Banner Spear', 'Frosthaven', 'BS', 1).execute(); character = getIt().currentList.firstWhere((e) => e is Character) as Character; }); group('SetInitCommand', () { test('should set initiative for a character', () { final command = SetInitCommand( character.id, 15, gameState: getIt(), ); command.execute(); expect(character.characterState.initiative, 15); checkSaveState(); }); test('should update initiative to a new value', () { SetInitCommand(character.id, 10, gameState: getIt()).execute(); SetInitCommand(character.id, 25, gameState: getIt()).execute(); expect(character.characterState.initiative, 25); }); test('describe should include character id', () { final command = SetInitCommand( 'Blinkblade', 15, gameState: getIt(), ); expect(command.describe(), 'Set initiative of Blinkblade'); }); }); }