-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathgenerateAbilities.spec.js
72 lines (66 loc) · 1.5 KB
/
generateAbilities.spec.js
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
68
69
70
71
72
const { generateAbilities } = require('generators')
test('Abilities with empty buttonname are ignored unless remapid is set', () => {
const abilities = [
{
id: 149,
name: 'HallucinationColossus',
buttonname: '',
index: 1,
},
{
id: 397,
remapid: 3796,
name: 'MedivacTransport',
buttonname: '',
friendlyname: 'UnloadUnit Medivac',
index: 3,
},
]
expect(generateAbilities(abilities)).toEqual([
{ id: 3674, index: undefined, name: 'ATTACK' },
{ id: 397, name: 'UNLOADUNIT_MEDIVAC', index: 3 },
])
})
test('Only unique items kept in the list', () => {
const abilities = [
{
id: 2839,
name: 'AdvancedConstruction',
buttonname: 'Cancel',
index: 0,
},
{
id: 2840,
name: 'AdvancedConstruction',
buttonname: 'Cancel',
index: 0,
},
{
id: 2841,
name: 'AdvancedConstruction',
buttonname: 'Cancel',
index: 1,
},
]
expect(generateAbilities(abilities)).toEqual([
{ id: 2839, name: 'ADVANCEDCONSTRUCTION_CANCEL', index: 0 },
{ id: 3674, index: undefined, name: 'ATTACK' },
])
})
test('Ignores dummies', () => {
const abilities = [
{
id: 4632,
name: 'DummyAbil201',
buttonname: '',
index: 1,
},
{
id: 3003,
name: 'SpiderMineUnburrowRangeDummy',
buttonname: '',
index: 0,
},
]
expect(generateAbilities(abilities)).toEqual([{ id: 3674, index: undefined, name: 'ATTACK' }])
})