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
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Alignment, ALIGNMENT } from '../../main'
|
|
1
|
+
import { Alignment, ALIGNMENT, compareAlignment } from '../../main'
|
|
2
2
|
|
|
3
3
|
describe('ALIGNMENT', () => {
|
|
4
4
|
test('should be an array', () => {
|
|
@@ -16,7 +16,7 @@ describe('ALIGNMENT', () => {
|
|
|
16
16
|
})
|
|
17
17
|
|
|
18
18
|
test('should contain all known alignments', () => {
|
|
19
|
-
const expected = ['
|
|
19
|
+
const expected = ['hero', 'villain', 'praetorian']
|
|
20
20
|
for (const category of expected) {
|
|
21
21
|
expect(ALIGNMENT).toContain(category)
|
|
22
22
|
}
|
|
@@ -25,7 +25,41 @@ describe('ALIGNMENT', () => {
|
|
|
25
25
|
|
|
26
26
|
describe('Alignment', () => {
|
|
27
27
|
test('should be a usable type', () => {
|
|
28
|
-
const field: Alignment = '
|
|
29
|
-
expect(field).toBe('
|
|
28
|
+
const field: Alignment = 'hero'
|
|
29
|
+
expect(field).toBe('hero')
|
|
30
|
+
})
|
|
31
|
+
})
|
|
32
|
+
|
|
33
|
+
describe('compareAlignment', () => {
|
|
34
|
+
test('should return <0 if first argument comes first', () => {
|
|
35
|
+
expect(compareAlignment('hero', 'villain')).toBeLessThan(0)
|
|
36
|
+
expect(compareAlignment('hero', 'praetorian')).toBeLessThan(0)
|
|
37
|
+
})
|
|
38
|
+
|
|
39
|
+
test('should return >0 if second argument comes first', () => {
|
|
40
|
+
expect(compareAlignment('villain', 'hero')).toBeGreaterThan(0)
|
|
41
|
+
expect(compareAlignment('praetorian', 'hero')).toBeGreaterThan(0)
|
|
42
|
+
})
|
|
43
|
+
|
|
44
|
+
test('should return 0 if arguments match', () => {
|
|
45
|
+
expect(compareAlignment('hero', 'hero')).toBe(0)
|
|
46
|
+
})
|
|
47
|
+
|
|
48
|
+
test('should return 0 if both arguments are undefined', () => {
|
|
49
|
+
expect(compareAlignment()).toBe(0)
|
|
50
|
+
})
|
|
51
|
+
|
|
52
|
+
test('should work as a compare function', () => {
|
|
53
|
+
const unsorted: (Alignment | undefined)[] = [undefined, 'hero', 'villain', 'praetorian', undefined, 'villain', 'praetorian']
|
|
54
|
+
const sorted = unsorted.sort(compareAlignment)
|
|
55
|
+
|
|
56
|
+
expect(sorted).toStrictEqual(['hero', 'villain', 'villain', 'praetorian', 'praetorian', undefined, undefined])
|
|
57
|
+
})
|
|
58
|
+
|
|
59
|
+
test('should sort against undefined', () => {
|
|
60
|
+
const unsorted: (Alignment | undefined)[] = [undefined, 'hero']
|
|
61
|
+
const sorted = unsorted.sort(compareAlignment)
|
|
62
|
+
|
|
63
|
+
expect(sorted).toStrictEqual(['hero', undefined])
|
|
30
64
|
})
|
|
31
65
|
})
|
|
@@ -1,24 +1,8 @@
|
|
|
1
1
|
import { defineFixture } from 'efate'
|
|
2
|
-
import {
|
|
3
|
-
import { badgeRequirementDataFixture } from './badge-requirement-data.fixture'
|
|
2
|
+
import { BADGE_TYPE, BadgeData } from '../../main'
|
|
4
3
|
|
|
5
4
|
export const badgeDataFixture = defineFixture<BadgeData>((t) => {
|
|
6
5
|
t.key.as(index => `badge-${index}`)
|
|
7
6
|
t.type.pickFrom([...BADGE_TYPE])
|
|
8
7
|
t.name.as(index => [{ value: `Badge ${index}` }])
|
|
9
|
-
t.alignment.pickFrom([...ALIGNMENT])
|
|
10
|
-
t.badgeText?.as(index => [{ value: `This is badge ${index}` }])
|
|
11
|
-
t.acquisition?.asLoremIpsum()
|
|
12
|
-
t.icon?.as(() => [{ value: 'https://nouri.org' }])
|
|
13
|
-
t.notes?.asLoremIpsum()
|
|
14
|
-
t.links?.as(() => [{ href: 'https://nouri.org' }])
|
|
15
|
-
t.zoneKey?.asString()
|
|
16
|
-
t.loc?.as(index => [index, index, index])
|
|
17
|
-
t.vidiotMapKey?.asString()
|
|
18
|
-
t.setTitle?.as((index) => {
|
|
19
|
-
return { id: index }
|
|
20
|
-
})
|
|
21
|
-
t.effect?.asString()
|
|
22
|
-
t.requirements?.as(() => [[badgeRequirementDataFixture]])
|
|
23
|
-
t.ignoreInTotals?.asBoolean()
|
|
24
8
|
})
|
|
@@ -3,9 +3,9 @@ import { BadgeData } from '../../main'
|
|
|
3
3
|
// If you change this test, update the example in the README as well
|
|
4
4
|
export const TEST_BADGE: BadgeData = {
|
|
5
5
|
key: 'test-badge',
|
|
6
|
-
type: '
|
|
7
|
-
name: [{ value: 'Test Badge' }, { alignment: '
|
|
8
|
-
|
|
6
|
+
type: 'achievement',
|
|
7
|
+
name: [{ value: 'Test Badge' }, { alignment: 'praetorian', value: 'My Badge for Praetorians' }],
|
|
8
|
+
morality: ['hero', 'praetorian'],
|
|
9
9
|
}
|
|
10
10
|
|
|
11
11
|
describe('BadgeData', () => {
|
|
@@ -1,17 +1,7 @@
|
|
|
1
1
|
import { defineFixture } from 'efate'
|
|
2
|
-
import { BADGE_REQUIREMENT_TYPE, BadgeRequirementData
|
|
2
|
+
import { BADGE_REQUIREMENT_TYPE, BadgeRequirementData } from '../../main'
|
|
3
3
|
|
|
4
4
|
export const badgeRequirementDataFixture = defineFixture<BadgeRequirementData>((t) => {
|
|
5
5
|
t.key.as(index => `badge-requirement-${index}`)
|
|
6
6
|
t.type.pickFrom([...BADGE_REQUIREMENT_TYPE])
|
|
7
|
-
t.zoneKey?.asString()
|
|
8
|
-
t.loc?.as(index => [index, index, index])
|
|
9
|
-
t.plaqueType?.pickFrom([...PLAQUE_TYPE])
|
|
10
|
-
t.plaqueInscription?.asLoremIpsum()
|
|
11
|
-
t.vidiotMapKey?.asString()
|
|
12
|
-
t.badgeKey?.as(index => `badge-${index}`)
|
|
13
|
-
t.inventionLevel?.asNumber()
|
|
14
|
-
t.inventionTypes?.pickFrom([...ENHANCEMENT_CATEGORY])
|
|
15
|
-
t.inventionCount?.asNumber()
|
|
16
|
-
t.notes?.asLoremIpsum()
|
|
17
7
|
})
|
|
@@ -16,7 +16,7 @@ describe('BADGE_REQUIREMENT_TYPE', () => {
|
|
|
16
16
|
})
|
|
17
17
|
|
|
18
18
|
test('should contain all known badge requirement types', () => {
|
|
19
|
-
const expected = ['
|
|
19
|
+
const expected = ['badge', 'invention', 'invention-plus-one', 'location', 'monument', 'mission', 'task']
|
|
20
20
|
for (const category of expected) {
|
|
21
21
|
expect(BADGE_REQUIREMENT_TYPE).toContain(category)
|
|
22
22
|
}
|
|
@@ -25,7 +25,7 @@ describe('BADGE_REQUIREMENT_TYPE', () => {
|
|
|
25
25
|
|
|
26
26
|
describe('BadgeRequirementType', () => {
|
|
27
27
|
test('should be a usable type', () => {
|
|
28
|
-
const field: BadgeRequirementType = '
|
|
29
|
-
expect(field).toBe('
|
|
28
|
+
const field: BadgeRequirementType = 'monument'
|
|
29
|
+
expect(field).toBe('monument')
|
|
30
30
|
})
|
|
31
31
|
})
|
|
@@ -17,9 +17,9 @@ describe('BADGE_TYPE', () => {
|
|
|
17
17
|
|
|
18
18
|
test('should contain all known basic badge types', () => {
|
|
19
19
|
const expected = [
|
|
20
|
-
'
|
|
21
|
-
'
|
|
22
|
-
'
|
|
20
|
+
'exploration', 'history', 'accomplishment', 'achievement', 'accolade',
|
|
21
|
+
'gladiator', 'veteran', 'pvp', 'invention', 'defeat',
|
|
22
|
+
'event', 'ouroboros', 'consignment', 'day-job', 'architect-entertainment',
|
|
23
23
|
]
|
|
24
24
|
for (const category of expected) {
|
|
25
25
|
expect(BADGE_TYPE).toContain(category)
|
|
@@ -29,7 +29,7 @@ describe('BADGE_TYPE', () => {
|
|
|
29
29
|
|
|
30
30
|
describe('BadgeType', () => {
|
|
31
31
|
test('should be a usable type', () => {
|
|
32
|
-
const field: BadgeType = '
|
|
33
|
-
expect(field).toBe('
|
|
32
|
+
const field: BadgeType = 'exploration'
|
|
33
|
+
expect(field).toBe('exploration')
|
|
34
34
|
})
|
|
35
35
|
})
|
|
@@ -4,10 +4,4 @@ import { ContactData } from '../../main'
|
|
|
4
4
|
export const contactDataFixture = defineFixture<ContactData>((t) => {
|
|
5
5
|
t.key.as(index => `contact-${index}`)
|
|
6
6
|
t.name.as(index => [{ value: `Contact ${index}` }])
|
|
7
|
-
t.title?.as(index => [{ value: `Contact title ${index}` }])
|
|
8
|
-
t.zoneKey?.asString()
|
|
9
|
-
t.loc?.as(index => [index, index, index])
|
|
10
|
-
t.levelRange?.as(index => [index, index])
|
|
11
|
-
t.notes?.asLoremIpsum()
|
|
12
|
-
t.links?.as(() => [{ href: 'https://nouri.org' }])
|
|
13
7
|
})
|
|
@@ -1,22 +1,6 @@
|
|
|
1
1
|
import { defineFixture } from 'efate'
|
|
2
|
-
import {
|
|
3
|
-
import { archetypeDataFixture } from './archetype-data.fixture'
|
|
4
|
-
import { zoneDataFixture } from './zone-data.fixture'
|
|
5
|
-
import { badgeDataFixture } from './badge-data.fixture'
|
|
2
|
+
import { ContentBundle } from '../../main'
|
|
6
3
|
|
|
7
4
|
export const contentBundleFixture = defineFixture<ContentBundle>((t) => {
|
|
8
5
|
t.name.as(index => `Bundle ${index}`)
|
|
9
|
-
t.description?.asLoremIpsum()
|
|
10
|
-
t.repository?.as(index => `https://nouri.org?id=${index}`)
|
|
11
|
-
t.servers?.asArray()
|
|
12
|
-
t.archetypes?.arrayOfFixture({ fixture: archetypeDataFixture })
|
|
13
|
-
t.zones?.arrayOfFixture({ fixture: zoneDataFixture })
|
|
14
|
-
t.badges?.arrayOfFixture({ fixture: badgeDataFixture })
|
|
15
|
-
t.changelog?.arrayOfFixture({
|
|
16
|
-
fixture: defineFixture<Change>((t) => {
|
|
17
|
-
t.version.as(index => `${index}`)
|
|
18
|
-
t.date.as(() => new Date())
|
|
19
|
-
t.description?.asLoremIpsum()
|
|
20
|
-
}),
|
|
21
|
-
})
|
|
22
6
|
})
|
|
@@ -17,9 +17,9 @@ describe('ENHANCEMENT_CATEGORY', () => {
|
|
|
17
17
|
|
|
18
18
|
test('should contain all known default enhancement categories', () => {
|
|
19
19
|
const expected = [
|
|
20
|
-
'
|
|
21
|
-
'
|
|
22
|
-
'
|
|
20
|
+
'defense-debuff', 'to-hit-debuff', 'taunt', 'confuse', 'healing', 'defense-buff', 'resist-damage', 'intangibility', 'sleep', 'slow', 'hold', 'stun', 'immobilize',
|
|
21
|
+
'fear', 'endurance-modification', 'endurance-reduction', 'recharge-reduction', 'interrupt-duration', 'accuracy', 'to-hit-buff', 'damage', 'knockback', 'run-speed',
|
|
22
|
+
'jump', 'fly-speed', 'range',
|
|
23
23
|
]
|
|
24
24
|
for (const category of expected) {
|
|
25
25
|
expect(ENHANCEMENT_CATEGORY).toContain(category)
|
|
@@ -29,7 +29,7 @@ describe('ENHANCEMENT_CATEGORY', () => {
|
|
|
29
29
|
|
|
30
30
|
describe('EnhancementCategory', () => {
|
|
31
31
|
test('should be a usable type', () => {
|
|
32
|
-
const field: EnhancementCategory = '
|
|
33
|
-
expect(field).toBe('
|
|
32
|
+
const field: EnhancementCategory = 'run-speed'
|
|
33
|
+
expect(field).toBe('run-speed')
|
|
34
34
|
})
|
|
35
35
|
})
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { defineFixture } from 'efate'
|
|
2
|
+
import { MISSION_TYPE, MissionData, MissionFlashbackData } from '../../main'
|
|
3
|
+
|
|
4
|
+
export const missionDataFixture = defineFixture<MissionData>((t) => {
|
|
5
|
+
t.key.as(index => `mission-${index}`)
|
|
6
|
+
t.name.as(index => `Mission ${index}`)
|
|
7
|
+
t.type.pickFrom([...MISSION_TYPE])
|
|
8
|
+
})
|
|
9
|
+
|
|
10
|
+
export const missionFlashbackDataFixture = defineFixture<MissionFlashbackData>((t) => {
|
|
11
|
+
t.id.as(index => `${index}.${index}`)
|
|
12
|
+
})
|
package/src/test/api/sex.test.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Sex, SEX } from '../../main'
|
|
1
|
+
import { compareSex, Sex, SEX } from '../../main'
|
|
2
2
|
|
|
3
3
|
describe('SEX', () => {
|
|
4
4
|
test('should be an array', () => {
|
|
@@ -29,3 +29,35 @@ describe('Sex', () => {
|
|
|
29
29
|
expect(field).toBe('M')
|
|
30
30
|
})
|
|
31
31
|
})
|
|
32
|
+
|
|
33
|
+
describe('compareSex', () => {
|
|
34
|
+
test('should return <0 if first argument comes first', () => {
|
|
35
|
+
expect(compareSex('M', 'F')).toBeLessThan(0)
|
|
36
|
+
})
|
|
37
|
+
|
|
38
|
+
test('should return >0 if second argument comes first', () => {
|
|
39
|
+
expect(compareSex('F', 'M')).toBeGreaterThan(0)
|
|
40
|
+
})
|
|
41
|
+
|
|
42
|
+
test('should return 0 if arguments match', () => {
|
|
43
|
+
expect(compareSex('F', 'F')).toBe(0)
|
|
44
|
+
})
|
|
45
|
+
|
|
46
|
+
test('should return 0 if both arguments are undefined', () => {
|
|
47
|
+
expect(compareSex()).toBe(0)
|
|
48
|
+
})
|
|
49
|
+
|
|
50
|
+
test('should work as a compare function', () => {
|
|
51
|
+
const unsorted: (Sex | undefined)[] = [undefined, 'M', 'F', 'M', undefined, 'F', 'M']
|
|
52
|
+
const sorted = unsorted.sort(compareSex)
|
|
53
|
+
|
|
54
|
+
expect(sorted).toStrictEqual(['M', 'M', 'M', 'F', 'F', undefined, undefined])
|
|
55
|
+
})
|
|
56
|
+
|
|
57
|
+
test('should sort against undefined', () => {
|
|
58
|
+
const unsorted: (Sex | undefined)[] = [undefined, 'M']
|
|
59
|
+
const sorted = unsorted.sort(compareSex)
|
|
60
|
+
|
|
61
|
+
expect(sorted).toStrictEqual(['M', undefined])
|
|
62
|
+
})
|
|
63
|
+
})
|
|
@@ -4,5 +4,5 @@ import { defineFixture } from 'efate'
|
|
|
4
4
|
export const zoneDataFixture = defineFixture<ZoneData>((t) => {
|
|
5
5
|
t.key.as(index => `zone-${index}`)
|
|
6
6
|
t.name.as(index => `Zone ${index}`)
|
|
7
|
-
t.links?.as(() => [{ href: 'https://nouri.org' }])
|
|
7
|
+
t.links?.as(() => [{ title: 'foo', href: 'https://nouri.org' }])
|
|
8
8
|
})
|
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
import { AlignmentList } from '../../main'
|
|
2
|
+
|
|
3
|
+
describe(AlignmentList.name, () => {
|
|
4
|
+
describe('items', () => {
|
|
5
|
+
test('should return the basic set', () => {
|
|
6
|
+
expect(new AlignmentList(['hero', 'villain']).items).toStrictEqual(['hero', 'villain'])
|
|
7
|
+
})
|
|
8
|
+
|
|
9
|
+
test('should collapse extended values', () => {
|
|
10
|
+
expect(new AlignmentList(['primal']).items).toStrictEqual(['hero', 'villain'])
|
|
11
|
+
})
|
|
12
|
+
|
|
13
|
+
test('should not duplicate overlaps', () => {
|
|
14
|
+
expect(new AlignmentList(['primal', 'all', 'hero']).items).toStrictEqual(['hero', 'villain', 'praetorian'])
|
|
15
|
+
})
|
|
16
|
+
|
|
17
|
+
test('should have deterministic order', () => {
|
|
18
|
+
expect(new AlignmentList(['hero', 'villain']).items).toStrictEqual(['hero', 'villain'])
|
|
19
|
+
expect(new AlignmentList(['villain', 'hero']).items).toStrictEqual(['hero', 'villain'])
|
|
20
|
+
expect(new AlignmentList(['primal', 'all', 'hero']).items).toStrictEqual(['hero', 'villain', 'praetorian'])
|
|
21
|
+
expect(new AlignmentList(['hero', 'primal', 'all']).items).toStrictEqual(['hero', 'villain', 'praetorian'])
|
|
22
|
+
expect(new AlignmentList(['all', 'hero', 'primal']).items).toStrictEqual(['hero', 'villain', 'praetorian'])
|
|
23
|
+
})
|
|
24
|
+
|
|
25
|
+
test('should treat undefined as all values', () => {
|
|
26
|
+
expect(new AlignmentList().items).toStrictEqual(['hero', 'villain', 'praetorian'])
|
|
27
|
+
})
|
|
28
|
+
|
|
29
|
+
test('should treat empty as no values', () => {
|
|
30
|
+
expect(new AlignmentList([]).items).toStrictEqual([])
|
|
31
|
+
})
|
|
32
|
+
})
|
|
33
|
+
|
|
34
|
+
describe('values', () => {
|
|
35
|
+
test('should all be true when undefined', () => {
|
|
36
|
+
const alignments = new AlignmentList()
|
|
37
|
+
expect(alignments.hero).toBeTruthy()
|
|
38
|
+
expect(alignments.villain).toBeTruthy()
|
|
39
|
+
expect(alignments.praetorian).toBeTruthy()
|
|
40
|
+
expect(alignments.primal).toBeTruthy()
|
|
41
|
+
expect(alignments.all).toBeTruthy()
|
|
42
|
+
})
|
|
43
|
+
|
|
44
|
+
test('should all be false when empty', () => {
|
|
45
|
+
const alignments = new AlignmentList([])
|
|
46
|
+
expect(alignments.hero).toBeFalsy()
|
|
47
|
+
expect(alignments.villain).toBeFalsy()
|
|
48
|
+
expect(alignments.praetorian).toBeFalsy()
|
|
49
|
+
expect(alignments.primal).toBeFalsy()
|
|
50
|
+
expect(alignments.all).toBeFalsy()
|
|
51
|
+
})
|
|
52
|
+
})
|
|
53
|
+
|
|
54
|
+
describe('hero', () => {
|
|
55
|
+
test('should detect a hero', () => {
|
|
56
|
+
expect(new AlignmentList(['hero', 'villain']).hero).toBeTruthy()
|
|
57
|
+
})
|
|
58
|
+
|
|
59
|
+
test('should detect primal', () => {
|
|
60
|
+
expect(new AlignmentList(['primal']).hero).toBeTruthy()
|
|
61
|
+
})
|
|
62
|
+
|
|
63
|
+
test('should detect all', () => {
|
|
64
|
+
expect(new AlignmentList(['all']).hero).toBeTruthy()
|
|
65
|
+
})
|
|
66
|
+
|
|
67
|
+
test('should not falsely detect a hero', () => {
|
|
68
|
+
expect(new AlignmentList(['villain']).hero).toBeFalsy()
|
|
69
|
+
})
|
|
70
|
+
})
|
|
71
|
+
|
|
72
|
+
describe('villain', () => {
|
|
73
|
+
test('should detect a villain', () => {
|
|
74
|
+
expect(new AlignmentList(['hero', 'villain']).villain).toBeTruthy()
|
|
75
|
+
})
|
|
76
|
+
|
|
77
|
+
test('should detect primal', () => {
|
|
78
|
+
expect(new AlignmentList(['primal']).villain).toBeTruthy()
|
|
79
|
+
})
|
|
80
|
+
|
|
81
|
+
test('should detect all', () => {
|
|
82
|
+
expect(new AlignmentList(['all']).villain).toBeTruthy()
|
|
83
|
+
})
|
|
84
|
+
|
|
85
|
+
test('should not falsely detect a villain', () => {
|
|
86
|
+
expect(new AlignmentList(['hero']).villain).toBeFalsy()
|
|
87
|
+
})
|
|
88
|
+
})
|
|
89
|
+
|
|
90
|
+
describe('praetorian', () => {
|
|
91
|
+
test('should detect a praetorian', () => {
|
|
92
|
+
expect(new AlignmentList(['hero', 'praetorian']).praetorian).toBeTruthy()
|
|
93
|
+
})
|
|
94
|
+
|
|
95
|
+
test('should not detect primal', () => {
|
|
96
|
+
expect(new AlignmentList(['primal']).praetorian).toBeFalsy()
|
|
97
|
+
})
|
|
98
|
+
|
|
99
|
+
test('should detect all', () => {
|
|
100
|
+
expect(new AlignmentList(['all']).praetorian).toBeTruthy()
|
|
101
|
+
})
|
|
102
|
+
|
|
103
|
+
test('should not falsely detect a praetorian', () => {
|
|
104
|
+
expect(new AlignmentList(['villain']).praetorian).toBeFalsy()
|
|
105
|
+
})
|
|
106
|
+
})
|
|
107
|
+
|
|
108
|
+
describe('primal', () => {
|
|
109
|
+
test('should detect hero and villain', () => {
|
|
110
|
+
expect(new AlignmentList(['hero', 'villain']).primal).toBeTruthy()
|
|
111
|
+
})
|
|
112
|
+
|
|
113
|
+
test('should detect primal', () => {
|
|
114
|
+
expect(new AlignmentList(['primal']).primal).toBeTruthy()
|
|
115
|
+
})
|
|
116
|
+
|
|
117
|
+
test('should detect all', () => {
|
|
118
|
+
expect(new AlignmentList(['all']).primal).toBeTruthy()
|
|
119
|
+
})
|
|
120
|
+
|
|
121
|
+
test('should not falsely detect a primal', () => {
|
|
122
|
+
expect(new AlignmentList(['villain']).primal).toBeFalsy()
|
|
123
|
+
expect(new AlignmentList(['praetorian']).primal).toBeFalsy()
|
|
124
|
+
})
|
|
125
|
+
})
|
|
126
|
+
|
|
127
|
+
describe('all', () => {
|
|
128
|
+
test('should detect when all are present', () => {
|
|
129
|
+
expect(new AlignmentList(['hero', 'villain', 'praetorian']).all).toBeTruthy()
|
|
130
|
+
})
|
|
131
|
+
|
|
132
|
+
test('should detect primal and praetorian', () => {
|
|
133
|
+
expect(new AlignmentList(['primal', 'praetorian']).all).toBeTruthy()
|
|
134
|
+
})
|
|
135
|
+
|
|
136
|
+
test('should detect all', () => {
|
|
137
|
+
expect(new AlignmentList(['all']).all).toBeTruthy()
|
|
138
|
+
})
|
|
139
|
+
|
|
140
|
+
test('should not falsely detect all', () => {
|
|
141
|
+
expect(new AlignmentList(['villain']).all).toBeFalsy()
|
|
142
|
+
expect(new AlignmentList(['praetorian']).all).toBeFalsy()
|
|
143
|
+
expect(new AlignmentList(['primal']).all).toBeFalsy()
|
|
144
|
+
})
|
|
145
|
+
})
|
|
146
|
+
|
|
147
|
+
describe('has', () => {
|
|
148
|
+
test('should return true if present', () => {
|
|
149
|
+
expect(new AlignmentList(['villain']).has('villain')).toBeTruthy()
|
|
150
|
+
})
|
|
151
|
+
|
|
152
|
+
test('should return false if absent', () => {
|
|
153
|
+
expect(new AlignmentList(['hero']).has('villain')).toBeFalsy()
|
|
154
|
+
expect(new AlignmentList(['hero', 'praetorian']).has('primal')).toBeFalsy()
|
|
155
|
+
})
|
|
156
|
+
|
|
157
|
+
test('should return false if undefined', () => {
|
|
158
|
+
expect(new AlignmentList(['hero']).has()).toBeFalsy()
|
|
159
|
+
})
|
|
160
|
+
|
|
161
|
+
test('should test hero correctly', () => {
|
|
162
|
+
expect(new AlignmentList(['hero']).has('hero')).toBeTruthy()
|
|
163
|
+
expect(new AlignmentList(['primal']).has('hero')).toBeTruthy()
|
|
164
|
+
expect(new AlignmentList(['all']).has('hero')).toBeTruthy()
|
|
165
|
+
|
|
166
|
+
expect(new AlignmentList(['villain']).has('hero')).toBeFalsy()
|
|
167
|
+
})
|
|
168
|
+
|
|
169
|
+
test('should test villain correctly', () => {
|
|
170
|
+
expect(new AlignmentList(['villain']).has('villain')).toBeTruthy()
|
|
171
|
+
expect(new AlignmentList(['primal']).has('villain')).toBeTruthy()
|
|
172
|
+
expect(new AlignmentList(['all']).has('villain')).toBeTruthy()
|
|
173
|
+
|
|
174
|
+
expect(new AlignmentList(['hero']).has('villain')).toBeFalsy()
|
|
175
|
+
})
|
|
176
|
+
|
|
177
|
+
test('should test praetorian correctly', () => {
|
|
178
|
+
expect(new AlignmentList(['praetorian']).has('praetorian')).toBeTruthy()
|
|
179
|
+
expect(new AlignmentList(['all']).has('praetorian')).toBeTruthy()
|
|
180
|
+
|
|
181
|
+
expect(new AlignmentList(['villain']).has('praetorian')).toBeFalsy()
|
|
182
|
+
})
|
|
183
|
+
|
|
184
|
+
test('should test primal correctly', () => {
|
|
185
|
+
expect(new AlignmentList(['hero', 'villain']).has('primal')).toBeTruthy()
|
|
186
|
+
expect(new AlignmentList(['primal']).has('primal')).toBeTruthy()
|
|
187
|
+
expect(new AlignmentList(['all']).has('primal')).toBeTruthy()
|
|
188
|
+
|
|
189
|
+
expect(new AlignmentList(['praetorian']).has('primal')).toBeFalsy()
|
|
190
|
+
})
|
|
191
|
+
|
|
192
|
+
test('should test all correctly', () => {
|
|
193
|
+
expect(new AlignmentList(['hero', 'villain', 'praetorian']).has('all')).toBeTruthy()
|
|
194
|
+
expect(new AlignmentList(['primal', 'praetorian']).has('all')).toBeTruthy()
|
|
195
|
+
expect(new AlignmentList(['all']).has('all')).toBeTruthy()
|
|
196
|
+
|
|
197
|
+
expect(new AlignmentList([]).has('all')).toBeFalsy()
|
|
198
|
+
})
|
|
199
|
+
})
|
|
200
|
+
})
|