summaryrefslogtreecommitdiff
path: root/server/test/command/set_campaign_command_test.dart
blob: 1f214ed6935bc0bda69d44e2adb0027154ad77bc (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
import 'package:test/test.dart';
import 'package:x_haven_server/core/commands/set_campaign_command.dart';
import 'package:x_haven_server/core/service_locator.dart';
import 'package:x_haven_server/core/state/game_state.dart';

import 'test_helpers.dart';

void main() {
  setUpAll(() async {
    await setUpGame();
  });

  group('SetCampaignCommand', () {
    test('should set campaign to Frosthaven', () {
      final command = SetCampaignCommand('Frosthaven');
      command.execute();
      expect(getIt<GameState>().currentCampaign, 'Frosthaven');
      checkSaveState();
    });

    test('should set campaign to Jaws of the Lion', () {
      final command = SetCampaignCommand('Jaws of the Lion');
      command.execute();
      expect(getIt<GameState>().currentCampaign, 'Jaws of the Lion');
      checkSaveState();
    });

    test('describe should return correct string', () {
      final command = SetCampaignCommand('Frosthaven');
      expect(command.describe(), 'Set Frosthaven campaign');
    });
  });
}