add playersettings, img, more match endpoints

This commit is contained in:
Devin Zuczek
2026-06-12 17:15:18 -04:00
parent 4a97e05866
commit 4d1ea9fe3e
42 changed files with 21397 additions and 2538 deletions
+21 -2
View File
@@ -39,9 +39,26 @@ describe('public endpoints', () => {
expect(res.status).toBe(200)
})
test('GET /player returns the default payload', async () => {
test('GET /player?id=N synthesizes a player payload for that id', async () => {
const res = await exports.default.fetch(`${ORIGIN}/player?id=99`)
expect(res.status).toBe(200)
const players = (await res.json()) as Array<{
playerId: number
isOnline: boolean
appVersion: string
roomInstance: unknown
}>
expect(players[0]).toMatchObject({
playerId: 99,
isOnline: false,
appVersion: '',
roomInstance: null,
})
})
test('GET /player without an id returns the default payload', async () => {
const res = await exports.default.fetch(`${ORIGIN}/player`)
expect(res.status).toBe(200)
const players = (await res.json()) as Array<{ playerId: number; isOnline: boolean }>
expect(players[0]).toMatchObject({ playerId: 1, isOnline: true, appVersion: '20210129' })
})
@@ -107,7 +124,9 @@ describe('auth-gated endpoints', () => {
body: new URLSearchParams({ JoinMode: '2' }).toString(),
})
expect(res.status).toBe(200)
const body = (await res.json()) as { roomInstance: { roomId: number; isPrivate: boolean; name: string } }
const body = (await res.json()) as {
roomInstance: { roomId: number; isPrivate: boolean; name: string }
}
expect(body.roomInstance).toMatchObject({ roomId: 42, isPrivate: true, name: '42' })
})