coh-content-db 2.0.0-rc.5 → 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.
Files changed (82) hide show
  1. package/README.md +7 -7
  2. package/dist/coh-content-db.d.ts +493 -243
  3. package/dist/coh-content-db.js +675 -353
  4. package/dist/coh-content-db.js.map +1 -1
  5. package/dist/coh-content-db.mjs +655 -345
  6. package/dist/coh-content-db.mjs.map +1 -1
  7. package/eslint.config.mjs +1 -0
  8. package/package.json +1 -1
  9. package/src/main/api/alignment.ts +18 -2
  10. package/src/main/api/badge-data.ts +15 -38
  11. package/src/main/api/badge-requirement-data.ts +64 -0
  12. package/src/main/api/badge-requirement-type.ts +32 -0
  13. package/src/main/api/badge-type.ts +15 -15
  14. package/src/main/api/contact-data.ts +48 -0
  15. package/src/main/api/content-bundle.ts +16 -4
  16. package/src/main/api/enhancement-category.ts +26 -26
  17. package/src/main/api/location-data.ts +28 -0
  18. package/src/main/api/mission-data.ts +83 -0
  19. package/src/main/api/mission-type.ts +2 -0
  20. package/src/main/api/morality.ts +31 -0
  21. package/src/main/api/sex.ts +8 -1
  22. package/src/main/api/zone-data.ts +20 -0
  23. package/src/main/changelog.ts +8 -3
  24. package/src/main/db/alignment-list.ts +54 -0
  25. package/src/main/db/alternates.ts +15 -32
  26. package/src/main/db/badge-index.ts +17 -36
  27. package/src/main/db/badge-requirement.ts +81 -0
  28. package/src/main/db/badge-search-options.ts +5 -5
  29. package/src/main/db/badge.ts +73 -62
  30. package/src/main/db/bundle-metadata.ts +3 -3
  31. package/src/main/db/coh-content-database.ts +60 -23
  32. package/src/main/db/contact.ts +62 -0
  33. package/src/main/db/location.ts +30 -0
  34. package/src/main/db/mission.ts +107 -0
  35. package/src/main/db/morality-list.ts +99 -0
  36. package/src/main/db/zone.ts +28 -0
  37. package/src/main/index.ts +16 -13
  38. package/src/main/util.ts +85 -14
  39. package/src/test/api/alignment.test.ts +38 -4
  40. package/src/test/api/badge-data.fixture.ts +1 -15
  41. package/src/test/api/badge-data.test.ts +3 -3
  42. package/src/test/api/badge-requirement-data.fixture.ts +7 -0
  43. package/src/test/api/badge-requirement-type.test.ts +31 -0
  44. package/src/test/api/badge-type.test.ts +5 -5
  45. package/src/test/api/contact-data.fixture.ts +7 -0
  46. package/src/test/api/content-bundle.fixture.ts +1 -17
  47. package/src/test/api/content-bundle.test.ts +1 -1
  48. package/src/test/api/enhancement-category.test.ts +5 -5
  49. package/src/test/api/mission-data.fixture.ts +12 -0
  50. package/src/test/api/sex.test.ts +33 -1
  51. package/src/test/api/zone-data.fixture.ts +8 -0
  52. package/src/test/db/alignment-list.test.ts +200 -0
  53. package/src/test/db/alternates.test.ts +60 -56
  54. package/src/test/db/badge-index.test.ts +108 -66
  55. package/src/test/db/badge-requirement.test.ts +145 -0
  56. package/src/test/db/badge.test.ts +310 -14
  57. package/src/test/db/coh-content-database.test.ts +110 -29
  58. package/src/test/db/contact.test.ts +97 -0
  59. package/src/test/db/location.test.ts +51 -0
  60. package/src/test/db/mission.test.ts +171 -0
  61. package/src/test/db/morality-list.test.ts +457 -0
  62. package/src/test/db/zone.test.ts +36 -0
  63. package/src/test/index.test.ts +4 -2
  64. package/src/test/util.test.ts +112 -22
  65. package/src/main/api/badge-partial-data.ts +0 -66
  66. package/src/main/api/badge-partial-type.ts +0 -8
  67. package/src/main/api/game-map-data.ts +0 -26
  68. package/src/main/api/plaque-type.ts +0 -6
  69. package/src/main/api/vidiot-map-data.ts +0 -18
  70. package/src/main/api/vidiot-map-point-of-interest-data.ts +0 -30
  71. package/src/main/db/alignments.ts +0 -17
  72. package/src/main/db/badge-partial.ts +0 -83
  73. package/src/main/db/game-map.ts +0 -33
  74. package/src/main/db/vidiot-map-point-of-interest.ts +0 -39
  75. package/src/main/db/vidiot-map.ts +0 -25
  76. package/src/test/api/alignments.test.ts +0 -40
  77. package/src/test/api/badge-partial-data.fixture.ts +0 -17
  78. package/src/test/api/badge-partial-type.test.ts +0 -31
  79. package/src/test/api/game-map-data.fixture.ts +0 -10
  80. package/src/test/api/plaque-type.test.ts +0 -31
  81. package/src/test/api/vidiot-map-point-of-interest.fixture.ts +0 -10
  82. package/src/test/api/vidiot-map.fixture.ts +0 -9
@@ -0,0 +1,36 @@
1
+ import { Zone } from '../../main'
2
+ import { zoneDataFixture } from '../api/zone-data.fixture'
3
+
4
+ describe(Zone.name, () => {
5
+ describe('Constructor', () => {
6
+ test(`should accept the test fixture`, () => {
7
+ new Zone(zoneDataFixture.create())
8
+ })
9
+ })
10
+
11
+ describe('key', () => {
12
+ test(`should be set from the data`, () => {
13
+ const zone = new Zone(zoneDataFixture.create({ key: 'foo' }))
14
+ expect(zone.key).toEqual('foo')
15
+ })
16
+ })
17
+
18
+ describe('name', () => {
19
+ test(`should be set from the data`, () => {
20
+ const zone = new Zone(zoneDataFixture.create({ name: 'foo' }))
21
+ expect(zone.name).toEqual('foo')
22
+ })
23
+ })
24
+
25
+ describe('links', () => {
26
+ test(`should be set from the data`, () => {
27
+ const zone = new Zone(zoneDataFixture.create({ links: [{ title: 'foo', href: 'bar' }] }))
28
+ expect(zone.links).toStrictEqual([{ title: 'foo', href: 'bar' }])
29
+ })
30
+
31
+ test(`should be optional`, () => {
32
+ const zone = new Zone(zoneDataFixture.omit('links').create())
33
+ expect(zone.links).toHaveLength(0)
34
+ })
35
+ })
36
+ })
@@ -7,6 +7,8 @@ test('should export the changelog', () => {
7
7
  test('should export badge reference utils', () => {
8
8
  expect(index).toHaveProperty('badgeUri')
9
9
  expect(index).toHaveProperty('badgeLink')
10
- expect(index).toHaveProperty('mapUri')
11
- expect(index).toHaveProperty('mapLink')
10
+ expect(index).toHaveProperty('contactUri')
11
+ expect(index).toHaveProperty('contactLink')
12
+ expect(index).toHaveProperty('zoneUri')
13
+ expect(index).toHaveProperty('zoneLink')
12
14
  })
@@ -1,6 +1,8 @@
1
- import { Badge, badgeLink, badgeUri, GameMap, mapLink, mapUri } from '../main'
1
+ import { Badge, badgeLink, badgeUri, coalesceToArray, Contact, contactLink, contactUri, Mission, missionLink, missionUri, Zone, zoneLink, zoneUri } from '../main'
2
2
  import { badgeDataFixture } from './api/badge-data.fixture'
3
- import { gameMapDataFixture } from './api/game-map-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'
4
6
 
5
7
  describe(badgeUri.name, () => {
6
8
  test('should return the expected pattern', () => {
@@ -38,38 +40,126 @@ describe(badgeLink.name, () => {
38
40
  })
39
41
  })
40
42
 
41
- describe(mapUri.name, () => {
43
+ describe(contactUri.name, () => {
42
44
  test('should return the expected pattern', () => {
43
- expect(mapUri('foo')).toBe('map://foo')
44
- expect(mapUri('bar')).toBe('map://bar')
45
- expect(mapUri('foo-bar')).toBe('map://foo-bar')
45
+ expect(contactUri('foo')).toBe('contact://foo')
46
+ expect(contactUri('bar')).toBe('contact://bar')
47
+ expect(contactUri('foo-bar')).toBe('contact://foo-bar')
46
48
  })
47
49
 
48
- test('should accept a GameMap object', () => {
49
- const map = new GameMap(gameMapDataFixture.create({ key: 'foo' }))
50
- expect(mapUri(map)).toBe('map://foo')
50
+ test('should accept a Contact object', () => {
51
+ const contact = new Contact(contactDataFixture.create({ key: 'foo' }))
52
+ expect(contactUri(contact)).toBe('contact://foo')
51
53
  })
52
54
 
53
- test('should accept a GameMapData object', () => {
54
- const map = gameMapDataFixture.create({ key: 'foo' })
55
- expect(mapUri(map)).toBe('map://foo')
55
+ test('should accept a ContactData object', () => {
56
+ const contact = contactDataFixture.create({ key: 'foo' })
57
+ expect(contactUri(contact)).toBe('contact://foo')
56
58
  })
57
59
  })
58
60
 
59
- describe(mapLink.name, () => {
61
+ describe(contactLink.name, () => {
60
62
  test('should return the expected pattern', () => {
61
- expect(mapLink('foo')).toBe('[foo](map://foo)')
62
- expect(mapLink('bar')).toBe('[bar](map://bar)')
63
- expect(mapLink('foo-bar')).toBe('[foo-bar](map://foo-bar)')
63
+ expect(contactLink('foo')).toBe('[foo](contact://foo)')
64
+ expect(contactLink('bar')).toBe('[bar](contact://bar)')
65
+ expect(contactLink('foo-bar')).toBe('[foo-bar](contact://foo-bar)')
64
66
  })
65
67
 
66
- test('should accept a GameMap object', () => {
67
- const map = new GameMap(gameMapDataFixture.create({ key: 'foo' }))
68
- expect(mapLink(map)).toBe('[foo](map://foo)')
68
+ test('should accept a Contact object', () => {
69
+ const contact = new Contact(contactDataFixture.create({ key: 'foo' }))
70
+ expect(contactLink(contact)).toBe('[foo](contact://foo)')
69
71
  })
70
72
 
71
- test('should accept a GameMapData object', () => {
72
- const map = gameMapDataFixture.create({ key: 'foo' })
73
- expect(mapLink(map)).toBe('[foo](map://foo)')
73
+ test('should accept a ContactData object', () => {
74
+ const contact = contactDataFixture.create({ key: 'foo' })
75
+ expect(contactLink(contact)).toBe('[foo](contact://foo)')
76
+ })
77
+ })
78
+
79
+ describe(missionUri.name, () => {
80
+ test('should return the expected pattern', () => {
81
+ expect(missionUri('foo')).toBe('mission://foo')
82
+ expect(missionUri('bar')).toBe('mission://bar')
83
+ expect(missionUri('foo-bar')).toBe('mission://foo-bar')
84
+ })
85
+
86
+ test('should accept a Mission object', () => {
87
+ const mission = new Mission(missionDataFixture.create({ key: 'foo' }))
88
+ expect(missionUri(mission)).toBe('mission://foo')
89
+ })
90
+
91
+ test('should accept a MissionData object', () => {
92
+ const mission = missionDataFixture.create({ key: 'foo' })
93
+ expect(missionUri(mission)).toBe('mission://foo')
94
+ })
95
+ })
96
+
97
+ describe(missionLink.name, () => {
98
+ test('should return the expected pattern', () => {
99
+ expect(missionLink('foo')).toBe('[foo](mission://foo)')
100
+ expect(missionLink('bar')).toBe('[bar](mission://bar)')
101
+ expect(missionLink('foo-bar')).toBe('[foo-bar](mission://foo-bar)')
102
+ })
103
+
104
+ test('should accept a Mission object', () => {
105
+ const mission = new Mission(missionDataFixture.create({ key: 'foo' }))
106
+ expect(missionLink(mission)).toBe('[foo](mission://foo)')
107
+ })
108
+
109
+ test('should accept a MissionData object', () => {
110
+ const mission = missionDataFixture.create({ key: 'foo' })
111
+ expect(missionLink(mission)).toBe('[foo](mission://foo)')
112
+ })
113
+ })
114
+
115
+ describe(zoneUri.name, () => {
116
+ test('should return the expected pattern', () => {
117
+ expect(zoneUri('foo')).toBe('zone://foo')
118
+ expect(zoneUri('bar')).toBe('zone://bar')
119
+ expect(zoneUri('foo-bar')).toBe('zone://foo-bar')
120
+ })
121
+
122
+ test('should accept a Zone object', () => {
123
+ const zone = new Zone(zoneDataFixture.create({ key: 'foo' }))
124
+ expect(zoneUri(zone)).toBe('zone://foo')
125
+ })
126
+
127
+ test('should accept a ZoneData object', () => {
128
+ const zone = zoneDataFixture.create({ key: 'foo' })
129
+ expect(zoneUri(zone)).toBe('zone://foo')
130
+ })
131
+ })
132
+
133
+ describe(zoneLink.name, () => {
134
+ test('should return the expected pattern', () => {
135
+ expect(zoneLink('foo')).toBe('[foo](zone://foo)')
136
+ expect(zoneLink('bar')).toBe('[bar](zone://bar)')
137
+ expect(zoneLink('foo-bar')).toBe('[foo-bar](zone://foo-bar)')
138
+ })
139
+
140
+ test('should accept a Zone object', () => {
141
+ const zone = new Zone(zoneDataFixture.create({ key: 'foo' }))
142
+ expect(zoneLink(zone)).toBe('[foo](zone://foo)')
143
+ })
144
+
145
+ test('should accept a ZoneData object', () => {
146
+ const zone = zoneDataFixture.create({ key: 'foo' })
147
+ expect(zoneLink(zone)).toBe('[foo](zone://foo)')
148
+ })
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()
74
164
  })
75
165
  })
@@ -1,66 +0,0 @@
1
- import { EnhancementCategory } from './enhancement-category'
2
- import { BadgePartialType } from './badge-partial-type'
3
- import { PlaqueType } from './plaque-type'
4
- import { MarkdownString } from './markdown-string'
5
-
6
- export interface BadgePartialData {
7
- /**
8
- * Key.
9
- */
10
- readonly key: string
11
-
12
- /**
13
- * Type of partial.
14
- */
15
- readonly type: BadgePartialType
16
-
17
- /**
18
- * Map the partial is located on.
19
- */
20
- readonly mapKey?: string
21
-
22
- /**
23
- * /loc coordinates.
24
- */
25
- readonly loc?: number[]
26
-
27
- /**
28
- * Is it a wall plaque or a physical monument?
29
- */
30
- readonly plaqueType?: PlaqueType
31
-
32
- /**
33
- * Plaque inscription.
34
- */
35
- readonly plaqueInscription?: string
36
-
37
- /**
38
- * The number or letter the partial appears as on Vidiot Maps.
39
- */
40
- readonly vidiotMapKey?: string
41
-
42
- /**
43
- * The badge required for this partial.
44
- */
45
- readonly badgeKey?: string
46
-
47
- /**
48
- * Level of the invention required.
49
- */
50
- readonly inventionLevel?: number
51
-
52
- /**
53
- * The types of enhancements required to be crafted.
54
- */
55
- readonly inventionTypes?: EnhancementCategory[]
56
-
57
- /**
58
- * Number of invention crafts required.
59
- */
60
- readonly inventionCount?: number
61
-
62
- /**
63
- * Any additional notes.
64
- */
65
- readonly notes?: MarkdownString
66
- }
@@ -1,8 +0,0 @@
1
- export const BADGE_PARTIAL_TYPE = [
2
- 'PLAQUE',
3
- 'BADGE',
4
- 'INVENTION',
5
- 'INVENTION_PLUS_ONE', // Some invention badges require you to build x of two different invention levels, 'plus one of either level'.
6
- ] as const
7
-
8
- export type BadgePartialType = typeof BADGE_PARTIAL_TYPE[number]
@@ -1,26 +0,0 @@
1
- import { Link } from './link'
2
- import { VidiotMapData } from './vidiot-map-data'
3
-
4
- export interface GameMapData {
5
- /**
6
- * Unique key used to reference this badge.
7
- *
8
- * Keys can only contain lowercase letters, numbers and hyphens (`-`).
9
- */
10
- readonly key: string
11
-
12
- /**
13
- * The name of the map as it appears in-game.
14
- */
15
- readonly name: string
16
-
17
- /**
18
- * List of external links for this Map. Wiki, forums, etc.
19
- */
20
- readonly links?: Link[]
21
-
22
- /**
23
- * List of Vidiot Map assets for this map.
24
- */
25
- readonly vidiotMaps?: VidiotMapData[]
26
- }
@@ -1,6 +0,0 @@
1
- export const PLAQUE_TYPE = [
2
- 'WALL_PLAQUE',
3
- 'MONUMENT',
4
- ]
5
-
6
- export type PlaqueType = typeof PLAQUE_TYPE[number]
@@ -1,18 +0,0 @@
1
- import { VidiotMapPointOfInterestData } from './vidiot-map-point-of-interest-data'
2
-
3
- export interface VidiotMapData {
4
- /**
5
- * URL of the map image.
6
- */
7
- readonly imageUrl: string
8
-
9
- /**
10
- * Name to display for the Vidiot map.
11
- */
12
- readonly name?: string
13
-
14
- /**
15
- * List of Points of Interest labelled on the image.
16
- */
17
- readonly pointsOfInterest?: VidiotMapPointOfInterestData[]
18
- }
@@ -1,30 +0,0 @@
1
- import { MarkdownString } from './markdown-string'
2
-
3
- export interface VidiotMapPointOfInterestData {
4
- /**
5
- * The pixel-space position of the PoI on the map graphic.
6
- *
7
- * Screen-space, pixels from top-left `[0, 0]`.
8
- */
9
- readonly pos?: [number, number]
10
-
11
- /**
12
- * Freeform notes about the PoI.
13
- */
14
- readonly notes?: MarkdownString
15
-
16
- /**
17
- * If the POI is a zone transfer, the map it transfers to.
18
- */
19
- readonly mapKey?: string
20
-
21
- /**
22
- * If the POI is a badge, the badge.
23
- */
24
- readonly badgeKey?: string
25
-
26
- /**
27
- * If the POI is a partial for a badge, the partial key.
28
- */
29
- readonly badgePartialKey?: string
30
- }
@@ -1,17 +0,0 @@
1
- import { Alignment } from '../api/alignment'
2
-
3
- export class Alignments {
4
- readonly items: Alignment[]
5
- readonly hero: boolean
6
- readonly villain: boolean
7
- readonly praetorian: boolean
8
- readonly primal: boolean
9
-
10
- constructor(raw: Alignment[]) {
11
- this.items = raw
12
- this.hero = raw.includes('H')
13
- this.villain = raw.includes('V')
14
- this.praetorian = raw.includes('P')
15
- this.primal = !this.praetorian && (this.hero || this.villain)
16
- }
17
- }
@@ -1,83 +0,0 @@
1
- import { BadgePartialData } from '../api/badge-partial-data'
2
- import { PlaqueType } from '../api/plaque-type'
3
- import { BadgePartialType } from '../api/badge-partial-type'
4
- import { EnhancementCategory } from '../api/enhancement-category'
5
- import { Key } from './key'
6
- import { MarkdownString } from '../api/markdown-string'
7
-
8
- export class BadgePartial {
9
- /**
10
- * Key.
11
- */
12
- readonly key: string
13
-
14
- /**
15
- * Type of partial.
16
- */
17
- readonly type: BadgePartialType
18
-
19
- /**
20
- * Map the partial is located on.
21
- */
22
- readonly mapKey?: string
23
-
24
- /**
25
- * /loc coordinates.
26
- */
27
- readonly loc?: number[]
28
-
29
- /**
30
- * Is it a wall plaque or a physical monument?
31
- */
32
- readonly plaqueType?: PlaqueType
33
-
34
- /**
35
- * Plaque inscription.
36
- */
37
- readonly plaqueInscription?: string
38
-
39
- /**
40
- * The number or letter the partial appears as on Vidiot Maps.
41
- */
42
- readonly vidiotMapKey?: string
43
-
44
- /**
45
- * The badge required for this partial.
46
- */
47
- readonly badgeKey?: string
48
-
49
- /**
50
- * Level of the invention required.
51
- */
52
- readonly inventionLevel?: number
53
-
54
- /**
55
- * The types of enhancements required to be crafted.
56
- */
57
- readonly inventionTypes?: EnhancementCategory[]
58
-
59
- /**
60
- * Number of invention crafts required.
61
- */
62
- readonly inventionCount?: number
63
-
64
- /**
65
- * Any additional notes.
66
- */
67
- readonly notes?: MarkdownString
68
-
69
- constructor(data: BadgePartialData) {
70
- this.key = new Key(data.key).value
71
- this.type = data.type
72
- this.mapKey = data.mapKey
73
- this.loc = data.loc
74
- this.plaqueType = data.plaqueType
75
- this.plaqueInscription = data.plaqueInscription
76
- this.vidiotMapKey = data.vidiotMapKey
77
- this.badgeKey = data.badgeKey
78
- this.inventionLevel = data.inventionLevel
79
- this.inventionTypes = data.inventionTypes
80
- this.inventionCount = data.inventionCount
81
- this.notes = data.notes
82
- }
83
- }
@@ -1,33 +0,0 @@
1
- import { VidiotMap } from './vidiot-map'
2
- import { Link } from '../api/link'
3
- import { GameMapData } from '../api/game-map-data'
4
- import { Key } from './key'
5
-
6
- export class GameMap {
7
- /**
8
- * The database key for this map.
9
- */
10
- readonly key: string
11
-
12
- /**
13
- * The name of the map as it appears in-game.
14
- */
15
- readonly name: string
16
-
17
- /**
18
- * List of external links for this Map. Wiki, forums, etc.
19
- */
20
- readonly links?: Link[]
21
-
22
- /**
23
- * List of Vidiot Map assets for this map.
24
- */
25
- readonly vidiotMaps?: VidiotMap[]
26
-
27
- constructor(data: GameMapData) {
28
- this.key = new Key(data.key).value
29
- this.name = data.name
30
- this.links = data.links
31
- this.vidiotMaps = data.vidiotMaps?.map(data => new VidiotMap(data))
32
- }
33
- }
@@ -1,39 +0,0 @@
1
- import { VidiotMapPointOfInterestData } from '../api/vidiot-map-point-of-interest-data'
2
- import { MarkdownString } from '../api/markdown-string'
3
-
4
- export class VidiotMapPointOfInterest {
5
- /**
6
- * The pixel-space position of the PoI on the map graphic.
7
- *
8
- * Screen-space, pixels from top-left `[0, 0]`.
9
- */
10
- readonly pos?: [number, number]
11
-
12
- /**
13
- * Freeform notes about the PoI.
14
- */
15
- readonly notes?: MarkdownString
16
-
17
- /**
18
- * If the POI is a zone transfer, the map it transfers to.
19
- */
20
- readonly mapKey?: string
21
-
22
- /**
23
- * If the POI is a badge, the badge.
24
- */
25
- readonly badgeKey?: string
26
-
27
- /**
28
- * If the POI is a partial for a badge, the partial key.
29
- */
30
- readonly badgePartialKey?: string
31
-
32
- constructor(data: VidiotMapPointOfInterestData) {
33
- this.pos = data.pos
34
- this.notes = data.notes
35
- this.mapKey = data.mapKey
36
- this.badgeKey = data.badgeKey
37
- this.badgePartialKey = data.badgePartialKey
38
- }
39
- }
@@ -1,25 +0,0 @@
1
- import { VidiotMapData } from '../api/vidiot-map-data'
2
- import { VidiotMapPointOfInterest } from './vidiot-map-point-of-interest'
3
-
4
- export class VidiotMap {
5
- /**
6
- * URL of the map image.
7
- */
8
- readonly imageUrl: string
9
-
10
- /**
11
- * Name to display for the Vidiot map.
12
- */
13
- readonly name?: string
14
-
15
- /**
16
- * List of Points of Interest labelled on the image.
17
- */
18
- readonly pointsOfInterest?: VidiotMapPointOfInterest[]
19
-
20
- constructor(data: VidiotMapData) {
21
- this.imageUrl = data.imageUrl
22
- this.name = data.name
23
- this.pointsOfInterest = data.pointsOfInterest?.map(data => new VidiotMapPointOfInterest(data))
24
- }
25
- }
@@ -1,40 +0,0 @@
1
- import { Alignments } from '../../main'
2
-
3
- describe(Alignments.name, () => {
4
- test('should return the raw array', () => {
5
- expect(new Alignments(['H', 'V']).items).toStrictEqual(['H', 'V'])
6
- })
7
-
8
- test('should detect a hero', () => {
9
- expect(new Alignments(['H', 'V']).hero).toBeTruthy()
10
- })
11
-
12
- test('should detect a villain', () => {
13
- expect(new Alignments(['H', 'V']).villain).toBeTruthy()
14
- })
15
-
16
- test('should detect a praetorian', () => {
17
- expect(new Alignments(['H', 'V', 'P']).praetorian).toBeTruthy()
18
- })
19
-
20
- test('should detect a primal', () => {
21
- expect(new Alignments(['H', 'V']).primal).toBeTruthy()
22
- })
23
-
24
- test('should not falsely detect a hero', () => {
25
- expect(new Alignments(['V']).hero).toBeFalsy()
26
- })
27
-
28
- test('should not falsely detect a villain', () => {
29
- expect(new Alignments(['H']).villain).toBeFalsy()
30
- })
31
-
32
- test('should not falsely detect a praetorian', () => {
33
- expect(new Alignments(['V']).praetorian).toBeFalsy()
34
- })
35
-
36
- test('should falsely detect a primal', () => {
37
- expect(new Alignments(['H', 'V', 'P']).primal).toBeFalsy()
38
- expect(new Alignments(['P']).primal).toBeFalsy()
39
- })
40
- })
@@ -1,17 +0,0 @@
1
- import { defineFixture } from 'efate'
2
- import { BADGE_PARTIAL_TYPE, BadgePartialData, ENHANCEMENT_CATEGORY, PLAQUE_TYPE } from '../../main'
3
-
4
- export const badgePartialDataFixture = defineFixture<BadgePartialData>((t) => {
5
- t.key.as(index => `badge-partial-${index}`)
6
- t.type.pickFrom([...BADGE_PARTIAL_TYPE])
7
- t.mapKey?.asString()
8
- t.loc?.asArray()
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
- })
@@ -1,31 +0,0 @@
1
- import { BADGE_PARTIAL_TYPE, BadgePartialType } from '../../main'
2
-
3
- describe('BADGE_PARTIAL_TYPE', () => {
4
- test('should be an array', () => {
5
- expect(Array.isArray(BADGE_PARTIAL_TYPE)).toBeTruthy()
6
- })
7
-
8
- test('should not be empty', () => {
9
- expect(BADGE_PARTIAL_TYPE).not.toHaveLength(0)
10
- })
11
-
12
- test('should contain only strings', () => {
13
- for (const entry of BADGE_PARTIAL_TYPE) {
14
- expect(typeof entry).toBe('string')
15
- }
16
- })
17
-
18
- test('should contain all known badge partial types', () => {
19
- const expected = ['PLAQUE', 'BADGE', 'INVENTION', 'INVENTION_PLUS_ONE']
20
- for (const category of expected) {
21
- expect(BADGE_PARTIAL_TYPE).toContain(category)
22
- }
23
- })
24
- })
25
-
26
- describe('BadgePartialType', () => {
27
- test('should be a usable type', () => {
28
- const field: BadgePartialType = 'PLAQUE'
29
- expect(field).toBe('PLAQUE')
30
- })
31
- })
@@ -1,10 +0,0 @@
1
- import { GameMapData } from '../../main'
2
- import { defineFixture } from 'efate'
3
- import { vidiotMapFixture } from './vidiot-map.fixture'
4
-
5
- export const gameMapDataFixture = defineFixture<GameMapData>((t) => {
6
- t.key.as(index => `map-${index}`)
7
- t.name.as(index => `Map ${index}`)
8
- t.links?.asArray([{ href: 'https://nouri.org' }])
9
- t.vidiotMaps?.arrayOfFixture({ fixture: vidiotMapFixture })
10
- })