coh-content-db 2.0.0-rc.5 → 2.0.0-rc.6
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 +4 -4
- package/dist/coh-content-db.d.ts +203 -156
- package/dist/coh-content-db.js +263 -197
- package/dist/coh-content-db.js.map +1 -1
- package/dist/coh-content-db.mjs +256 -191
- package/dist/coh-content-db.mjs.map +1 -1
- package/package.json +1 -1
- package/src/main/api/badge-data.ts +16 -9
- package/src/main/api/{badge-partial-data.ts → badge-requirement-data.ts} +24 -8
- package/src/main/api/badge-requirement-type.ts +11 -0
- package/src/main/api/contact-data.ts +46 -0
- package/src/main/api/content-bundle.ts +10 -4
- package/src/main/api/zone-data.ts +20 -0
- package/src/main/changelog.ts +5 -1
- package/src/main/db/badge-index.ts +17 -11
- package/src/main/db/{badge-partial.ts → badge-requirement.ts} +30 -11
- package/src/main/db/badge-search-options.ts +2 -2
- package/src/main/db/badge.ts +48 -36
- package/src/main/db/bundle-metadata.ts +3 -3
- package/src/main/db/coh-content-database.ts +51 -18
- package/src/main/db/contact.ts +59 -0
- package/src/main/db/zone.ts +28 -0
- package/src/main/index.ts +8 -10
- package/src/main/util.ts +44 -13
- package/src/test/api/badge-data.fixture.ts +9 -7
- package/src/test/api/badge-requirement-data.fixture.ts +17 -0
- package/src/test/api/badge-requirement-type.test.ts +31 -0
- package/src/test/api/contact-data.fixture.ts +13 -0
- package/src/test/api/content-bundle.fixture.ts +2 -2
- package/src/test/api/content-bundle.test.ts +1 -1
- package/src/test/api/zone-data.fixture.ts +8 -0
- package/src/test/db/badge-index.test.ts +73 -41
- package/src/test/db/badge-requirement.test.ts +180 -0
- package/src/test/db/badge.test.ts +190 -15
- package/src/test/db/coh-content-database.test.ts +110 -18
- package/src/test/db/contact.test.ts +96 -0
- package/src/test/db/zone.test.ts +36 -0
- package/src/test/index.test.ts +4 -2
- package/src/test/util.test.ts +59 -22
- package/src/main/api/badge-partial-type.ts +0 -8
- package/src/main/api/game-map-data.ts +0 -26
- package/src/main/api/vidiot-map-data.ts +0 -18
- package/src/main/api/vidiot-map-point-of-interest-data.ts +0 -30
- package/src/main/db/game-map.ts +0 -33
- package/src/main/db/vidiot-map-point-of-interest.ts +0 -39
- package/src/main/db/vidiot-map.ts +0 -25
- package/src/test/api/badge-partial-data.fixture.ts +0 -17
- package/src/test/api/badge-partial-type.test.ts +0 -31
- package/src/test/api/game-map-data.fixture.ts +0 -10
- package/src/test/api/vidiot-map-point-of-interest.fixture.ts +0 -10
- package/src/test/api/vidiot-map.fixture.ts +0 -9
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { BADGE_REQUIREMENT_TYPE, BadgeRequirementType } from '../../main'
|
|
2
|
+
|
|
3
|
+
describe('BADGE_REQUIREMENT_TYPE', () => {
|
|
4
|
+
test('should be an array', () => {
|
|
5
|
+
expect(Array.isArray(BADGE_REQUIREMENT_TYPE)).toBeTruthy()
|
|
6
|
+
})
|
|
7
|
+
|
|
8
|
+
test('should not be empty', () => {
|
|
9
|
+
expect(BADGE_REQUIREMENT_TYPE).not.toHaveLength(0)
|
|
10
|
+
})
|
|
11
|
+
|
|
12
|
+
test('should contain only strings', () => {
|
|
13
|
+
for (const entry of BADGE_REQUIREMENT_TYPE) {
|
|
14
|
+
expect(typeof entry).toBe('string')
|
|
15
|
+
}
|
|
16
|
+
})
|
|
17
|
+
|
|
18
|
+
test('should contain all known badge requirement types', () => {
|
|
19
|
+
const expected = ['PLAQUE', 'BADGE', 'INVENTION', 'INVENTION_PLUS_ONE']
|
|
20
|
+
for (const category of expected) {
|
|
21
|
+
expect(BADGE_REQUIREMENT_TYPE).toContain(category)
|
|
22
|
+
}
|
|
23
|
+
})
|
|
24
|
+
})
|
|
25
|
+
|
|
26
|
+
describe('BadgeRequirementType', () => {
|
|
27
|
+
test('should be a usable type', () => {
|
|
28
|
+
const field: BadgeRequirementType = 'PLAQUE'
|
|
29
|
+
expect(field).toBe('PLAQUE')
|
|
30
|
+
})
|
|
31
|
+
})
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { defineFixture } from 'efate'
|
|
2
|
+
import { ContactData } from '../../main'
|
|
3
|
+
|
|
4
|
+
export const contactDataFixture = defineFixture<ContactData>((t) => {
|
|
5
|
+
t.key.as(index => `contact-${index}`)
|
|
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
|
+
})
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { defineFixture } from 'efate'
|
|
2
2
|
import { Change, ContentBundle } from '../../main'
|
|
3
3
|
import { archetypeDataFixture } from './archetype-data.fixture'
|
|
4
|
-
import {
|
|
4
|
+
import { zoneDataFixture } from './zone-data.fixture'
|
|
5
5
|
import { badgeDataFixture } from './badge-data.fixture'
|
|
6
6
|
|
|
7
7
|
export const contentBundleFixture = defineFixture<ContentBundle>((t) => {
|
|
@@ -10,7 +10,7 @@ export const contentBundleFixture = defineFixture<ContentBundle>((t) => {
|
|
|
10
10
|
t.repository?.as(index => `https://nouri.org?id=${index}`)
|
|
11
11
|
t.servers?.asArray()
|
|
12
12
|
t.archetypes?.arrayOfFixture({ fixture: archetypeDataFixture })
|
|
13
|
-
t.
|
|
13
|
+
t.zones?.arrayOfFixture({ fixture: zoneDataFixture })
|
|
14
14
|
t.badges?.arrayOfFixture({ fixture: badgeDataFixture })
|
|
15
15
|
t.changelog?.arrayOfFixture({
|
|
16
16
|
fixture: defineFixture<Change>((t) => {
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ZoneData } from '../../main'
|
|
2
|
+
import { defineFixture } from 'efate'
|
|
3
|
+
|
|
4
|
+
export const zoneDataFixture = defineFixture<ZoneData>((t) => {
|
|
5
|
+
t.key.as(index => `zone-${index}`)
|
|
6
|
+
t.name.as(index => `Zone ${index}`)
|
|
7
|
+
t.links?.as(() => [{ href: 'https://nouri.org' }])
|
|
8
|
+
})
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { badgeDataFixture } from '../api/badge-data.fixture'
|
|
2
|
-
import { Badge, BadgeIndex,
|
|
3
|
-
import {
|
|
2
|
+
import { Badge, BadgeIndex, Zone } from '../../main'
|
|
3
|
+
import { zoneDataFixture } from '../api/zone-data.fixture'
|
|
4
4
|
|
|
5
|
-
const
|
|
6
|
-
new
|
|
7
|
-
new
|
|
8
|
-
new
|
|
5
|
+
const TEST_Zones = [
|
|
6
|
+
new Zone(zoneDataFixture.create({ key: 'atlas-park', name: 'Atlas Park' })),
|
|
7
|
+
new Zone(zoneDataFixture.create({ key: 'perez-park', name: 'Perez Park' })),
|
|
8
|
+
new Zone(zoneDataFixture.create({ key: 'abandoned-sewer-network', name: 'Abandoned Sewer Network' })),
|
|
9
9
|
]
|
|
10
10
|
|
|
11
11
|
describe(BadgeIndex.name, () => {
|
|
@@ -31,6 +31,18 @@ describe(BadgeIndex.name, () => {
|
|
|
31
31
|
})
|
|
32
32
|
})
|
|
33
33
|
|
|
34
|
+
describe('badgeExists', () => {
|
|
35
|
+
test(`should return true for a badge that exists`, () => {
|
|
36
|
+
const data = [new Badge(badgeDataFixture.create({ key: 'foo' }))]
|
|
37
|
+
|
|
38
|
+
expect(new BadgeIndex(data).badgeExists('foo')).toBeTruthy()
|
|
39
|
+
})
|
|
40
|
+
|
|
41
|
+
test(`should return false for a badge that does not exist`, () => {
|
|
42
|
+
expect(new BadgeIndex([]).badgeExists('foo')).toBeFalsy()
|
|
43
|
+
})
|
|
44
|
+
})
|
|
45
|
+
|
|
34
46
|
describe('searchBadges', () => {
|
|
35
47
|
test(`should return everything for an empty query`, () => {
|
|
36
48
|
const data = [
|
|
@@ -200,15 +212,15 @@ describe(BadgeIndex.name, () => {
|
|
|
200
212
|
|
|
201
213
|
test(`should filter on badge type`, () => {
|
|
202
214
|
const data = [
|
|
203
|
-
new Badge(badgeDataFixture.create({ key: 'badge-1',
|
|
204
|
-
new Badge(badgeDataFixture.create({ key: 'badge-2',
|
|
205
|
-
new Badge(badgeDataFixture.create({ key: 'badge-3',
|
|
206
|
-
new Badge(badgeDataFixture.create({ key: 'badge-4',
|
|
207
|
-
new Badge(badgeDataFixture.create({ key: 'badge-5',
|
|
208
|
-
new Badge(badgeDataFixture.create({ key: 'badge-6',
|
|
215
|
+
new Badge(badgeDataFixture.create({ key: 'badge-1', zoneKey: 'atlas-park' })),
|
|
216
|
+
new Badge(badgeDataFixture.create({ key: 'badge-2', zoneKey: 'perez-park' })),
|
|
217
|
+
new Badge(badgeDataFixture.create({ key: 'badge-3', zoneKey: 'abandoned-sewer-network' })),
|
|
218
|
+
new Badge(badgeDataFixture.create({ key: 'badge-4', zoneKey: 'atlas-park' })),
|
|
219
|
+
new Badge(badgeDataFixture.create({ key: 'badge-5', zoneKey: 'perez-park' })),
|
|
220
|
+
new Badge(badgeDataFixture.create({ key: 'badge-6', zoneKey: undefined })),
|
|
209
221
|
]
|
|
210
222
|
|
|
211
|
-
const result = new BadgeIndex(data).searchBadges({ filter: {
|
|
223
|
+
const result = new BadgeIndex(data).searchBadges({ filter: { zoneKey: 'perez-park' } })
|
|
212
224
|
const keys = result.items.map(x => x.key)
|
|
213
225
|
expect(keys).toStrictEqual(['badge-2', 'badge-5'])
|
|
214
226
|
})
|
|
@@ -359,6 +371,26 @@ describe(BadgeIndex.name, () => {
|
|
|
359
371
|
const result = new BadgeIndex(data).searchBadges()
|
|
360
372
|
expect(result.totalPages).toBe(1)
|
|
361
373
|
})
|
|
374
|
+
|
|
375
|
+
test(`should return the last page if a page is requested past the max`, () => {
|
|
376
|
+
const data = [
|
|
377
|
+
new Badge(badgeDataFixture.create({ key: 'badge-1' })),
|
|
378
|
+
new Badge(badgeDataFixture.create({ key: 'badge-2' })),
|
|
379
|
+
new Badge(badgeDataFixture.create({ key: 'badge-3' })),
|
|
380
|
+
new Badge(badgeDataFixture.create({ key: 'badge-4' })),
|
|
381
|
+
new Badge(badgeDataFixture.create({ key: 'badge-5' })),
|
|
382
|
+
]
|
|
383
|
+
|
|
384
|
+
const result = new BadgeIndex(data).searchBadges({ pageSize: 2, page: 10 })
|
|
385
|
+
const keys = result.items.map(x => x.key)
|
|
386
|
+
expect(keys).toStrictEqual(['badge-5'])
|
|
387
|
+
expect(result.page).toBe(3)
|
|
388
|
+
})
|
|
389
|
+
|
|
390
|
+
test(`should return the first page if a page is requested lower than 1`, () => {
|
|
391
|
+
const result = new BadgeIndex([]).searchBadges({ page: -10 })
|
|
392
|
+
expect(result.page).toBe(1)
|
|
393
|
+
})
|
|
362
394
|
})
|
|
363
395
|
|
|
364
396
|
describe('sort', () => {
|
|
@@ -370,7 +402,7 @@ describe(BadgeIndex.name, () => {
|
|
|
370
402
|
new Badge(badgeDataFixture.create({ key: 'badge-4' })),
|
|
371
403
|
]
|
|
372
404
|
|
|
373
|
-
const result = new BadgeIndex(data,
|
|
405
|
+
const result = new BadgeIndex(data, TEST_Zones).searchBadges()
|
|
374
406
|
|
|
375
407
|
const keys = result.items.map(x => x.key)
|
|
376
408
|
expect(keys).toStrictEqual(['badge-1', 'badge-2', 'badge-3', 'badge-4'])
|
|
@@ -384,7 +416,7 @@ describe(BadgeIndex.name, () => {
|
|
|
384
416
|
new Badge(badgeDataFixture.create({ key: 'badge-4' })),
|
|
385
417
|
]
|
|
386
418
|
|
|
387
|
-
const result = new BadgeIndex(data,
|
|
419
|
+
const result = new BadgeIndex(data, TEST_Zones).searchBadges({ sort: { dir: 'DESC' } })
|
|
388
420
|
|
|
389
421
|
const keys = result.items.map(x => x.key)
|
|
390
422
|
expect(keys).toStrictEqual(['badge-4', 'badge-3', 'badge-2', 'badge-1'])
|
|
@@ -397,7 +429,7 @@ describe(BadgeIndex.name, () => {
|
|
|
397
429
|
new Badge(badgeDataFixture.create({ key: 'badge-3', name: [{ value: 'AAB' }] })),
|
|
398
430
|
]
|
|
399
431
|
|
|
400
|
-
const result = new BadgeIndex(data,
|
|
432
|
+
const result = new BadgeIndex(data, TEST_Zones).searchBadges({ sort: { by: 'BADGE_NAME' } })
|
|
401
433
|
|
|
402
434
|
const keys = result.items.map(x => x.key)
|
|
403
435
|
expect(keys).toStrictEqual(['badge-3', 'badge-1', 'badge-2'])
|
|
@@ -410,7 +442,7 @@ describe(BadgeIndex.name, () => {
|
|
|
410
442
|
new Badge(badgeDataFixture.create({ key: 'badge-3', name: [{ value: 'AAB' }] })),
|
|
411
443
|
]
|
|
412
444
|
|
|
413
|
-
const result = new BadgeIndex(data,
|
|
445
|
+
const result = new BadgeIndex(data, TEST_Zones).searchBadges({ sort: { by: 'BADGE_NAME', dir: 'DESC' } })
|
|
414
446
|
|
|
415
447
|
const keys = result.items.map(x => x.key)
|
|
416
448
|
expect(keys).toStrictEqual(['badge-2', 'badge-1', 'badge-3'])
|
|
@@ -423,62 +455,62 @@ describe(BadgeIndex.name, () => {
|
|
|
423
455
|
new Badge(badgeDataFixture.create({ key: 'badge-3', name: [{ value: 'AAB' }] })),
|
|
424
456
|
]
|
|
425
457
|
|
|
426
|
-
const result = new BadgeIndex(data,
|
|
458
|
+
const result = new BadgeIndex(data, TEST_Zones).searchBadges({ sort: { by: 'BADGE_NAME' } })
|
|
427
459
|
|
|
428
460
|
const keys = result.items.map(x => x.key)
|
|
429
461
|
expect(keys).toStrictEqual(['badge-3', 'badge-1', 'badge-2'])
|
|
430
462
|
})
|
|
431
463
|
|
|
432
|
-
test(`should sort by
|
|
464
|
+
test(`should sort by zone name`, () => {
|
|
433
465
|
const data = [
|
|
434
|
-
new Badge(badgeDataFixture.create({ key: 'badge-1',
|
|
435
|
-
new Badge(badgeDataFixture.create({ key: 'badge-2',
|
|
436
|
-
new Badge(badgeDataFixture.create({ key: 'badge-3',
|
|
466
|
+
new Badge(badgeDataFixture.create({ key: 'badge-1', zoneKey: 'atlas-park' })),
|
|
467
|
+
new Badge(badgeDataFixture.create({ key: 'badge-2', zoneKey: 'perez-park' })),
|
|
468
|
+
new Badge(badgeDataFixture.create({ key: 'badge-3', zoneKey: 'abandoned-sewer-network' })),
|
|
437
469
|
]
|
|
438
470
|
|
|
439
|
-
const result = new BadgeIndex(data,
|
|
471
|
+
const result = new BadgeIndex(data, TEST_Zones).searchBadges({ sort: { by: 'ZONE_NAME' } })
|
|
440
472
|
|
|
441
473
|
const keys = result.items.map(x => x.key)
|
|
442
474
|
expect(keys).toStrictEqual(['badge-3', 'badge-1', 'badge-2'])
|
|
443
475
|
})
|
|
444
476
|
|
|
445
|
-
test(`should sort by
|
|
477
|
+
test(`should sort by zone name descending`, () => {
|
|
446
478
|
const data = [
|
|
447
|
-
new Badge(badgeDataFixture.create({ key: 'badge-1',
|
|
448
|
-
new Badge(badgeDataFixture.create({ key: 'badge-2',
|
|
449
|
-
new Badge(badgeDataFixture.create({ key: 'badge-3',
|
|
479
|
+
new Badge(badgeDataFixture.create({ key: 'badge-1', zoneKey: 'atlas-park' })),
|
|
480
|
+
new Badge(badgeDataFixture.create({ key: 'badge-2', zoneKey: 'perez-park' })),
|
|
481
|
+
new Badge(badgeDataFixture.create({ key: 'badge-3', zoneKey: 'abandoned-sewer-network' })),
|
|
450
482
|
]
|
|
451
483
|
|
|
452
|
-
const result = new BadgeIndex(data,
|
|
484
|
+
const result = new BadgeIndex(data, TEST_Zones).searchBadges({ sort: { by: 'ZONE_NAME', dir: 'DESC' } })
|
|
453
485
|
|
|
454
486
|
const keys = result.items.map(x => x.key)
|
|
455
487
|
expect(keys).toStrictEqual(['badge-2', 'badge-1', 'badge-3'])
|
|
456
488
|
})
|
|
457
489
|
|
|
458
|
-
test(`should maintain canonical as secondary sort when sorting by
|
|
490
|
+
test(`should maintain canonical as secondary sort when sorting by zone name`, () => {
|
|
459
491
|
const data = [
|
|
460
|
-
new Badge(badgeDataFixture.create({ key: 'badge-1',
|
|
461
|
-
new Badge(badgeDataFixture.create({ key: 'badge-2',
|
|
462
|
-
new Badge(badgeDataFixture.create({ key: 'badge-3',
|
|
463
|
-
new Badge(badgeDataFixture.create({ key: 'badge-4',
|
|
492
|
+
new Badge(badgeDataFixture.create({ key: 'badge-1', zoneKey: 'atlas-park' })),
|
|
493
|
+
new Badge(badgeDataFixture.create({ key: 'badge-2', zoneKey: 'perez-park' })),
|
|
494
|
+
new Badge(badgeDataFixture.create({ key: 'badge-3', zoneKey: 'atlas-park' })),
|
|
495
|
+
new Badge(badgeDataFixture.create({ key: 'badge-4', zoneKey: 'abandoned-sewer-network' })),
|
|
464
496
|
]
|
|
465
497
|
|
|
466
|
-
const result = new BadgeIndex(data,
|
|
498
|
+
const result = new BadgeIndex(data, TEST_Zones).searchBadges({ sort: { by: 'ZONE_NAME' } })
|
|
467
499
|
|
|
468
500
|
const keys = result.items.map(x => x.key)
|
|
469
501
|
expect(keys).toStrictEqual(['badge-4', 'badge-1', 'badge-3', 'badge-2'])
|
|
470
502
|
})
|
|
471
503
|
|
|
472
|
-
test(`should sort unknown
|
|
504
|
+
test(`should sort unknown zone names to the end`, () => {
|
|
473
505
|
const data = [
|
|
474
|
-
new Badge(badgeDataFixture.create({ key: 'badge-1',
|
|
475
|
-
new Badge(badgeDataFixture.create({ key: 'badge-2',
|
|
476
|
-
new Badge(badgeDataFixture.create({ key: 'badge-3',
|
|
477
|
-
new Badge(badgeDataFixture.create({ key: 'badge-4',
|
|
478
|
-
new Badge(badgeDataFixture.create({ key: 'badge-5',
|
|
506
|
+
new Badge(badgeDataFixture.create({ key: 'badge-1', zoneKey: 'atlas-park' })),
|
|
507
|
+
new Badge(badgeDataFixture.create({ key: 'badge-2', zoneKey: 'unknown' })),
|
|
508
|
+
new Badge(badgeDataFixture.create({ key: 'badge-3', zoneKey: 'perez-park' })),
|
|
509
|
+
new Badge(badgeDataFixture.create({ key: 'badge-4', zoneKey: 'unexpected' })),
|
|
510
|
+
new Badge(badgeDataFixture.create({ key: 'badge-5', zoneKey: 'abandoned-sewer-network' })),
|
|
479
511
|
]
|
|
480
512
|
|
|
481
|
-
const result = new BadgeIndex(data,
|
|
513
|
+
const result = new BadgeIndex(data, TEST_Zones).searchBadges({ sort: { by: 'ZONE_NAME' } })
|
|
482
514
|
|
|
483
515
|
const keys = result.items.map(x => x.key)
|
|
484
516
|
expect(keys).toStrictEqual(['badge-5', 'badge-1', 'badge-3', 'badge-2', 'badge-4'])
|
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
import { BadgeRequirement } from '../../main'
|
|
2
|
+
import { badgeRequirementDataFixture } from '../api/badge-requirement-data.fixture'
|
|
3
|
+
|
|
4
|
+
describe(BadgeRequirement.name, () => {
|
|
5
|
+
describe('Constructor', () => {
|
|
6
|
+
test('should accept the test fixture', () => {
|
|
7
|
+
new BadgeRequirement(badgeRequirementDataFixture.create())
|
|
8
|
+
})
|
|
9
|
+
})
|
|
10
|
+
|
|
11
|
+
describe('key', () => {
|
|
12
|
+
test('should be set from the data', () => {
|
|
13
|
+
const requirement = new BadgeRequirement(badgeRequirementDataFixture.create({ key: 'foo' }))
|
|
14
|
+
expect(requirement.key).toEqual('foo')
|
|
15
|
+
})
|
|
16
|
+
})
|
|
17
|
+
|
|
18
|
+
describe('type', () => {
|
|
19
|
+
test('should be set from the data', () => {
|
|
20
|
+
const requirement = new BadgeRequirement(badgeRequirementDataFixture.create({ type: 'BADGE' }))
|
|
21
|
+
expect(requirement.type).toEqual('BADGE')
|
|
22
|
+
})
|
|
23
|
+
})
|
|
24
|
+
|
|
25
|
+
describe('zoneKey', () => {
|
|
26
|
+
test('should be set from the data', () => {
|
|
27
|
+
const requirement = new BadgeRequirement(badgeRequirementDataFixture.create({ zoneKey: 'zone123' }))
|
|
28
|
+
expect(requirement.zoneKey).toEqual('zone123')
|
|
29
|
+
})
|
|
30
|
+
|
|
31
|
+
test('should be optional', () => {
|
|
32
|
+
const requirement = new BadgeRequirement(badgeRequirementDataFixture.omit('zoneKey').create())
|
|
33
|
+
expect(requirement.zoneKey).toBeUndefined()
|
|
34
|
+
})
|
|
35
|
+
})
|
|
36
|
+
|
|
37
|
+
describe('loc', () => {
|
|
38
|
+
test('should be set from the data', () => {
|
|
39
|
+
const requirement = new BadgeRequirement(badgeRequirementDataFixture.create({ loc: [1, 2, 3] }))
|
|
40
|
+
expect(requirement.loc).toStrictEqual([1, 2, 3])
|
|
41
|
+
})
|
|
42
|
+
|
|
43
|
+
test('should be optional', () => {
|
|
44
|
+
const requirement = new BadgeRequirement(badgeRequirementDataFixture.omit('loc').create())
|
|
45
|
+
expect(requirement.loc).toBeUndefined()
|
|
46
|
+
})
|
|
47
|
+
})
|
|
48
|
+
|
|
49
|
+
describe('plaqueType', () => {
|
|
50
|
+
test('should be set from the data', () => {
|
|
51
|
+
const requirement = new BadgeRequirement(badgeRequirementDataFixture.create({ plaqueType: 'MONUMENT' }))
|
|
52
|
+
expect(requirement.plaqueType).toEqual('MONUMENT')
|
|
53
|
+
})
|
|
54
|
+
|
|
55
|
+
test('should be optional', () => {
|
|
56
|
+
const requirement = new BadgeRequirement(badgeRequirementDataFixture.omit('plaqueType').create())
|
|
57
|
+
expect(requirement.plaqueType).toBeUndefined()
|
|
58
|
+
})
|
|
59
|
+
})
|
|
60
|
+
|
|
61
|
+
describe('plaqueInscription', () => {
|
|
62
|
+
test('should be set from the data', () => {
|
|
63
|
+
const requirement = new BadgeRequirement(badgeRequirementDataFixture.create({ plaqueInscription: 'foo' }))
|
|
64
|
+
expect(requirement.plaqueInscription).toEqual('foo')
|
|
65
|
+
})
|
|
66
|
+
|
|
67
|
+
test('should be optional', () => {
|
|
68
|
+
const requirement = new BadgeRequirement(badgeRequirementDataFixture.omit('plaqueInscription').create())
|
|
69
|
+
expect(requirement.plaqueInscription).toBeUndefined()
|
|
70
|
+
})
|
|
71
|
+
})
|
|
72
|
+
|
|
73
|
+
describe('vidiotMapKey', () => {
|
|
74
|
+
test('should be set from the data', () => {
|
|
75
|
+
const requirement = new BadgeRequirement(badgeRequirementDataFixture.create({ vidiotMapKey: 'A1' }))
|
|
76
|
+
expect(requirement.vidiotMapKey).toEqual('A1')
|
|
77
|
+
})
|
|
78
|
+
|
|
79
|
+
test('should be optional', () => {
|
|
80
|
+
const requirement = new BadgeRequirement(badgeRequirementDataFixture.omit('vidiotMapKey').create())
|
|
81
|
+
expect(requirement.vidiotMapKey).toBeUndefined()
|
|
82
|
+
})
|
|
83
|
+
})
|
|
84
|
+
|
|
85
|
+
describe('badgeKey', () => {
|
|
86
|
+
test('should be set from the data', () => {
|
|
87
|
+
const requirement = new BadgeRequirement(badgeRequirementDataFixture.create({ badgeKey: 'foo' }))
|
|
88
|
+
expect(requirement.badgeKey).toEqual('foo')
|
|
89
|
+
})
|
|
90
|
+
|
|
91
|
+
test('should be optional', () => {
|
|
92
|
+
const requirement = new BadgeRequirement(badgeRequirementDataFixture.omit('badgeKey').create())
|
|
93
|
+
expect(requirement.badgeKey).toBeUndefined()
|
|
94
|
+
})
|
|
95
|
+
})
|
|
96
|
+
|
|
97
|
+
describe('missionName', () => {
|
|
98
|
+
test('should be set from the data', () => {
|
|
99
|
+
const requirement = new BadgeRequirement(badgeRequirementDataFixture.create({ missionName: 'foo' }))
|
|
100
|
+
expect(requirement.missionName).toEqual('foo')
|
|
101
|
+
})
|
|
102
|
+
|
|
103
|
+
test('should be optional', () => {
|
|
104
|
+
const requirement = new BadgeRequirement(badgeRequirementDataFixture.omit('missionName').create())
|
|
105
|
+
expect(requirement.missionName).toBeUndefined()
|
|
106
|
+
})
|
|
107
|
+
})
|
|
108
|
+
|
|
109
|
+
describe('contactKey', () => {
|
|
110
|
+
test('should be set from the data', () => {
|
|
111
|
+
const requirement = new BadgeRequirement(badgeRequirementDataFixture.create({ contactKey: 'foo' }))
|
|
112
|
+
expect(requirement.contactKey).toEqual('foo')
|
|
113
|
+
})
|
|
114
|
+
|
|
115
|
+
test('should be optional', () => {
|
|
116
|
+
const requirement = new BadgeRequirement(badgeRequirementDataFixture.omit('contactKey').create())
|
|
117
|
+
expect(requirement.contactKey).toBeUndefined()
|
|
118
|
+
})
|
|
119
|
+
})
|
|
120
|
+
|
|
121
|
+
describe('inventionLevel', () => {
|
|
122
|
+
test('should be set from the data', () => {
|
|
123
|
+
const requirement = new BadgeRequirement(badgeRequirementDataFixture.create({ inventionLevel: 10 }))
|
|
124
|
+
expect(requirement.inventionLevel).toEqual(10)
|
|
125
|
+
})
|
|
126
|
+
|
|
127
|
+
test('should be optional', () => {
|
|
128
|
+
const requirement = new BadgeRequirement(badgeRequirementDataFixture.omit('inventionLevel').create())
|
|
129
|
+
expect(requirement.inventionLevel).toBeUndefined()
|
|
130
|
+
})
|
|
131
|
+
})
|
|
132
|
+
|
|
133
|
+
describe('inventionTypes', () => {
|
|
134
|
+
test('should be set from the data', () => {
|
|
135
|
+
const requirement = new BadgeRequirement(badgeRequirementDataFixture.create({ inventionTypes: ['ACCURACY', 'CONFUSE'] }))
|
|
136
|
+
expect(requirement.inventionTypes).toStrictEqual(['ACCURACY', 'CONFUSE'])
|
|
137
|
+
})
|
|
138
|
+
|
|
139
|
+
test('should be optional', () => {
|
|
140
|
+
const requirement = new BadgeRequirement(badgeRequirementDataFixture.omit('inventionTypes').create())
|
|
141
|
+
expect(requirement.inventionTypes).toBeUndefined()
|
|
142
|
+
})
|
|
143
|
+
})
|
|
144
|
+
|
|
145
|
+
describe('inventionCount', () => {
|
|
146
|
+
test('should be set from the data', () => {
|
|
147
|
+
const requirement = new BadgeRequirement(badgeRequirementDataFixture.create({ inventionCount: 5 }))
|
|
148
|
+
expect(requirement.inventionCount).toEqual(5)
|
|
149
|
+
})
|
|
150
|
+
|
|
151
|
+
test('should be optional', () => {
|
|
152
|
+
const requirement = new BadgeRequirement(badgeRequirementDataFixture.omit('inventionCount').create())
|
|
153
|
+
expect(requirement.inventionCount).toBeUndefined()
|
|
154
|
+
})
|
|
155
|
+
})
|
|
156
|
+
|
|
157
|
+
describe('notes', () => {
|
|
158
|
+
test('should be set from the data', () => {
|
|
159
|
+
const requirement = new BadgeRequirement(badgeRequirementDataFixture.create({ notes: 'some notes' }))
|
|
160
|
+
expect(requirement.notes).toEqual('some notes')
|
|
161
|
+
})
|
|
162
|
+
|
|
163
|
+
test('should be optional', () => {
|
|
164
|
+
const requirement = new BadgeRequirement(badgeRequirementDataFixture.omit('notes').create())
|
|
165
|
+
expect(requirement.notes).toBeUndefined()
|
|
166
|
+
})
|
|
167
|
+
})
|
|
168
|
+
|
|
169
|
+
describe('links', () => {
|
|
170
|
+
test('should be set from the data', () => {
|
|
171
|
+
const requirement = new BadgeRequirement(badgeRequirementDataFixture.create({ links: [{ title: 'foo', href: 'bar' }] }))
|
|
172
|
+
expect(requirement.links).toStrictEqual([{ title: 'foo', href: 'bar' }])
|
|
173
|
+
})
|
|
174
|
+
|
|
175
|
+
test('should be optional', () => {
|
|
176
|
+
const requirement = new BadgeRequirement(badgeRequirementDataFixture.omit('links').create())
|
|
177
|
+
expect(requirement.links).toHaveLength(0)
|
|
178
|
+
})
|
|
179
|
+
})
|
|
180
|
+
})
|