diff options
Diffstat (limited to 'server/test/command/set_solo_command_test.dart')
| -rw-r--r-- | server/test/command/set_solo_command_test.dart | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/server/test/command/set_solo_command_test.dart b/server/test/command/set_solo_command_test.dart new file mode 100644 index 0000000..3ac9c21 --- /dev/null +++ b/server/test/command/set_solo_command_test.dart @@ -0,0 +1,39 @@ +import 'package:test/test.dart'; +import 'package:x_haven_server/core/commands/set_solo_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('SetSoloCommand', () { + test('should set solo to true', () { + final command = SetSoloCommand(true); + command.execute(); + expect(getIt<GameState>().solo, isTrue); + checkSaveState(); + }); + + test('should set solo to false', () { + SetSoloCommand(true).execute(); + final command = SetSoloCommand(false); + command.execute(); + expect(getIt<GameState>().solo, isFalse); + checkSaveState(); + }); + + test('describe should return solo recommendation string when true', () { + final command = SetSoloCommand(true); + expect(command.describe(), 'Set solo level recommendation on'); + }); + + test('describe should return regular recommendation string when false', () { + final command = SetSoloCommand(false); + expect(command.describe(), 'Set solo level recommendation off'); + }); + }); +} |
