Skip to content

Commit 40f49e6

Browse files
committed
fix(tests): fix issue in character tests where strings were being treated as arrays
1 parent d5d8163 commit 40f49e6

2 files changed

Lines changed: 15 additions & 7 deletions

File tree

docs/api/classes/client_LodestoneClient.default.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ Client for interfacing with the Final Fantasy XIV Lodestone.
3030

3131
#### Defined in
3232

33-
[client/LodestoneClient.ts:56](https://github.com/XIVStats/lodestone/blob/8f23137/src/client/LodestoneClient.ts#L56)
33+
[client/LodestoneClient.ts:56](https://github.com/XIVStats/lodestone/blob/d5d8163/src/client/LodestoneClient.ts#L56)
3434

3535
## Properties
3636

@@ -44,4 +44,4 @@ An instance will be generated by default, but as a consumer you can provide your
4444

4545
#### Defined in
4646

47-
[client/LodestoneClient.ts:50](https://github.com/XIVStats/lodestone/blob/8f23137/src/client/LodestoneClient.ts#L50)
47+
[client/LodestoneClient.ts:50](https://github.com/XIVStats/lodestone/blob/d5d8163/src/client/LodestoneClient.ts#L50)

src/entity/__tests__/Character.test.ts

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -422,11 +422,19 @@ describe('Character', () => {
422422
if (objectAttributes.length > 0) {
423423
describe.each(objectAttributes)('should evaluate %s as object', (key, value) => {
424424
describe.each(Object.entries(value))('with key %s, an object', (lowerKey, lowerValue) => {
425-
// @ts-ignore
426-
it.each(Object.entries(lowerValue))("with key %s equal to '%s'", (lowestKey, lowestValue) => {
427-
// @ts-ignore
428-
expect(resultantCharacter[key][lowerKey][lowestKey]).toEqual(lowestValue)
429-
})
425+
if (!(lowerValue instanceof Object)) {
426+
// eslint-disable-next-line @typescript-eslint/restrict-template-expressions
427+
it(`with key ${lowerKey} equal to ${lowerValue}`, ()=>{
428+
// @ts-ignore
429+
expect(resultantCharacter[key][lowerKey]).toEqual(lowerValue)
430+
})
431+
} else {
432+
// @ts-ignore
433+
it.each(Object.entries(lowerValue))("with key %s equal to '%s'", (lowestKey, lowestValue) => {
434+
// @ts-ignore
435+
expect(resultantCharacter[key][lowerKey][lowestKey]).toEqual(lowestValue)
436+
})
437+
}
430438
})
431439
})
432440
}

0 commit comments

Comments
 (0)