coh-content-db 2.0.0-rc.15 → 2.0.0-rc.17
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/.github/workflows/build.yml +1 -1
- package/CHANGELOG.md +3 -1
- package/README.md +9 -1
- package/dist/coh-content-db.d.ts +93 -44
- package/dist/coh-content-db.js +230 -121
- package/dist/coh-content-db.js.map +1 -1
- package/dist/coh-content-db.mjs +228 -121
- package/dist/coh-content-db.mjs.map +1 -1
- package/jest.config.mjs +1 -0
- package/package.json +14 -14
- package/src/main/api/badge-data.ts +2 -1
- package/src/main/api/contact-data.ts +2 -1
- package/src/main/api/level-range-data.ts +4 -0
- package/src/main/api/mission-data.ts +3 -29
- package/src/main/api/mission-flashback-data.ts +31 -0
- package/src/main/api/set-title-data.ts +4 -0
- package/src/main/api/zone-data.ts +24 -0
- package/src/main/api/zone-type.ts +59 -0
- package/src/main/db/alternates.ts +1 -1
- package/src/main/db/badge-index.ts +10 -8
- package/src/main/db/badge-requirement.ts +1 -1
- package/src/main/db/badge.ts +5 -4
- package/src/main/db/bundle-header.ts +1 -1
- package/src/main/db/contact.ts +5 -4
- package/src/main/db/level-range.ts +15 -0
- package/src/main/db/mission.ts +9 -8
- package/src/main/db/set-title-ids.ts +10 -0
- package/src/main/db/zone.ts +29 -0
- package/src/main/index.ts +8 -2
- package/src/main/util/coalesce-to-array.ts +13 -0
- package/src/main/{util.ts → util/links.ts} +8 -22
- package/src/test/api/alignment.test.ts +2 -2
- package/src/test/api/sex.test.ts +2 -2
- package/src/test/api/zone-data.fixture.ts +1 -0
- package/src/test/db/badge.test.ts +24 -11
- package/src/test/db/contact.test.ts +2 -1
- package/src/test/db/level-range.test.ts +47 -0
- package/src/test/db/mission.test.ts +8 -6
- package/src/test/db/morality-list.test.ts +1 -1
- package/src/test/db/set-title-ids.test.ts +19 -0
- package/src/test/db/zone.test.ts +45 -0
- package/src/test/util/coalese-to-array.test.ts +17 -0
- package/src/test/{util.test.ts → util/links.test.ts} +5 -21
- package/src/test/{to-date.test.ts → util/to-date.test.ts} +1 -1
- /package/src/main/{to-date.ts → util/to-date.ts} +0 -0
package/src/test/db/zone.test.ts
CHANGED
|
@@ -22,6 +22,51 @@ describe(Zone.name, () => {
|
|
|
22
22
|
})
|
|
23
23
|
})
|
|
24
24
|
|
|
25
|
+
describe('type', () => {
|
|
26
|
+
test(`should be set from the data`, () => {
|
|
27
|
+
const zone = new Zone(zoneDataFixture.create({ type: 'city' }))
|
|
28
|
+
expect(zone.type).toEqual('city')
|
|
29
|
+
})
|
|
30
|
+
})
|
|
31
|
+
|
|
32
|
+
describe('morality', () => {
|
|
33
|
+
test(`should be set from the data`, () => {
|
|
34
|
+
const zone = new Zone(zoneDataFixture.create({ morality: ['hero'] }))
|
|
35
|
+
expect(zone.morality?.hero).toBeTruthy()
|
|
36
|
+
expect(zone.morality?.vigilante).toBeFalsy()
|
|
37
|
+
})
|
|
38
|
+
|
|
39
|
+
test(`should be optional`, () => {
|
|
40
|
+
const zone = new Zone(zoneDataFixture.omit('morality').create())
|
|
41
|
+
expect(zone.morality?.all).toBeTruthy()
|
|
42
|
+
})
|
|
43
|
+
})
|
|
44
|
+
|
|
45
|
+
describe('levelRange', () => {
|
|
46
|
+
test(`should be set from the data`, () => {
|
|
47
|
+
const zone = new Zone(zoneDataFixture.create({ levelRange: [10] }))
|
|
48
|
+
expect(zone.levelRange?.min).toEqual(10)
|
|
49
|
+
expect(zone.levelRange?.max).toBeUndefined()
|
|
50
|
+
})
|
|
51
|
+
|
|
52
|
+
test(`should be optional`, () => {
|
|
53
|
+
const zone = new Zone(zoneDataFixture.omit('levelRange').create())
|
|
54
|
+
expect(zone.levelRange).toBeUndefined()
|
|
55
|
+
})
|
|
56
|
+
})
|
|
57
|
+
|
|
58
|
+
describe('notes', () => {
|
|
59
|
+
test(`should be set from the data`, () => {
|
|
60
|
+
const zone = new Zone(zoneDataFixture.create({ notes: 'foo' }))
|
|
61
|
+
expect(zone.notes).toEqual('foo')
|
|
62
|
+
})
|
|
63
|
+
|
|
64
|
+
test(`should be optional`, () => {
|
|
65
|
+
const zone = new Zone(zoneDataFixture.omit('notes').create())
|
|
66
|
+
expect(zone.notes).toBeUndefined()
|
|
67
|
+
})
|
|
68
|
+
})
|
|
69
|
+
|
|
25
70
|
describe('links', () => {
|
|
26
71
|
test(`should be set from the data`, () => {
|
|
27
72
|
const zone = new Zone(zoneDataFixture.create({ links: [{ title: 'foo', href: 'bar' }] }))
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { coalesceToArray } from '../../main/util/coalesce-to-array'
|
|
2
|
+
|
|
3
|
+
describe(coalesceToArray.name, () => {
|
|
4
|
+
test('should return an array unmodified', () => {
|
|
5
|
+
expect(coalesceToArray(['a', 'b'])).toStrictEqual(['a', 'b'])
|
|
6
|
+
expect(coalesceToArray([1, 2])).toStrictEqual([1, 2])
|
|
7
|
+
})
|
|
8
|
+
|
|
9
|
+
test('should return a single value as a single-value array', () => {
|
|
10
|
+
expect(coalesceToArray('a')).toStrictEqual(['a'])
|
|
11
|
+
expect(coalesceToArray(1)).toStrictEqual([1])
|
|
12
|
+
})
|
|
13
|
+
|
|
14
|
+
test('should return undefined value as undefined', () => {
|
|
15
|
+
expect(coalesceToArray()).toBeUndefined()
|
|
16
|
+
})
|
|
17
|
+
})
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { Badge, badgeLink, badgeUri,
|
|
2
|
-
import { badgeDataFixture } from '
|
|
3
|
-
import { zoneDataFixture } from '
|
|
4
|
-
import { contactDataFixture } from '
|
|
5
|
-
import { missionDataFixture } from '
|
|
1
|
+
import { Badge, badgeLink, badgeUri, Contact, contactLink, contactUri, Mission, missionLink, missionUri, Zone, zoneLink, zoneUri } from '../../main'
|
|
2
|
+
import { badgeDataFixture } from '../api/badge-data.fixture'
|
|
3
|
+
import { zoneDataFixture } from '../api/zone-data.fixture'
|
|
4
|
+
import { contactDataFixture } from '../api/contact-data.fixture'
|
|
5
|
+
import { missionDataFixture } from '../api/mission-data.fixture'
|
|
6
6
|
|
|
7
7
|
describe(badgeUri.name, () => {
|
|
8
8
|
test('should return the expected pattern', () => {
|
|
@@ -147,19 +147,3 @@ describe(zoneLink.name, () => {
|
|
|
147
147
|
expect(zoneLink(zone)).toBe('[foo](zone://foo)')
|
|
148
148
|
})
|
|
149
149
|
})
|
|
150
|
-
|
|
151
|
-
describe(coalesceToArray.name, () => {
|
|
152
|
-
test('should return an array unmodified', () => {
|
|
153
|
-
expect(coalesceToArray(['a', 'b'])).toStrictEqual(['a', 'b'])
|
|
154
|
-
expect(coalesceToArray([1, 2])).toStrictEqual([1, 2])
|
|
155
|
-
})
|
|
156
|
-
|
|
157
|
-
test('should return a single value as a single-value array', () => {
|
|
158
|
-
expect(coalesceToArray('a')).toStrictEqual(['a'])
|
|
159
|
-
expect(coalesceToArray(1)).toStrictEqual([1])
|
|
160
|
-
})
|
|
161
|
-
|
|
162
|
-
test('should return undefined value as undefined', () => {
|
|
163
|
-
expect(coalesceToArray()).toBeUndefined()
|
|
164
|
-
})
|
|
165
|
-
})
|
|
File without changes
|