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
+26 -1
View File
@@ -2,6 +2,7 @@ import { exports } from 'cloudflare:workers'
import { describe, expect, test } from 'vitest'
import '../../api.app'
import { DEFAULT_AVATAR_ITEMS } from '../../default-avatar-items'
const ORIGIN = 'https://api.rec.djdevin.net'
@@ -37,7 +38,12 @@ describe('public endpoints', () => {
test('GET /api/config/v1/amplitude', async () => {
const res = await exports.default.fetch(`${ORIGIN}/api/config/v1/amplitude`)
expect(res.status).toBe(200)
expect(await res.json()).toEqual({ AmplitudeKey: 'NoKeyProvided' })
expect(await res.json()).toEqual({
AmplitudeKey: 'a',
StatSigKey: 'a',
RudderStackKey: 'a',
UseRudderStack: false,
})
})
test('GET /api/versioncheck/v4', async () => {
@@ -55,6 +61,25 @@ describe('public endpoints', () => {
expect(await res.json()).toMatchObject({ AccountId: 99, CheerCredit: 20 })
})
test('POST /api/playerReputation/v2/bulk returns a reputation per id', async () => {
const res = await exports.default.fetch(`${ORIGIN}/api/playerReputation/v2/bulk`, {
method: 'POST',
headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
body: new URLSearchParams({ Ids: '1,2,3' }),
})
expect(res.status).toBe(200)
const reps = (await res.json()) as Array<{ AccountId: number; CheerCredit: number }>
expect(reps.map((r) => r.AccountId)).toEqual([1, 2, 3])
expect(reps.every((r) => r.CheerCredit === 20)).toBe(true)
})
test('POST /api/playerReputation/v2/bulk returns [] without ids', async () => {
const res = await exports.default.fetch(`${ORIGIN}/api/playerReputation/v2/bulk`, {
method: 'POST',
})
expect(await res.json()).toEqual([])
})
test('GET /api/storefronts/v1/p2p/betaEnabled returns false', async () => {
const res = await exports.default.fetch(`${ORIGIN}/api/storefronts/v1/p2p/betaEnabled`)
expect(await res.json()).toBe(false)