mana-scribe 1.0.0 → 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mana-scribe",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "description": "Library for parsing and querying Magic: The Gathering mana costs — with support for CMC, devotion, and color identity.",
5
5
  "keywords": [
6
6
  "mtg",
@@ -31,5 +31,11 @@
31
31
  "scripts": {
32
32
  "test": "jasmine --config=jasmine.json",
33
33
  "coverage": "c8 npm test"
34
- }
34
+ },
35
+ "files": [
36
+ "src/",
37
+ "README.md",
38
+ "LICENSE",
39
+ "package.json"
40
+ ]
35
41
  }
package/.c8rc.json DELETED
@@ -1,10 +0,0 @@
1
- {
2
- "reporter": ["lcov", "text"],
3
- "report-dir": "./coverage",
4
- "exclude": [
5
- "tests/**",
6
- "node_modules/**"
7
- ],
8
- "check-coverage": false,
9
- "skip_empty": true
10
- }
@@ -1,37 +0,0 @@
1
- name: Node.js Tests
2
-
3
- on:
4
- push:
5
- branches: [ master ]
6
- pull_request:
7
- branches: [ master ]
8
-
9
- jobs:
10
- test:
11
- runs-on: ubuntu-latest
12
-
13
- strategy:
14
- matrix:
15
- node-version: [18.x, 24.x]
16
-
17
- steps:
18
- - name: Checkout repo
19
- uses: actions/checkout@v4
20
-
21
- - name: Setup Node.js
22
- uses: actions/setup-node@v4
23
- with:
24
- node-version: ${{ matrix.node-version }}
25
- cache: 'npm'
26
-
27
- - name: Install dependencies
28
- run: npm ci
29
-
30
- - name: Run tests with coverage
31
- run: npm run coverage
32
-
33
- - name: Upload coverage to Codecov
34
- uses: codecov/codecov-action@v4
35
- with:
36
- token: ${{ secrets.CODECOV_TOKEN }}
37
- files: ./coverage/lcov.info
package/jasmine.json DELETED
@@ -1,8 +0,0 @@
1
- {
2
- "spec_dir": ".",
3
- "spec_files": [
4
- "tests/**/*.test.js"
5
- ],
6
- "random": false,
7
- "stopSpecOnExpectationFailure": false
8
- }
@@ -1,65 +0,0 @@
1
- import ActivationCost from '../../src/costs/ActivationCost.js';
2
-
3
- describe('ActivationCost (E2E)', () => {
4
- describe('parsing non-mana symbols', () => {
5
- it('parses tap symbol', () => {
6
- const cost = ActivationCost.parse('T');
7
- expect(cost.symbols.length).toBe(1);
8
- expect(cost.symbols[0].type).toBe('tap');
9
- });
10
-
11
- it('parses untap symbol', () => {
12
- const cost = ActivationCost.parse('{Q}');
13
- expect(cost.symbols[0].type).toBe('untap');
14
- });
15
-
16
- it('parses energy symbol', () => {
17
- const cost = ActivationCost.parse('{E}');
18
- expect(cost.symbols[0].type).toBe('energy');
19
- });
20
- });
21
-
22
- describe('mixed activation + mana costs', () => {
23
- it('parses {2}{R}{T}', () => {
24
- const cost = ActivationCost.parse('{2}{R}{T}');
25
- const types = cost.symbols.map(s => s.type);
26
- expect(types).toContain('genericMana');
27
- expect(types).toContain('coloredMana');
28
- expect(types).toContain('tap');
29
- expect(cost.colors).toEqual(['R']);
30
- });
31
-
32
- it('parses {E}{W}{Q}', () => {
33
- const cost = ActivationCost.parse('{E}{W}{Q}');
34
- const types = cost.symbols.map(s => s.type);
35
- expect(types).toEqual(['energy','coloredMana','untap']);
36
- expect(cost.colors).toEqual(['W']);
37
- });
38
- });
39
-
40
- describe('case insensitivity', () => {
41
- it('parses lowercase {t}{q}{e}{w}', () => {
42
- const cost = ActivationCost.parse('{t}{q}{e}{w}');
43
- const types = cost.symbols.map(s => s.type);
44
- expect(types).toEqual(['tap','untap','energy','coloredMana']);
45
- expect(cost.colors).toEqual(['W']);
46
- });
47
- });
48
-
49
- describe('serialization', () => {
50
- it('serializes back to string with braces', () => {
51
- const input = '{2}{U}{T}{E}';
52
- const cost = ActivationCost.parse(input);
53
- expect(cost.toString(true)).toBe(input);
54
- });
55
- });
56
-
57
- describe('error handling', () => {
58
- it('stops parsing at invalid symbol', () => {
59
- const cost = ActivationCost.parse('{W}, T:');
60
- expect(cost.symbols.length).toBe(1);
61
- expect(cost.symbols[0].type).toBe('coloredMana');
62
- expect(cost.remainingStr).toBe(', T:');
63
- });
64
- });
65
- });
@@ -1,27 +0,0 @@
1
- import Cost from '../../src/costs/Cost.js';
2
- import { NotImplementedError } from '../../src/customErrors.js';
3
-
4
- describe('Cost class', () => {
5
- describe('allowedSymbols', () => {
6
- it('should throw NotImplementedError when accessed', () => {
7
- expect(() => {
8
- Cost.allowedSymbols;
9
- }).toThrowError(
10
- NotImplementedError,
11
- 'Method "allowedSymbols" not implemented'
12
- );
13
- });
14
- });
15
-
16
- describe('parseNextSymbol', () => {
17
- it('should throw NotImplementedError when trying to use allowedSymbols', () => {
18
- class DummyCost extends Cost {}
19
- expect(() => {
20
- new DummyCost().parseNextSymbol('{X}');
21
- }).toThrowError(
22
- NotImplementedError,
23
- 'Method "allowedSymbols" not implemented'
24
- );
25
- });
26
- });
27
- });
@@ -1,124 +0,0 @@
1
- import ManaCost from '../../src/costs/ManaCost.js';
2
-
3
- describe('ManaCost (E2E)', () => {
4
- describe('parsing simple costs', () => {
5
- it('parses generic numbers', () => {
6
- const cost = ManaCost.parse('3');
7
- expect(cost.symbols.length).toBe(1);
8
- expect(cost.symbols[0].type).toBe('genericMana');
9
- expect(cost.cmc).toBe(3);
10
- expect(cost.colors).toEqual([]);
11
- });
12
-
13
- it('parses colored mana', () => {
14
- const cost = ManaCost.parse('WUBRG');
15
- expect(cost.symbols.map(s => s.type)).toEqual([
16
- 'coloredMana','coloredMana','coloredMana','coloredMana','coloredMana'
17
- ]);
18
- expect(cost.cmc).toBe(5);
19
- expect(cost.colors.sort()).toEqual(['B','G','R','U','W']);
20
- });
21
- });
22
-
23
- describe('hybrid and phyrexian costs', () => {
24
- it('parses two-color hybrid', () => {
25
- const cost = ManaCost.parse('{G/U}');
26
- expect(cost.symbols.length).toBe(1);
27
- expect(cost.symbols[0].type).toBe('twoColorHybridMana');
28
- expect(cost.cmc).toBe(1);
29
- expect(cost.colors.sort()).toEqual(['G','U']);
30
- });
31
-
32
- it('parses generic hybrid', () => {
33
- const cost = ManaCost.parse('2/W');
34
- expect(cost.symbols[0].type).toBe('genericHybridMana');
35
- expect(cost.cmc).toBe(1);
36
- expect(cost.colors).toEqual(['W']);
37
- });
38
-
39
- it('parses colored phyrexian', () => {
40
- const cost = ManaCost.parse('R/H');
41
- expect(cost.symbols[0].type).toBe('coloredPhyrexianMana');
42
- expect(cost.cmc).toBe(1);
43
- expect(cost.colors).toEqual(['R']);
44
- });
45
-
46
- it('parses colorless phyrexian', () => {
47
- const cost = ManaCost.parse('{H}');
48
- expect(cost.symbols[0].type).toBe('colorlessPhyrexianMana');
49
- expect(cost.cmc).toBe(1);
50
- expect(cost.colors).toEqual([]);
51
- });
52
- });
53
-
54
- describe('special symbols', () => {
55
- it('parses half mana', () => {
56
- const cost = ManaCost.parse('|G');
57
- expect(cost.symbols[0].type).toBe('halfColoredMana');
58
- expect(cost.cmc).toBe(0.5);
59
- expect(cost.colors).toEqual(['G']);
60
- });
61
-
62
- it('parses variable mana (X)', () => {
63
- const cost = ManaCost.parse('X');
64
- expect(cost.symbols[0].type).toBe('variableMana');
65
- expect(cost.cmc).toBe(0);
66
- });
67
-
68
- it('parses infinity', () => {
69
- const cost = ManaCost.parse('I');
70
- expect(cost.symbols[0].type).toBe('infiniteMana');
71
- expect(cost.cmc).toBe(Infinity);
72
- });
73
-
74
- it('parses snow mana', () => {
75
- const cost = ManaCost.parse('S');
76
- expect(cost.symbols[0].type).toBe('snowMana');
77
- expect(cost.cmc).toBe(1);
78
- });
79
-
80
- it('parses colorless mana', () => {
81
- const cost = ManaCost.parse('C');
82
- expect(cost.symbols[0].type).toBe('colorlessMana');
83
- expect(cost.cmc).toBe(1);
84
- });
85
- });
86
-
87
- describe('complex costs', () => {
88
- it('parses a mixed cost string', () => {
89
- const cost = ManaCost.parse('{3}{W}{U}{B}{R}{G}{2/W}{G/U}{H}{S}{X}{C}');
90
- const types = cost.symbols.map(s => s.type);
91
- expect(types).toContain('genericMana');
92
- expect(types).toContain('coloredMana');
93
- expect(types).toContain('genericHybridMana');
94
- expect(types).toContain('twoColorHybridMana');
95
- expect(types).toContain('colorlessPhyrexianMana');
96
- expect(types).toContain('snowMana');
97
- expect(types).toContain('variableMana');
98
- expect(types).toContain('colorlessMana');
99
- expect(cost.cmc).toBe(13);
100
- expect(cost.colors.sort()).toEqual(['B','G','R','U','W']);
101
- });
102
-
103
- it('computes devotion correctly', () => {
104
- const cost = ManaCost.parse('WWWU');
105
- expect(cost.getDevotionTo('W')).toBe(3);
106
- expect(cost.getDevotionTo('U')).toBe(1);
107
- expect(cost.getDevotionTo('B')).toBe(0);
108
- });
109
-
110
- it('serializes back to string', () => {
111
- const input = '{3}{W}{U}{B}{R}{G}';
112
- const cost = ManaCost.parse(input);
113
- expect(cost.toString(true)).toBe(input);
114
- });
115
- });
116
-
117
- describe('error handling', () => {
118
- it('stops parsing at invalid symbol and sets remainingStr', () => {
119
- const cost = ManaCost.parse('WQZ'); // W is valid, Q is not a mana symbol here
120
- expect(cost.symbols[0].type).toBe('coloredMana');
121
- expect(cost.remainingStr).toBe('QZ');
122
- });
123
- });
124
- });
@@ -1,80 +0,0 @@
1
- import ManaCost from '../src/costs/ManaCost.js';
2
- import ActivationCost from '../src/costs/ActivationCost.js';
3
-
4
- describe('Real-world integration', () => {
5
- describe('ManaCost', () => {
6
- it('Emrakul ({15})', () => {
7
- const cost = ManaCost.parse('{15}');
8
- expect(cost.cmc).toBe(15);
9
- expect(cost.colors).toEqual([]);
10
- expect(cost.remainingStr).toBe('');
11
- expect(cost.toString(true)).toBe('{15}');
12
- });
13
-
14
- it('Niv-Mizzet Reborn ({W}{U}{B}{R}{G})', () => {
15
- const cost = ManaCost.parse('{W}{U}{B}{R}{G}');
16
- expect(cost.cmc).toBe(5);
17
- expect(cost.colors.sort()).toEqual(['B','G','R','U','W']);
18
- expect(cost.getDevotionTo('W')).toBe(1);
19
- expect(cost.remainingStr).toBe('');
20
- });
21
-
22
- it('Phyrexian Metamorph ({3}{U/P} as {3}{U/H})', () => {
23
- const cost = ManaCost.parse('{3}{U/H}');
24
- expect(cost.cmc).toBe(4);
25
- expect(cost.colors).toEqual(['U']);
26
- expect(cost.remainingStr).toBe('');
27
- });
28
-
29
- it('cost with trailing reminder text', () => {
30
- const str = '{1}{U}{U}{U} (choose two…)';
31
- const cost = ManaCost.parse(str);
32
- expect(cost.cmc).toBe(4);
33
- expect(cost.colors).toEqual(['U']);
34
- expect(cost.remainingStr).toBe(' (choose two…)');
35
- });
36
- });
37
-
38
- describe('ActivationCost', () => {
39
- it('tap then text', () => {
40
- const str = '{T}: Add {G}.';
41
- const cost = ActivationCost.parse(str);
42
- expect(cost.symbols.map(s => s.type)).toEqual(['tap']);
43
- expect(cost.colors).toEqual([]);
44
- expect(cost.remainingStr).toBe(': Add {G}.');
45
- });
46
-
47
- it('mana, then comma and tap + text (stops at comma)', () => {
48
- const str = '{1}{B}, {T}, Discard a card: Create a 2/2 Zombie.';
49
- const cost = ActivationCost.parse(str);
50
- expect(cost.symbols.map(s => s.type)).toEqual(['genericMana','coloredMana']);
51
- expect(cost.colors).toEqual(['B']);
52
- expect(cost.remainingStr).toBe(', {T}, Discard a card: Create a 2/2 Zombie.');
53
- });
54
-
55
- it('untap then text (stops at comma)', () => {
56
- const str = '{Q}, Pay 2 life: Untap target creature.';
57
- const cost = ActivationCost.parse(str);
58
- expect(cost.symbols.map(s => s.type)).toEqual(['untap']);
59
- expect(cost.colors).toEqual([]);
60
- expect(cost.remainingStr).toBe(', Pay 2 life: Untap target creature.');
61
- });
62
-
63
- it('energy then text (stops at comma)', () => {
64
- const str = '{E}, {T}: Deal 1 damage.';
65
- const cost = ActivationCost.parse(str);
66
- expect(cost.symbols.map(s => s.type)).toEqual(['energy']);
67
- expect(cost.colors).toEqual([]);
68
- expect(cost.remainingStr).toBe(', {T}: Deal 1 damage.');
69
- });
70
-
71
- it('mixed shortform + braces then text (stops at comma)', () => {
72
- const str = '2R, {T}: Ping.';
73
- const cost = ActivationCost.parse(str);
74
- // Only "2" then "R" get parsed; stops at the comma before {T}
75
- expect(cost.symbols.map(s => s.type)).toEqual(['genericMana','coloredMana']);
76
- expect(cost.colors).toEqual(['R']);
77
- expect(cost.remainingStr).toBe(', {T}: Ping.');
78
- });
79
- });
80
- });
@@ -1,62 +0,0 @@
1
- import ColoredManaSymbol from '../../src/symbols/ColoredManaSymbol.js';
2
-
3
- describe('ColoredManaSymbol', () => {
4
- describe('fromString()', () => {
5
- it('creates a symbol from shortform', () => {
6
- const sym = ColoredManaSymbol.fromString('R');
7
- expect(sym).toBeInstanceOf(ColoredManaSymbol);
8
- expect(sym.raw).toBe('R');
9
- expect(sym.remainingStr).toBe('');
10
- });
11
-
12
- it('creates a symbol from scryfall braces', () => {
13
- const sym = ColoredManaSymbol.fromString('{g}');
14
- expect(sym.raw).toBe('G'); // normalized to uppercase
15
- expect(sym.remainingStr).toBe('');
16
- });
17
-
18
- it('throws for invalid input', () => {
19
- expect(() => ColoredManaSymbol.fromString('X')).toThrow();
20
- expect(() => ColoredManaSymbol.fromString('{C}')).toThrow();
21
- });
22
- });
23
-
24
- describe('properties', () => {
25
- it('has type coloredMana', () => {
26
- expect(ColoredManaSymbol.fromString('U').type).toBe('coloredMana');
27
- });
28
-
29
- it('cmcValue is always 1', () => {
30
- for (const c of 'WUBRG') {
31
- expect(ColoredManaSymbol.fromString(c).cmcValue()).toBe(1);
32
- }
33
- });
34
-
35
- it('reports correct colors', () => {
36
- for (const c of 'WUBRG') {
37
- expect(ColoredManaSymbol.fromString(c).colors).toEqual([c]);
38
- }
39
- });
40
-
41
- it('devotion to its color is 1, others 0', () => {
42
- const sym = ColoredManaSymbol.fromString('U');
43
- expect(sym.devotion('U')).toBe(1);
44
- expect(sym.devotion('R')).toBe(0);
45
- });
46
- });
47
-
48
- describe('inherited methods', () => {
49
- it('apply() pushes to array', () => {
50
- const arr = [];
51
- const sym = ColoredManaSymbol.fromString('W');
52
- sym.apply(arr);
53
- expect(arr[0]).toBe(sym);
54
- });
55
-
56
- it('toString() outputs correctly', () => {
57
- const sym = ColoredManaSymbol.fromString('G');
58
- expect(sym.toString(false)).toBe('G');
59
- expect(sym.toString(true)).toBe('{G}');
60
- });
61
- });
62
- });
@@ -1,69 +0,0 @@
1
- import ColoredPhyrexianManaSymbol from '../../src/symbols/ColoredPhyrexianManaSymbol.js';
2
-
3
- describe('ColoredPhyrexianManaSymbol', () => {
4
- describe('fromString()', () => {
5
- it('creates a symbol from H/W and W/H (braced and shortform)', () => {
6
- const s1 = ColoredPhyrexianManaSymbol.fromString('H/W');
7
- expect(s1.raw).toBe('H/W');
8
- expect(s1.colors).toEqual(['W']);
9
-
10
- const s2 = ColoredPhyrexianManaSymbol.fromString('{W/H}');
11
- expect(s2.raw).toBe('W/H');
12
- expect(s2.colors).toEqual(['W']);
13
- });
14
-
15
- it('is case insensitive', () => {
16
- const s1 = ColoredPhyrexianManaSymbol.fromString('{h/b}');
17
- expect(s1.raw).toBe('H/B');
18
- expect(s1.colors).toEqual(['B']);
19
-
20
- const s2 = ColoredPhyrexianManaSymbol.fromString('u/h');
21
- expect(s2.raw).toBe('U/H');
22
- expect(s2.colors).toEqual(['U']);
23
- });
24
-
25
- it('throws for invalid input', () => {
26
- expect(() => ColoredPhyrexianManaSymbol.fromString('{U}')).toThrow();
27
- expect(() => ColoredPhyrexianManaSymbol.fromString('2/W')).toThrow();
28
- expect(() => ColoredPhyrexianManaSymbol.fromString('{C}')).toThrow();
29
- });
30
-
31
- for (const c of 'WUBRG') {
32
- it(`parses H/${c} and ${c}/H correctly`, () => {
33
- const sym1 = ColoredPhyrexianManaSymbol.fromString(`H/${c}`);
34
- expect(sym1.colors).toEqual([c]);
35
-
36
- const sym2 = ColoredPhyrexianManaSymbol.fromString(`${c}/H`);
37
- expect(sym2.colors).toEqual([c]);
38
- });
39
- }
40
-
41
- });
42
-
43
- describe('properties', () => {
44
- it('has type coloredPhyrexianMana', () => {
45
- const sym = ColoredPhyrexianManaSymbol.fromString('H/G');
46
- expect(sym.type).toBe('coloredPhyrexianMana');
47
- });
48
-
49
- it('cmcValue is always 1', () => {
50
- expect(ColoredPhyrexianManaSymbol.fromString('H/U').cmcValue()).toBe(1);
51
- expect(ColoredPhyrexianManaSymbol.fromString('B/H').cmcValue()).toBe(1);
52
- });
53
- });
54
-
55
- describe('inherited methods', () => {
56
- it('apply() pushes to array', () => {
57
- const arr = [];
58
- const sym = ColoredPhyrexianManaSymbol.fromString('H/R');
59
- sym.apply(arr);
60
- expect(arr[0]).toBe(sym);
61
- });
62
-
63
- it('toString() outputs correctly', () => {
64
- const sym = ColoredPhyrexianManaSymbol.fromString('W/H');
65
- expect(sym.toString(false)).toBe('W/H');
66
- expect(sym.toString(true)).toBe('{W/H}');
67
- });
68
- });
69
- });
@@ -1,56 +0,0 @@
1
- import ColorlessManaSymbol from '../../src/symbols/ColorlessManaSymbol.js';
2
-
3
- describe('ColorlessManaSymbol', () => {
4
- describe('fromString()', () => {
5
- it('creates a symbol from shortform C', () => {
6
- const sym = ColorlessManaSymbol.fromString('C');
7
- expect(sym).toBeInstanceOf(ColorlessManaSymbol);
8
- expect(sym.raw).toBe('C');
9
- expect(sym.remainingStr).toBe('');
10
- });
11
-
12
- it('creates a symbol from scryfall style {C}', () => {
13
- const sym = ColorlessManaSymbol.fromString('{c}');
14
- expect(sym.raw).toBe('C'); // uppercased
15
- expect(sym.remainingStr).toBe('');
16
- });
17
-
18
- it('throws for invalid input', () => {
19
- expect(() => ColorlessManaSymbol.fromString('{X}')).toThrow();
20
- expect(() => ColorlessManaSymbol.fromString('W')).toThrow();
21
- expect(() => ColorlessManaSymbol.fromString('')).toThrow();
22
- });
23
- });
24
-
25
- describe('properties', () => {
26
- it('has type colorlessMana', () => {
27
- const sym = ColorlessManaSymbol.fromString('C');
28
- expect(sym.type).toBe('colorlessMana');
29
- });
30
-
31
- it('cmcValue is always 1', () => {
32
- const sym = ColorlessManaSymbol.fromString('{C}');
33
- expect(sym.cmcValue()).toBe(1);
34
- });
35
-
36
- it('colors is always empty', () => {
37
- const sym = ColorlessManaSymbol.fromString('C');
38
- expect(sym.colors).toEqual([]);
39
- });
40
- });
41
-
42
- describe('inherited methods', () => {
43
- it('apply() pushes to array', () => {
44
- const arr = [];
45
- const sym = ColorlessManaSymbol.fromString('C');
46
- sym.apply(arr);
47
- expect(arr[0]).toBe(sym);
48
- });
49
-
50
- it('toString() outputs correctly', () => {
51
- const sym = ColorlessManaSymbol.fromString('C');
52
- expect(sym.toString(false)).toBe('C');
53
- expect(sym.toString(true)).toBe('{C}');
54
- });
55
- });
56
- });
@@ -1,61 +0,0 @@
1
- import ColorlessPhyrexianManaSymbol from '../../src/symbols/ColorlessPhyrexianManaSymbol.js';
2
-
3
- describe('ColorlessPhyrexianManaSymbol', () => {
4
- describe('fromString()', () => {
5
- it('creates a symbol from H/C and C/H (shortform and braced)', () => {
6
- expect(ColorlessPhyrexianManaSymbol.fromString('H/C').raw).toBe('H/C');
7
- expect(ColorlessPhyrexianManaSymbol.fromString('{c/h}').raw).toBe('C/H');
8
- });
9
-
10
- it('creates a symbol from H (shortform and braced)', () => {
11
- expect(ColorlessPhyrexianManaSymbol.fromString('H').raw).toBe('H');
12
- expect(ColorlessPhyrexianManaSymbol.fromString('{h}').raw).toBe('H');
13
- });
14
-
15
- it('is case insensitive', () => {
16
- const sym = ColorlessPhyrexianManaSymbol.fromString('{h/c}');
17
- expect(sym.raw).toBe('H/C');
18
- });
19
-
20
- it('throws for invalid input', () => {
21
- expect(() => ColorlessPhyrexianManaSymbol.fromString('C')).toThrow();
22
- expect(() => ColorlessPhyrexianManaSymbol.fromString('{X}')).toThrow();
23
- });
24
- });
25
-
26
- describe('properties', () => {
27
- it('has type colorlessPhyrexianMana', () => {
28
- const sym = ColorlessPhyrexianManaSymbol.fromString('H');
29
- expect(sym.type).toBe('colorlessPhyrexianMana');
30
- });
31
-
32
- it('cmcValue is always 1', () => {
33
- const sym = ColorlessPhyrexianManaSymbol.fromString('H/C');
34
- expect(sym.cmcValue()).toBe(1);
35
- });
36
-
37
- it('colors is always empty', () => {
38
- const sym = ColorlessPhyrexianManaSymbol.fromString('C/H');
39
- expect(sym.colors).toEqual([]);
40
- });
41
- });
42
-
43
- describe('inherited methods', () => {
44
- it('apply() pushes to array', () => {
45
- const arr = [];
46
- const sym = ColorlessPhyrexianManaSymbol.fromString('H');
47
- sym.apply(arr);
48
- expect(arr[0]).toBe(sym);
49
- });
50
-
51
- it('toString() outputs correctly', () => {
52
- const sym1 = ColorlessPhyrexianManaSymbol.fromString('H/C');
53
- expect(sym1.toString(false)).toBe('H/C');
54
- expect(sym1.toString(true)).toBe('{H/C}');
55
-
56
- const sym2 = ColorlessPhyrexianManaSymbol.fromString('H');
57
- expect(sym2.toString(false)).toBe('H');
58
- expect(sym2.toString(true)).toBe('{H}');
59
- });
60
- });
61
- });