diff options
Diffstat (limited to 'server/test/command/set_auto_level_adjust_command_test.dart')
| -rw-r--r-- | server/test/command/set_auto_level_adjust_command_test.dart | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/server/test/command/set_auto_level_adjust_command_test.dart b/server/test/command/set_auto_level_adjust_command_test.dart new file mode 100644 index 0000000..d9cd253 --- /dev/null +++ b/server/test/command/set_auto_level_adjust_command_test.dart @@ -0,0 +1,51 @@ +import 'package:test/test.dart'; +import 'package:x_haven_server/core/commands/set_auto_level_adjust_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(); + }); + + group('SetAutoLevelAdjustCommand', () { + test('should turn auto level adjust on', () { + final command = SetAutoLevelAdjustCommand( + true, + gameState: getIt<GameState>(), + ); + command.execute(); + expect(getIt<GameState>().autoScenarioLevel, isTrue); + checkSaveState(); + }); + + test('should turn auto level adjust off', () { + SetAutoLevelAdjustCommand(true, gameState: getIt<GameState>()).execute(); + final command = SetAutoLevelAdjustCommand( + false, + gameState: getIt<GameState>(), + ); + command.execute(); + expect(getIt<GameState>().autoScenarioLevel, isFalse); + checkSaveState(); + }); + + test('describe should say "on" when enabled', () { + final command = SetAutoLevelAdjustCommand( + true, + gameState: getIt<GameState>(), + ); + expect(command.describe(), 'Turn automatic level update on'); + }); + + test('describe should say "off" when disabled', () { + final command = SetAutoLevelAdjustCommand( + false, + gameState: getIt<GameState>(), + ); + expect(command.describe(), 'Turn automatic level update off'); + }); + }); +} |
