summaryrefslogtreecommitdiff
path: root/server/test/command/draw_modifier_card_command_test.dart
blob: ebb4bd7445cb27a5d3fb0a06425957382abf679d (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
import 'package:test/test.dart';
import 'package:x_haven_server/core/commands/draw_modifier_card_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('DrawModifierCardCommand', () {
    test('should move a card from draw pile to discard pile', () {
      final deck = getIt<GameState>().modifierDeck;
      final drawBefore = deck.drawPileSize;
      final discardBefore = deck.discardPileSize;

      DrawModifierCardCommand('', gameState: getIt<GameState>()).execute();

      expect(deck.drawPileSize, drawBefore - 1);
      expect(deck.discardPileSize, discardBefore + 1);
      checkSaveState();
    });

    test('describe with empty name returns monster string', () {
      final command = DrawModifierCardCommand(
        '',
        gameState: getIt<GameState>(),
      );
      expect(command.describe(), 'Draw monster modifier card');
    });

    test('describe with non-empty name includes name', () {
      final command = DrawModifierCardCommand(
        'Blinkblade',
        gameState: getIt<GameState>(),
      );
      expect(command.describe(), 'Draw Blinkblade modifier card');
    });
  });
}