// ignore_for_file: no-magic-number import 'package:test/test.dart'; import 'package:x_haven_server/core/commands/add_monster_command.dart'; import 'package:x_haven_server/core/commands/set_level_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().clearList(); }); group('SetLevelCommand', () { test('should set global level when monsterId is null', () { final command = SetLevelCommand(3, null); command.execute(); expect(getIt().level, 3); checkSaveState(); }); test('should set a specific monster level when monsterId is provided', () { AddMonsterCommand( 'Ancient Artillery (FH)', 1, false, gameState: getIt(), ).execute(); final monster = getIt().currentList.firstWhere((e) => e is Monster) as Monster; SetLevelCommand(4, monster.id).execute(); expect(monster.level, 4); checkSaveState(); }); test('describe without monsterId returns "Set Level"', () { final command = SetLevelCommand(2, null); expect(command.describe(), 'Set Level'); }); test('describe with monsterId includes monster name', () { final command = SetLevelCommand(2, 'Ancient Artillery (FH)'); expect(command.describe(), "Set Ancient Artillery (FH)'s level"); }); }); }