summaryrefslogtreecommitdiff
path: root/server/test/command/amd_reveal_command_test.dart
blob: 98fdb8d280c8b6c677c1497a0de4d4464408857f (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
40
41
42
43
44
45
46
47
48
49
50
// ignore_for_file: no-magic-number

import 'package:test/test.dart';
import 'package:x_haven_server/core/commands/amd_reveal_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('AMDRevealCommand', () {
    test('should set revealedCount on the main modifier deck', () {
      final command = AMDRevealCommand(
        amount: 2,
        name: 'Monsters',
        gameState: getIt<GameState>(),
      );
      command.execute();
      expect(getIt<GameState>().modifierDeck.revealedCount, 2);
      checkSaveState();
    });

    test('should set revealedCount to zero when amount is 0', () {
      AMDRevealCommand(
        amount: 3,
        name: 'Monsters',
        gameState: getIt<GameState>(),
      ).execute();
      AMDRevealCommand(
        amount: 0,
        name: 'Monsters',
        gameState: getIt<GameState>(),
      ).execute();
      expect(getIt<GameState>().modifierDeck.revealedCount, 0);
    });

    test('describe should include the amount', () {
      final command = AMDRevealCommand(
        amount: 3,
        name: 'Monsters',
        gameState: getIt<GameState>(),
      );
      expect(command.describe(), 'Reveal 3 modifier cards');
    });
  });
}