summaryrefslogtreecommitdiff
path: root/server/test/command/set_solo_command_test.dart
blob: 3ac9c210b416e51ecd97e0226ea19b5c6e9483b9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
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');
    });
  });
}