coh-content-db 2.0.0-rc.6 → 2.0.0-rc.7
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/README.md +3 -3
- package/dist/coh-content-db.d.ts +384 -181
- package/dist/coh-content-db.js +604 -348
- package/dist/coh-content-db.js.map +1 -1
- package/dist/coh-content-db.mjs +592 -347
- package/dist/coh-content-db.mjs.map +1 -1
- package/eslint.config.mjs +1 -0
- package/package.json +1 -1
- package/src/main/api/alignment.ts +18 -2
- package/src/main/api/badge-data.ts +12 -42
- package/src/main/api/badge-requirement-data.ts +17 -35
- package/src/main/api/badge-requirement-type.ts +28 -7
- package/src/main/api/badge-type.ts +15 -15
- package/src/main/api/contact-data.ts +7 -5
- package/src/main/api/content-bundle.ts +6 -0
- package/src/main/api/enhancement-category.ts +26 -26
- package/src/main/api/location-data.ts +28 -0
- package/src/main/api/mission-data.ts +83 -0
- package/src/main/api/mission-type.ts +2 -0
- package/src/main/api/morality.ts +31 -0
- package/src/main/api/sex.ts +8 -1
- package/src/main/api/zone-data.ts +1 -1
- package/src/main/changelog.ts +5 -4
- package/src/main/db/alignment-list.ts +54 -0
- package/src/main/db/alternates.ts +15 -32
- package/src/main/db/badge-index.ts +11 -36
- package/src/main/db/badge-requirement.ts +22 -43
- package/src/main/db/badge-search-options.ts +4 -4
- package/src/main/db/badge.ts +53 -54
- package/src/main/db/coh-content-database.ts +28 -24
- package/src/main/db/contact.ts +17 -14
- package/src/main/db/location.ts +30 -0
- package/src/main/db/mission.ts +107 -0
- package/src/main/db/morality-list.ts +99 -0
- package/src/main/db/zone.ts +1 -1
- package/src/main/index.ts +8 -3
- package/src/main/util.ts +43 -3
- package/src/test/api/alignment.test.ts +38 -4
- package/src/test/api/badge-data.fixture.ts +1 -17
- package/src/test/api/badge-data.test.ts +3 -3
- package/src/test/api/badge-requirement-data.fixture.ts +1 -11
- package/src/test/api/badge-requirement-type.test.ts +3 -3
- package/src/test/api/badge-type.test.ts +5 -5
- package/src/test/api/contact-data.fixture.ts +0 -6
- package/src/test/api/content-bundle.fixture.ts +1 -17
- package/src/test/api/enhancement-category.test.ts +5 -5
- package/src/test/api/mission-data.fixture.ts +12 -0
- package/src/test/api/sex.test.ts +33 -1
- package/src/test/api/zone-data.fixture.ts +1 -1
- package/src/test/db/alignment-list.test.ts +200 -0
- package/src/test/db/alternates.test.ts +60 -56
- package/src/test/db/badge-index.test.ts +82 -72
- package/src/test/db/badge-requirement.test.ts +35 -70
- package/src/test/db/badge.test.ts +185 -64
- package/src/test/db/coh-content-database.test.ts +58 -69
- package/src/test/db/contact.test.ts +25 -24
- package/src/test/db/location.test.ts +51 -0
- package/src/test/db/mission.test.ts +171 -0
- package/src/test/db/morality-list.test.ts +457 -0
- package/src/test/db/zone.test.ts +4 -4
- package/src/test/util.test.ts +54 -1
- package/src/main/api/plaque-type.ts +0 -6
- package/src/main/db/alignments.ts +0 -17
- package/src/test/api/alignments.test.ts +0 -40
- package/src/test/api/plaque-type.test.ts +0 -31
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { Location } from '../../main'
|
|
2
|
+
|
|
3
|
+
describe(Location.name, () => {
|
|
4
|
+
describe('zoneKey', () => {
|
|
5
|
+
test(`should be set from the data`, () => {
|
|
6
|
+
const location = new Location({ zoneKey: 'foo' })
|
|
7
|
+
expect(location.zoneKey).toEqual('foo')
|
|
8
|
+
})
|
|
9
|
+
|
|
10
|
+
test(`should be optional`, () => {
|
|
11
|
+
const location = new Location({})
|
|
12
|
+
expect(location.zoneKey).toBeUndefined()
|
|
13
|
+
})
|
|
14
|
+
})
|
|
15
|
+
|
|
16
|
+
describe('coords', () => {
|
|
17
|
+
test(`should be set from the data`, () => {
|
|
18
|
+
const location = new Location({ coords: [1, 2, 3] })
|
|
19
|
+
expect(location.coords).toStrictEqual([1, 2, 3])
|
|
20
|
+
})
|
|
21
|
+
|
|
22
|
+
test(`should be optional`, () => {
|
|
23
|
+
const location = new Location({})
|
|
24
|
+
expect(location.coords).toBeUndefined()
|
|
25
|
+
})
|
|
26
|
+
})
|
|
27
|
+
|
|
28
|
+
describe('icon', () => {
|
|
29
|
+
test(`should be set from the data`, () => {
|
|
30
|
+
const location = new Location({ icon: 'plaque' })
|
|
31
|
+
expect(location.icon).toBe('plaque')
|
|
32
|
+
})
|
|
33
|
+
|
|
34
|
+
test(`should be optional`, () => {
|
|
35
|
+
const location = new Location({})
|
|
36
|
+
expect(location.icon).toBeUndefined()
|
|
37
|
+
})
|
|
38
|
+
})
|
|
39
|
+
|
|
40
|
+
describe('iconText', () => {
|
|
41
|
+
test(`should be set from the data`, () => {
|
|
42
|
+
const location = new Location({ iconText: '1' })
|
|
43
|
+
expect(location.iconText).toBe('1')
|
|
44
|
+
})
|
|
45
|
+
|
|
46
|
+
test(`should be optional`, () => {
|
|
47
|
+
const location = new Location({})
|
|
48
|
+
expect(location.iconText).toBeUndefined()
|
|
49
|
+
})
|
|
50
|
+
})
|
|
51
|
+
})
|
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
import { Mission } from '../../main'
|
|
2
|
+
import { missionDataFixture, missionFlashbackDataFixture } from '../api/mission-data.fixture'
|
|
3
|
+
|
|
4
|
+
describe(Mission.name, () => {
|
|
5
|
+
describe('Constructor', () => {
|
|
6
|
+
test(`should accept the test fixture`, () => {
|
|
7
|
+
new Mission(missionDataFixture.create())
|
|
8
|
+
})
|
|
9
|
+
})
|
|
10
|
+
|
|
11
|
+
describe('key', () => {
|
|
12
|
+
test(`should be set from the data`, () => {
|
|
13
|
+
const mission = new Mission(missionDataFixture.create({ key: 'foo' }))
|
|
14
|
+
expect(mission.key).toEqual('foo')
|
|
15
|
+
})
|
|
16
|
+
})
|
|
17
|
+
|
|
18
|
+
describe('name', () => {
|
|
19
|
+
test(`should be set from the data`, () => {
|
|
20
|
+
const mission = new Mission(missionDataFixture.create({ name: 'Foo' }))
|
|
21
|
+
expect(mission.name).toEqual('Foo')
|
|
22
|
+
})
|
|
23
|
+
})
|
|
24
|
+
|
|
25
|
+
describe('type', () => {
|
|
26
|
+
test(`should be set from the data`, () => {
|
|
27
|
+
const mission = new Mission(missionDataFixture.create({ type: 'story-arc' }))
|
|
28
|
+
expect(mission.type).toEqual('story-arc')
|
|
29
|
+
})
|
|
30
|
+
})
|
|
31
|
+
|
|
32
|
+
describe('morality', () => {
|
|
33
|
+
test(`should be set from the data`, () => {
|
|
34
|
+
const mission = new Mission(missionDataFixture.create({ morality: ['hero'] }))
|
|
35
|
+
expect(mission.morality?.hero).toBeTruthy()
|
|
36
|
+
expect(mission.morality?.vigilante).toBeFalsy()
|
|
37
|
+
})
|
|
38
|
+
|
|
39
|
+
test(`should be optional`, () => {
|
|
40
|
+
const mission = new Mission(missionDataFixture.omit('morality').create())
|
|
41
|
+
expect(mission.morality?.all).toBeTruthy()
|
|
42
|
+
})
|
|
43
|
+
})
|
|
44
|
+
|
|
45
|
+
describe('contactKeys', () => {
|
|
46
|
+
test(`should be set from the data`, () => {
|
|
47
|
+
const mission = new Mission(missionDataFixture.create({ contactKeys: 'foo' }))
|
|
48
|
+
expect(mission.contactKeys).toStrictEqual(['foo'])
|
|
49
|
+
})
|
|
50
|
+
|
|
51
|
+
test(`should be optional`, () => {
|
|
52
|
+
const mission = new Mission(missionDataFixture.omit('contactKeys').create())
|
|
53
|
+
expect(mission.contactKeys).toBeUndefined()
|
|
54
|
+
})
|
|
55
|
+
})
|
|
56
|
+
|
|
57
|
+
describe('levelRange', () => {
|
|
58
|
+
test(`should be set from the data`, () => {
|
|
59
|
+
const mission = new Mission(missionDataFixture.create({ levelRange: [1, 2] }))
|
|
60
|
+
expect(mission.levelRange).toStrictEqual([1, 2])
|
|
61
|
+
})
|
|
62
|
+
|
|
63
|
+
test(`should be optional`, () => {
|
|
64
|
+
const mission = new Mission(missionDataFixture.omit('levelRange').create())
|
|
65
|
+
expect(mission.levelRange).toBeUndefined()
|
|
66
|
+
})
|
|
67
|
+
})
|
|
68
|
+
|
|
69
|
+
describe('notes', () => {
|
|
70
|
+
test(`should be set from the data`, () => {
|
|
71
|
+
const mission = new Mission(missionDataFixture.create({ notes: 'foo' }))
|
|
72
|
+
expect(mission.notes).toBe('foo')
|
|
73
|
+
})
|
|
74
|
+
|
|
75
|
+
test(`should be optional`, () => {
|
|
76
|
+
const mission = new Mission(missionDataFixture.omit('notes').create())
|
|
77
|
+
expect(mission.notes).toBeUndefined()
|
|
78
|
+
})
|
|
79
|
+
})
|
|
80
|
+
|
|
81
|
+
describe('links', () => {
|
|
82
|
+
test('should be set from the data', () => {
|
|
83
|
+
const badge = new Mission(missionDataFixture.create({ links: [{ title: 'foo', href: 'bar' }] }))
|
|
84
|
+
expect(badge.links).toStrictEqual([{ title: 'foo', href: 'bar' }])
|
|
85
|
+
})
|
|
86
|
+
|
|
87
|
+
test('should be optional', () => {
|
|
88
|
+
const badge = new Mission(missionDataFixture.omit('links').create())
|
|
89
|
+
expect(badge.links).toHaveLength(0)
|
|
90
|
+
})
|
|
91
|
+
})
|
|
92
|
+
|
|
93
|
+
describe('flashback', () => {
|
|
94
|
+
test('should be undefined if omitted', () => {
|
|
95
|
+
const badge = new Mission(missionDataFixture.omit('flashback').create())
|
|
96
|
+
expect(badge.flashback).toBeFalsy()
|
|
97
|
+
})
|
|
98
|
+
|
|
99
|
+
describe('id', () => {
|
|
100
|
+
test(`should be set from the data`, () => {
|
|
101
|
+
const mission = new Mission(missionDataFixture.create({ flashback: { id: 'foo' } }))
|
|
102
|
+
expect(mission.flashback?.id).toBe('foo')
|
|
103
|
+
})
|
|
104
|
+
})
|
|
105
|
+
|
|
106
|
+
describe('levelRange', () => {
|
|
107
|
+
test(`should be set from the data`, () => {
|
|
108
|
+
const mission = new Mission(missionDataFixture.create({ flashback: { levelRange: [1, 2] } }))
|
|
109
|
+
expect(mission.flashback?.levelRange).toStrictEqual([1, 2])
|
|
110
|
+
})
|
|
111
|
+
|
|
112
|
+
test(`should default to the mission value`, () => {
|
|
113
|
+
const mission = new Mission(missionDataFixture.create({ levelRange: [1, 2], flashback: missionFlashbackDataFixture.omit('levelRange').create() }))
|
|
114
|
+
expect(mission.flashback?.levelRange).toStrictEqual([1, 2])
|
|
115
|
+
})
|
|
116
|
+
|
|
117
|
+
test(`should be optional`, () => {
|
|
118
|
+
const mission = new Mission(missionDataFixture.omit('levelRange').create({ flashback: missionFlashbackDataFixture.omit('levelRange').create() }))
|
|
119
|
+
expect(mission.flashback?.levelRange).toBeUndefined()
|
|
120
|
+
})
|
|
121
|
+
})
|
|
122
|
+
|
|
123
|
+
describe('name', () => {
|
|
124
|
+
test(`should be set from the data`, () => {
|
|
125
|
+
const mission = new Mission(missionDataFixture.create({ flashback: { name: 'Foo' } }))
|
|
126
|
+
expect(mission.flashback?.name).toStrictEqual('Foo')
|
|
127
|
+
})
|
|
128
|
+
|
|
129
|
+
test(`should default to the mission value`, () => {
|
|
130
|
+
const mission = new Mission(missionDataFixture.create({ name: 'Foo', flashback: missionFlashbackDataFixture.omit('name').create() }))
|
|
131
|
+
expect(mission.flashback?.name).toStrictEqual('Foo')
|
|
132
|
+
})
|
|
133
|
+
|
|
134
|
+
test(`should be optional`, () => {
|
|
135
|
+
const mission = new Mission(missionDataFixture.omit('name').create({ flashback: missionFlashbackDataFixture.omit('name').create() }))
|
|
136
|
+
expect(mission.flashback?.name).toBeUndefined()
|
|
137
|
+
})
|
|
138
|
+
})
|
|
139
|
+
|
|
140
|
+
describe('morality', () => {
|
|
141
|
+
test(`should be set from the data`, () => {
|
|
142
|
+
const mission = new Mission(missionDataFixture.create({ flashback: { morality: ['hero'] } }))
|
|
143
|
+
expect(mission.flashback?.morality?.hero).toBeTruthy()
|
|
144
|
+
expect(mission.flashback?.morality?.vigilante).toBeFalsy()
|
|
145
|
+
})
|
|
146
|
+
|
|
147
|
+
test(`should default to the mission value`, () => {
|
|
148
|
+
const mission = new Mission(missionDataFixture.create({ morality: ['hero'], flashback: missionFlashbackDataFixture.omit('morality').create() }))
|
|
149
|
+
expect(mission.flashback?.morality?.hero).toBeTruthy()
|
|
150
|
+
expect(mission.flashback?.morality?.vigilante).toBeFalsy()
|
|
151
|
+
})
|
|
152
|
+
|
|
153
|
+
test(`should be optional`, () => {
|
|
154
|
+
const mission = new Mission(missionDataFixture.omit('morality').create({ flashback: missionFlashbackDataFixture.omit('morality').create() }))
|
|
155
|
+
expect(mission.morality?.all).toBeTruthy()
|
|
156
|
+
})
|
|
157
|
+
})
|
|
158
|
+
|
|
159
|
+
describe('notes', () => {
|
|
160
|
+
test(`should be set from the data`, () => {
|
|
161
|
+
const mission = new Mission(missionDataFixture.create({ flashback: { notes: 'foo' } }))
|
|
162
|
+
expect(mission.flashback?.notes).toStrictEqual('foo')
|
|
163
|
+
})
|
|
164
|
+
|
|
165
|
+
test(`should be optional`, () => {
|
|
166
|
+
const mission = new Mission(missionDataFixture.create({ flashback: missionFlashbackDataFixture.omit('notes').create() }))
|
|
167
|
+
expect(mission.flashback?.notes).toBeUndefined()
|
|
168
|
+
})
|
|
169
|
+
})
|
|
170
|
+
})
|
|
171
|
+
})
|
|
@@ -0,0 +1,457 @@
|
|
|
1
|
+
import { MoralityList } from '../../main'
|
|
2
|
+
|
|
3
|
+
describe(MoralityList.name, () => {
|
|
4
|
+
describe('items', () => {
|
|
5
|
+
test('should return the basic set', () => {
|
|
6
|
+
expect(new MoralityList(['hero', 'villain', 'loyalist']).items).toStrictEqual(['hero', 'villain', 'loyalist'])
|
|
7
|
+
})
|
|
8
|
+
|
|
9
|
+
test('should collapse extended values', () => {
|
|
10
|
+
expect(new MoralityList(['primal']).items).toStrictEqual(['hero', 'vigilante', 'villain', 'rogue'])
|
|
11
|
+
expect(new MoralityList(['heroic']).items).toStrictEqual(['hero', 'vigilante'])
|
|
12
|
+
expect(new MoralityList(['heroic', 'praetorian']).items).toStrictEqual(['hero', 'vigilante', 'resistance', 'loyalist'])
|
|
13
|
+
})
|
|
14
|
+
|
|
15
|
+
test('should not duplicate overlaps', () => {
|
|
16
|
+
expect(new MoralityList(['primal', 'heroic', 'hero']).items).toStrictEqual(['hero', 'vigilante', 'villain', 'rogue'])
|
|
17
|
+
expect(new MoralityList(['all', 'heroic', 'hero']).items).toStrictEqual(['hero', 'vigilante', 'villain', 'rogue', 'resistance', 'loyalist'])
|
|
18
|
+
})
|
|
19
|
+
|
|
20
|
+
test('should have deterministic order', () => {
|
|
21
|
+
expect(new MoralityList(['hero', 'villain']).items).toStrictEqual(['hero', 'villain'])
|
|
22
|
+
expect(new MoralityList(['villain', 'hero']).items).toStrictEqual(['hero', 'villain'])
|
|
23
|
+
expect(new MoralityList(['primal', 'all', 'hero']).items).toStrictEqual(['hero', 'vigilante', 'villain', 'rogue', 'resistance', 'loyalist'])
|
|
24
|
+
expect(new MoralityList(['hero', 'primal', 'all']).items).toStrictEqual(['hero', 'vigilante', 'villain', 'rogue', 'resistance', 'loyalist'])
|
|
25
|
+
expect(new MoralityList(['all', 'hero', 'primal']).items).toStrictEqual(['hero', 'vigilante', 'villain', 'rogue', 'resistance', 'loyalist'])
|
|
26
|
+
})
|
|
27
|
+
|
|
28
|
+
test('should treat undefined as all values', () => {
|
|
29
|
+
expect(new MoralityList().items).toStrictEqual(['hero', 'vigilante', 'villain', 'rogue', 'resistance', 'loyalist'])
|
|
30
|
+
})
|
|
31
|
+
|
|
32
|
+
test('should treat empty as no values', () => {
|
|
33
|
+
expect(new MoralityList([]).items).toStrictEqual([])
|
|
34
|
+
})
|
|
35
|
+
})
|
|
36
|
+
|
|
37
|
+
describe('values', () => {
|
|
38
|
+
test('should all be true when undefined', () => {
|
|
39
|
+
const moralitys = new MoralityList()
|
|
40
|
+
expect(moralitys.hero).toBeTruthy()
|
|
41
|
+
expect(moralitys.vigilante).toBeTruthy()
|
|
42
|
+
expect(moralitys.villain).toBeTruthy()
|
|
43
|
+
expect(moralitys.rogue).toBeTruthy()
|
|
44
|
+
expect(moralitys.resistance).toBeTruthy()
|
|
45
|
+
expect(moralitys.loyalist).toBeTruthy()
|
|
46
|
+
expect(moralitys.primal).toBeTruthy()
|
|
47
|
+
expect(moralitys.praetorian).toBeTruthy()
|
|
48
|
+
expect(moralitys.heroic).toBeTruthy()
|
|
49
|
+
expect(moralitys.villainous).toBeTruthy()
|
|
50
|
+
expect(moralitys.paragonCityAccess).toBeTruthy()
|
|
51
|
+
expect(moralitys.rogueIslesAccess).toBeTruthy()
|
|
52
|
+
expect(moralitys.all).toBeTruthy()
|
|
53
|
+
})
|
|
54
|
+
|
|
55
|
+
test('should all be false when empty', () => {
|
|
56
|
+
const moralitys = new MoralityList([])
|
|
57
|
+
expect(moralitys.hero).toBeFalsy()
|
|
58
|
+
expect(moralitys.vigilante).toBeFalsy()
|
|
59
|
+
expect(moralitys.villain).toBeFalsy()
|
|
60
|
+
expect(moralitys.rogue).toBeFalsy()
|
|
61
|
+
expect(moralitys.resistance).toBeFalsy()
|
|
62
|
+
expect(moralitys.loyalist).toBeFalsy()
|
|
63
|
+
expect(moralitys.primal).toBeFalsy()
|
|
64
|
+
expect(moralitys.praetorian).toBeFalsy()
|
|
65
|
+
expect(moralitys.heroic).toBeFalsy()
|
|
66
|
+
expect(moralitys.villainous).toBeFalsy()
|
|
67
|
+
expect(moralitys.paragonCityAccess).toBeFalsy()
|
|
68
|
+
expect(moralitys.rogueIslesAccess).toBeFalsy()
|
|
69
|
+
expect(moralitys.all).toBeFalsy()
|
|
70
|
+
})
|
|
71
|
+
})
|
|
72
|
+
|
|
73
|
+
describe('hero', () => {
|
|
74
|
+
test('should detect a hero', () => {
|
|
75
|
+
expect(new MoralityList(['hero', 'villain']).hero).toBeTruthy()
|
|
76
|
+
})
|
|
77
|
+
|
|
78
|
+
test('should detect primal', () => {
|
|
79
|
+
expect(new MoralityList(['primal']).hero).toBeTruthy()
|
|
80
|
+
})
|
|
81
|
+
|
|
82
|
+
test('should detect heroic', () => {
|
|
83
|
+
expect(new MoralityList(['heroic']).hero).toBeTruthy()
|
|
84
|
+
})
|
|
85
|
+
|
|
86
|
+
test('should detect paragon-city-access', () => {
|
|
87
|
+
expect(new MoralityList(['paragon-city-access']).hero).toBeTruthy()
|
|
88
|
+
})
|
|
89
|
+
|
|
90
|
+
test('should detect all', () => {
|
|
91
|
+
expect(new MoralityList(['all']).hero).toBeTruthy()
|
|
92
|
+
})
|
|
93
|
+
|
|
94
|
+
test('should not falsely detect a hero', () => {
|
|
95
|
+
expect(new MoralityList(['villain']).hero).toBeFalsy()
|
|
96
|
+
})
|
|
97
|
+
})
|
|
98
|
+
|
|
99
|
+
describe('vigilante', () => {
|
|
100
|
+
test('should detect a vigilante', () => {
|
|
101
|
+
expect(new MoralityList(['vigilante', 'villain']).vigilante).toBeTruthy()
|
|
102
|
+
})
|
|
103
|
+
|
|
104
|
+
test('should detect primal', () => {
|
|
105
|
+
expect(new MoralityList(['primal']).vigilante).toBeTruthy()
|
|
106
|
+
})
|
|
107
|
+
|
|
108
|
+
test('should detect heroic', () => {
|
|
109
|
+
expect(new MoralityList(['heroic']).vigilante).toBeTruthy()
|
|
110
|
+
})
|
|
111
|
+
|
|
112
|
+
test('should detect paragon-city-access', () => {
|
|
113
|
+
expect(new MoralityList(['paragon-city-access']).vigilante).toBeTruthy()
|
|
114
|
+
})
|
|
115
|
+
|
|
116
|
+
test('should detect rogue-isles-access', () => {
|
|
117
|
+
expect(new MoralityList(['rogue-isles-access']).vigilante).toBeTruthy()
|
|
118
|
+
})
|
|
119
|
+
|
|
120
|
+
test('should detect all', () => {
|
|
121
|
+
expect(new MoralityList(['all']).vigilante).toBeTruthy()
|
|
122
|
+
})
|
|
123
|
+
|
|
124
|
+
test('should not falsely detect a vigilante', () => {
|
|
125
|
+
expect(new MoralityList(['villain']).vigilante).toBeFalsy()
|
|
126
|
+
})
|
|
127
|
+
})
|
|
128
|
+
|
|
129
|
+
describe('villain', () => {
|
|
130
|
+
test('should detect a villain', () => {
|
|
131
|
+
expect(new MoralityList(['hero', 'villain']).villain).toBeTruthy()
|
|
132
|
+
})
|
|
133
|
+
|
|
134
|
+
test('should detect primal', () => {
|
|
135
|
+
expect(new MoralityList(['primal']).villain).toBeTruthy()
|
|
136
|
+
})
|
|
137
|
+
|
|
138
|
+
test('should detect villainous', () => {
|
|
139
|
+
expect(new MoralityList(['villainous']).villain).toBeTruthy()
|
|
140
|
+
})
|
|
141
|
+
|
|
142
|
+
test('should detect rogue-isles-access', () => {
|
|
143
|
+
expect(new MoralityList(['rogue-isles-access']).villain).toBeTruthy()
|
|
144
|
+
})
|
|
145
|
+
|
|
146
|
+
test('should detect all', () => {
|
|
147
|
+
expect(new MoralityList(['all']).villain).toBeTruthy()
|
|
148
|
+
})
|
|
149
|
+
|
|
150
|
+
test('should not falsely detect a villain', () => {
|
|
151
|
+
expect(new MoralityList(['hero']).villain).toBeFalsy()
|
|
152
|
+
})
|
|
153
|
+
})
|
|
154
|
+
|
|
155
|
+
describe('rogue', () => {
|
|
156
|
+
test('should detect a rogue', () => {
|
|
157
|
+
expect(new MoralityList(['hero', 'rogue']).rogue).toBeTruthy()
|
|
158
|
+
})
|
|
159
|
+
|
|
160
|
+
test('should detect primal', () => {
|
|
161
|
+
expect(new MoralityList(['primal']).rogue).toBeTruthy()
|
|
162
|
+
})
|
|
163
|
+
|
|
164
|
+
test('should detect villainous', () => {
|
|
165
|
+
expect(new MoralityList(['villainous']).rogue).toBeTruthy()
|
|
166
|
+
})
|
|
167
|
+
|
|
168
|
+
test('should detect paragon-city-access', () => {
|
|
169
|
+
expect(new MoralityList(['paragon-city-access']).rogue).toBeTruthy()
|
|
170
|
+
})
|
|
171
|
+
|
|
172
|
+
test('should detect rogue-isles-access', () => {
|
|
173
|
+
expect(new MoralityList(['rogue-isles-access']).rogue).toBeTruthy()
|
|
174
|
+
})
|
|
175
|
+
|
|
176
|
+
test('should detect all', () => {
|
|
177
|
+
expect(new MoralityList(['all']).rogue).toBeTruthy()
|
|
178
|
+
})
|
|
179
|
+
|
|
180
|
+
test('should not falsely detect a rogue', () => {
|
|
181
|
+
expect(new MoralityList(['hero']).rogue).toBeFalsy()
|
|
182
|
+
})
|
|
183
|
+
})
|
|
184
|
+
|
|
185
|
+
describe('primal', () => {
|
|
186
|
+
test('should detect hero, vigilante, villain and rogue', () => {
|
|
187
|
+
expect(new MoralityList(['hero', 'vigilante', 'villain', 'rogue']).primal).toBeTruthy()
|
|
188
|
+
})
|
|
189
|
+
|
|
190
|
+
test('should detect primal', () => {
|
|
191
|
+
expect(new MoralityList(['primal']).primal).toBeTruthy()
|
|
192
|
+
})
|
|
193
|
+
|
|
194
|
+
test('should detect all', () => {
|
|
195
|
+
expect(new MoralityList(['all']).primal).toBeTruthy()
|
|
196
|
+
})
|
|
197
|
+
|
|
198
|
+
test('should not falsely detect a primal', () => {
|
|
199
|
+
expect(new MoralityList(['villain']).primal).toBeFalsy()
|
|
200
|
+
expect(new MoralityList(['praetorian']).primal).toBeFalsy()
|
|
201
|
+
expect(new MoralityList(['hero', 'villain']).primal).toBeFalsy()
|
|
202
|
+
})
|
|
203
|
+
})
|
|
204
|
+
|
|
205
|
+
describe('praetorian', () => {
|
|
206
|
+
test('should detect resistance and loyalist', () => {
|
|
207
|
+
expect(new MoralityList(['resistance', 'loyalist']).praetorian).toBeTruthy()
|
|
208
|
+
})
|
|
209
|
+
|
|
210
|
+
test('should detect praetorian', () => {
|
|
211
|
+
expect(new MoralityList(['praetorian']).praetorian).toBeTruthy()
|
|
212
|
+
})
|
|
213
|
+
|
|
214
|
+
test('should detect all', () => {
|
|
215
|
+
expect(new MoralityList(['all']).praetorian).toBeTruthy()
|
|
216
|
+
})
|
|
217
|
+
|
|
218
|
+
test('should not falsely detect a praetorian', () => {
|
|
219
|
+
expect(new MoralityList(['villain']).praetorian).toBeFalsy()
|
|
220
|
+
expect(new MoralityList(['primal']).praetorian).toBeFalsy()
|
|
221
|
+
expect(new MoralityList(['hero', 'villain']).praetorian).toBeFalsy()
|
|
222
|
+
})
|
|
223
|
+
})
|
|
224
|
+
|
|
225
|
+
describe('heroic', () => {
|
|
226
|
+
test('should detect hero and vigilante', () => {
|
|
227
|
+
expect(new MoralityList(['hero', 'vigilante']).heroic).toBeTruthy()
|
|
228
|
+
})
|
|
229
|
+
|
|
230
|
+
test('should detect heroic', () => {
|
|
231
|
+
expect(new MoralityList(['heroic']).heroic).toBeTruthy()
|
|
232
|
+
})
|
|
233
|
+
|
|
234
|
+
test('should detect paragon-city-access', () => {
|
|
235
|
+
expect(new MoralityList(['paragon-city-access']).heroic).toBeTruthy()
|
|
236
|
+
})
|
|
237
|
+
|
|
238
|
+
test('should detect all', () => {
|
|
239
|
+
expect(new MoralityList(['all']).heroic).toBeTruthy()
|
|
240
|
+
})
|
|
241
|
+
|
|
242
|
+
test('should not falsely detect heroic', () => {
|
|
243
|
+
expect(new MoralityList(['villain']).heroic).toBeFalsy()
|
|
244
|
+
expect(new MoralityList(['praetorian']).heroic).toBeFalsy()
|
|
245
|
+
expect(new MoralityList(['villain', 'rogue']).heroic).toBeFalsy()
|
|
246
|
+
})
|
|
247
|
+
})
|
|
248
|
+
|
|
249
|
+
describe('villainous', () => {
|
|
250
|
+
test('should detect villain and rogue', () => {
|
|
251
|
+
expect(new MoralityList(['villain', 'rogue']).villainous).toBeTruthy()
|
|
252
|
+
})
|
|
253
|
+
|
|
254
|
+
test('should detect villainous', () => {
|
|
255
|
+
expect(new MoralityList(['villainous']).villainous).toBeTruthy()
|
|
256
|
+
})
|
|
257
|
+
|
|
258
|
+
test('should detect rogue-isles-access', () => {
|
|
259
|
+
expect(new MoralityList(['rogue-isles-access']).villainous).toBeTruthy()
|
|
260
|
+
})
|
|
261
|
+
|
|
262
|
+
test('should detect all', () => {
|
|
263
|
+
expect(new MoralityList(['all']).villainous).toBeTruthy()
|
|
264
|
+
})
|
|
265
|
+
|
|
266
|
+
test('should not falsely detect villainous', () => {
|
|
267
|
+
expect(new MoralityList(['villain']).villainous).toBeFalsy()
|
|
268
|
+
expect(new MoralityList(['praetorian']).villainous).toBeFalsy()
|
|
269
|
+
expect(new MoralityList(['hero', 'vigilante']).villainous).toBeFalsy()
|
|
270
|
+
})
|
|
271
|
+
})
|
|
272
|
+
|
|
273
|
+
describe('paragonCityAccess', () => {
|
|
274
|
+
test('should detect hero, vigilante and rogue', () => {
|
|
275
|
+
expect(new MoralityList(['hero', 'vigilante', 'rogue']).paragonCityAccess).toBeTruthy()
|
|
276
|
+
})
|
|
277
|
+
|
|
278
|
+
test('should detect paragon-city-access', () => {
|
|
279
|
+
expect(new MoralityList(['paragon-city-access']).paragonCityAccess).toBeTruthy()
|
|
280
|
+
})
|
|
281
|
+
|
|
282
|
+
test('should detect all', () => {
|
|
283
|
+
expect(new MoralityList(['all']).paragonCityAccess).toBeTruthy()
|
|
284
|
+
})
|
|
285
|
+
|
|
286
|
+
test('should not falsely detect paragonCityAccess', () => {
|
|
287
|
+
expect(new MoralityList(['villain']).paragonCityAccess).toBeFalsy()
|
|
288
|
+
expect(new MoralityList(['praetorian']).paragonCityAccess).toBeFalsy()
|
|
289
|
+
expect(new MoralityList(['hero', 'vigilante']).paragonCityAccess).toBeFalsy()
|
|
290
|
+
})
|
|
291
|
+
})
|
|
292
|
+
|
|
293
|
+
describe('rogueIslesAccess', () => {
|
|
294
|
+
test('should detect villain, rogue and vigilante', () => {
|
|
295
|
+
expect(new MoralityList(['villain', 'rogue', 'vigilante']).rogueIslesAccess).toBeTruthy()
|
|
296
|
+
})
|
|
297
|
+
|
|
298
|
+
test('should detect rogue-isles-access', () => {
|
|
299
|
+
expect(new MoralityList(['rogue-isles-access']).rogueIslesAccess).toBeTruthy()
|
|
300
|
+
})
|
|
301
|
+
|
|
302
|
+
test('should detect all', () => {
|
|
303
|
+
expect(new MoralityList(['all']).rogueIslesAccess).toBeTruthy()
|
|
304
|
+
})
|
|
305
|
+
|
|
306
|
+
test('should not falsely detect rogueIslesAccess', () => {
|
|
307
|
+
expect(new MoralityList(['villain']).rogueIslesAccess).toBeFalsy()
|
|
308
|
+
expect(new MoralityList(['praetorian']).rogueIslesAccess).toBeFalsy()
|
|
309
|
+
expect(new MoralityList(['hero', 'vigilante']).rogueIslesAccess).toBeFalsy()
|
|
310
|
+
})
|
|
311
|
+
})
|
|
312
|
+
|
|
313
|
+
describe('all', () => {
|
|
314
|
+
test('should detect when all are present', () => {
|
|
315
|
+
expect(new MoralityList(['hero', 'vigilante', 'villain', 'rogue', 'resistance', 'loyalist']).all).toBeTruthy()
|
|
316
|
+
expect(new MoralityList(['heroic', 'villainous', 'praetorian']).all).toBeTruthy()
|
|
317
|
+
expect(new MoralityList(['primal', 'praetorian']).all).toBeTruthy()
|
|
318
|
+
})
|
|
319
|
+
|
|
320
|
+
test('should detect all', () => {
|
|
321
|
+
expect(new MoralityList(['all']).all).toBeTruthy()
|
|
322
|
+
})
|
|
323
|
+
|
|
324
|
+
test('should not falsely detect all', () => {
|
|
325
|
+
expect(new MoralityList(['villain']).all).toBeFalsy()
|
|
326
|
+
expect(new MoralityList(['praetorian']).all).toBeFalsy()
|
|
327
|
+
expect(new MoralityList(['primal']).all).toBeFalsy()
|
|
328
|
+
})
|
|
329
|
+
})
|
|
330
|
+
|
|
331
|
+
describe('has', () => {
|
|
332
|
+
test('should return true if present', () => {
|
|
333
|
+
expect(new MoralityList(['villain']).has('villain')).toBeTruthy()
|
|
334
|
+
expect(new MoralityList(['hero', 'loyalist']).has('loyalist')).toBeTruthy()
|
|
335
|
+
})
|
|
336
|
+
|
|
337
|
+
test('should return false if absent', () => {
|
|
338
|
+
expect(new MoralityList(['hero']).has('villain')).toBeFalsy()
|
|
339
|
+
expect(new MoralityList(['heroic']).has('villain')).toBeFalsy()
|
|
340
|
+
expect(new MoralityList(['hero', 'praetorian']).has('primal')).toBeFalsy()
|
|
341
|
+
})
|
|
342
|
+
|
|
343
|
+
test('should return false if undefined', () => {
|
|
344
|
+
expect(new MoralityList(['hero']).has()).toBeFalsy()
|
|
345
|
+
})
|
|
346
|
+
|
|
347
|
+
test('should test hero correctly', () => {
|
|
348
|
+
expect(new MoralityList(['hero']).has('hero')).toBeTruthy()
|
|
349
|
+
expect(new MoralityList(['heroic']).has('hero')).toBeTruthy()
|
|
350
|
+
expect(new MoralityList(['primal']).has('hero')).toBeTruthy()
|
|
351
|
+
expect(new MoralityList(['all']).has('hero')).toBeTruthy()
|
|
352
|
+
|
|
353
|
+
expect(new MoralityList(['villain']).has('hero')).toBeFalsy()
|
|
354
|
+
})
|
|
355
|
+
|
|
356
|
+
test('should test vigilante correctly', () => {
|
|
357
|
+
expect(new MoralityList(['hero', 'vigilante']).has('vigilante')).toBeTruthy()
|
|
358
|
+
expect(new MoralityList(['heroic']).has('vigilante')).toBeTruthy()
|
|
359
|
+
expect(new MoralityList(['primal']).has('vigilante')).toBeTruthy()
|
|
360
|
+
expect(new MoralityList(['all']).has('vigilante')).toBeTruthy()
|
|
361
|
+
|
|
362
|
+
expect(new MoralityList(['villain']).has('vigilante')).toBeFalsy()
|
|
363
|
+
})
|
|
364
|
+
|
|
365
|
+
test('should test villain correctly', () => {
|
|
366
|
+
expect(new MoralityList(['villain']).has('villain')).toBeTruthy()
|
|
367
|
+
expect(new MoralityList(['villainous']).has('villain')).toBeTruthy()
|
|
368
|
+
expect(new MoralityList(['primal']).has('villain')).toBeTruthy()
|
|
369
|
+
expect(new MoralityList(['all']).has('villain')).toBeTruthy()
|
|
370
|
+
|
|
371
|
+
expect(new MoralityList(['hero']).has('villain')).toBeFalsy()
|
|
372
|
+
})
|
|
373
|
+
|
|
374
|
+
test('should test rogue correctly', () => {
|
|
375
|
+
expect(new MoralityList(['rogue']).has('rogue')).toBeTruthy()
|
|
376
|
+
expect(new MoralityList(['villainous']).has('rogue')).toBeTruthy()
|
|
377
|
+
expect(new MoralityList(['primal']).has('rogue')).toBeTruthy()
|
|
378
|
+
expect(new MoralityList(['all']).has('rogue')).toBeTruthy()
|
|
379
|
+
|
|
380
|
+
expect(new MoralityList(['hero']).has('rogue')).toBeFalsy()
|
|
381
|
+
})
|
|
382
|
+
|
|
383
|
+
test('should test resistance correctly', () => {
|
|
384
|
+
expect(new MoralityList(['resistance']).has('resistance')).toBeTruthy()
|
|
385
|
+
expect(new MoralityList(['praetorian']).has('resistance')).toBeTruthy()
|
|
386
|
+
expect(new MoralityList(['all']).has('resistance')).toBeTruthy()
|
|
387
|
+
|
|
388
|
+
expect(new MoralityList(['villain']).has('resistance')).toBeFalsy()
|
|
389
|
+
})
|
|
390
|
+
|
|
391
|
+
test('should test loyalist correctly', () => {
|
|
392
|
+
expect(new MoralityList(['loyalist']).has('loyalist')).toBeTruthy()
|
|
393
|
+
expect(new MoralityList(['praetorian']).has('loyalist')).toBeTruthy()
|
|
394
|
+
expect(new MoralityList(['all']).has('loyalist')).toBeTruthy()
|
|
395
|
+
|
|
396
|
+
expect(new MoralityList(['villain']).has('loyalist')).toBeFalsy()
|
|
397
|
+
})
|
|
398
|
+
|
|
399
|
+
test('should test primal correctly', () => {
|
|
400
|
+
expect(new MoralityList(['hero', 'vigilante', 'villain', 'rogue']).has('primal')).toBeTruthy()
|
|
401
|
+
expect(new MoralityList(['heroic', 'villainous']).has('primal')).toBeTruthy()
|
|
402
|
+
expect(new MoralityList(['primal']).has('primal')).toBeTruthy()
|
|
403
|
+
expect(new MoralityList(['all']).has('primal')).toBeTruthy()
|
|
404
|
+
|
|
405
|
+
expect(new MoralityList(['villain']).has('primal')).toBeFalsy()
|
|
406
|
+
})
|
|
407
|
+
|
|
408
|
+
test('should test praetorian correctly', () => {
|
|
409
|
+
expect(new MoralityList(['resistance', 'loyalist']).has('praetorian')).toBeTruthy()
|
|
410
|
+
expect(new MoralityList(['praetorian']).has('praetorian')).toBeTruthy()
|
|
411
|
+
expect(new MoralityList(['all']).has('praetorian')).toBeTruthy()
|
|
412
|
+
|
|
413
|
+
expect(new MoralityList(['villain']).has('praetorian')).toBeFalsy()
|
|
414
|
+
})
|
|
415
|
+
|
|
416
|
+
test('should test heroic correctly', () => {
|
|
417
|
+
expect(new MoralityList(['hero', 'vigilante']).has('heroic')).toBeTruthy()
|
|
418
|
+
expect(new MoralityList(['heroic']).has('heroic')).toBeTruthy()
|
|
419
|
+
expect(new MoralityList(['all']).has('heroic')).toBeTruthy()
|
|
420
|
+
|
|
421
|
+
expect(new MoralityList(['villain']).has('heroic')).toBeFalsy()
|
|
422
|
+
})
|
|
423
|
+
|
|
424
|
+
test('should test villainous correctly', () => {
|
|
425
|
+
expect(new MoralityList(['villain', 'rogue']).has('villainous')).toBeTruthy()
|
|
426
|
+
expect(new MoralityList(['villainous']).has('villainous')).toBeTruthy()
|
|
427
|
+
expect(new MoralityList(['all']).has('villainous')).toBeTruthy()
|
|
428
|
+
|
|
429
|
+
expect(new MoralityList(['villain']).has('villainous')).toBeFalsy()
|
|
430
|
+
})
|
|
431
|
+
|
|
432
|
+
test('should test paragon-city-access correctly', () => {
|
|
433
|
+
expect(new MoralityList(['hero', 'vigilante', 'rogue']).has('paragon-city-access')).toBeTruthy()
|
|
434
|
+
expect(new MoralityList(['heroic', 'rogue']).has('paragon-city-access')).toBeTruthy()
|
|
435
|
+
expect(new MoralityList(['all']).has('paragon-city-access')).toBeTruthy()
|
|
436
|
+
|
|
437
|
+
expect(new MoralityList(['villain']).has('paragon-city-access')).toBeFalsy()
|
|
438
|
+
})
|
|
439
|
+
|
|
440
|
+
test('should test rogue-isles-access correctly', () => {
|
|
441
|
+
expect(new MoralityList(['villain', 'rogue', 'vigilante']).has('rogue-isles-access')).toBeTruthy()
|
|
442
|
+
expect(new MoralityList(['villainous', 'vigilante']).has('rogue-isles-access')).toBeTruthy()
|
|
443
|
+
expect(new MoralityList(['all']).has('rogue-isles-access')).toBeTruthy()
|
|
444
|
+
|
|
445
|
+
expect(new MoralityList(['villain']).has('rogue-isles-access')).toBeFalsy()
|
|
446
|
+
})
|
|
447
|
+
|
|
448
|
+
test('should test all correctly', () => {
|
|
449
|
+
expect(new MoralityList(['hero', 'vigilante', 'villain', 'rogue', 'resistance', 'loyalist']).has('all')).toBeTruthy()
|
|
450
|
+
expect(new MoralityList(['primal', 'praetorian']).has('all')).toBeTruthy()
|
|
451
|
+
expect(new MoralityList(['heroic', 'villainous', 'praetorian']).has('all')).toBeTruthy()
|
|
452
|
+
expect(new MoralityList(['all']).has('all')).toBeTruthy()
|
|
453
|
+
|
|
454
|
+
expect(new MoralityList(['villain']).has('all')).toBeFalsy()
|
|
455
|
+
})
|
|
456
|
+
})
|
|
457
|
+
})
|