summaryrefslogtreecommitdiff
path: root/server/test/resource/line_builder/line_builder_test.dart
blob: c6aece76436e392c7730ab81ca598ad7c0c316da (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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
import 'package:test/test.dart';
import 'package:x_haven_server/core/line_builder/line_builder.dart';

// Only the pure-logic parts of the reference `line_builder_test.dart` are
// ported: the widget/metrics tests (`createLines`, `getTopPaddingForStyle`)
// depend on Flutter classes and the unported rendering code, so they are
// skipped until the Phase 4 web client re-implements the rendering.

void main() {
  // ── isElement ─────────────────────────────────────────────────────────────

  group('LineBuilder.isElement', () {
    test('"fire" is an element', () {
      expect(LineBuilder.isElement('fire'), isTrue);
    });

    test('"air" is an element', () {
      expect(LineBuilder.isElement('air'), isTrue);
    });

    test('"earth" is an element', () {
      expect(LineBuilder.isElement('earth'), isTrue);
    });

    test('"ice" is an element', () {
      expect(LineBuilder.isElement('ice'), isTrue);
    });

    test('"dark" is an element', () {
      expect(LineBuilder.isElement('dark'), isTrue);
    });

    test('"light" is an element', () {
      expect(LineBuilder.isElement('light'), isTrue);
    });

    test('"any" is an element', () {
      expect(LineBuilder.isElement('any'), isTrue);
    });

    test('string containing element name returns true', () {
      // e.g. "fire_fh" contains "fire"
      expect(LineBuilder.isElement('fire_fh'), isTrue);
      expect(LineBuilder.isElement('dark_half'), isTrue);
    });

    test('"attack" is not an element', () {
      expect(LineBuilder.isElement('attack'), isFalse);
    });

    test('"move" is not an element', () {
      expect(LineBuilder.isElement('move'), isFalse);
    });

    test('"poison" is not an element', () {
      expect(LineBuilder.isElement('poison'), isFalse);
    });

    test('empty string is not an element', () {
      expect(LineBuilder.isElement(''), isFalse);
    });

    test('"heal" is not an element', () {
      expect(LineBuilder.isElement('heal'), isFalse);
    });
  });
}