From c48cefda269fc665961854094308ce7d38e967f6 Mon Sep 17 00:00:00 2001 From: Devin Zuczek Date: Tue, 13 Oct 2026 10:36:34 -0400 Subject: [PATCH] [econ] some more lil stubs --- apps/econ/src/econ.app.ts | 38 ++++++++++++++++++++++ apps/econ/src/test/integration/api.test.ts | 29 +++++++++++++++++ 2 files changed, 67 insertions(+) diff --git a/apps/econ/src/econ.app.ts b/apps/econ/src/econ.app.ts index ec16ae8..360b419 100644 --- a/apps/econ/src/econ.app.ts +++ b/apps/econ/src/econ.app.ts @@ -4817,6 +4817,44 @@ const app = new Hono({ strict: false }) }) ) + // The timed currency grant the client polls. A stub: nothing accrues or is granted yet, + // so every caller is served the one example grant below, verbatim. Takes no body. + .post( + '/api/timedCurrencyGrants/update', + describeRoute({ + tags: ['Econ'], + summary: 'The timed currency grant (stub)', + description: 'A fixed example grant — no timed grant is stored or paid out yet.', + responses: { 200: json(JsonObject, 'The timed currency grant') }, + }), + (c) => + c.json({ + TimedCurrencyGrantId: 1, + Name: 'Daily Tokens', + StartTime: '2026-10-01T00:00:00Z', + EndTime: '2026-12-01T00:00:00Z', + CurrencyType: 0, + OfflineRatePerHour: 1.0, + OnlineRatePerHour: 5.0, + ActiveExperiment: null, + }) + ) + + // The client reporting how far the player has moved, towards a distance-moved reward + // track. A stub: the form body (`distanceMeters=12.5`) is not read, nothing is tracked, + // and the answer is an empty 200. + .post( + '/api/distanceMovedRewardTracks/distance', + describeRoute({ + tags: ['Econ'], + summary: 'Report distance moved (stub)', + description: + 'Takes a form-encoded `distanceMeters` and stores nothing — no reward track exists yet.', + responses: { 200: { description: 'Empty body' } }, + }), + (c) => c.body(null, 200) + ) + // Everything a room sells, in one list: its keys, its consumables and the purchase offers // of its currencies, each as the client's 10-key `UgcPurchasableItem` with `ItemType` // saying which (0 key, 1 consumable, 3 currency pack). Asked for on every room load. A diff --git a/apps/econ/src/test/integration/api.test.ts b/apps/econ/src/test/integration/api.test.ts index 7ba74e0..70f7ca2 100644 --- a/apps/econ/src/test/integration/api.test.ts +++ b/apps/econ/src/test/integration/api.test.ts @@ -3711,6 +3711,33 @@ describe('econ endpoints', () => { }) }) + test('POST /api/timedCurrencyGrants/update serves the stub grant', async () => { + const res = await exports.default.fetch(`${ORIGIN}/api/timedCurrencyGrants/update`, { + method: 'POST', + }) + expect(res.status).toBe(200) + expect(await res.json()).toEqual({ + TimedCurrencyGrantId: 1, + Name: 'Daily Tokens', + StartTime: '2026-10-01T00:00:00Z', + EndTime: '2026-12-01T00:00:00Z', + CurrencyType: 0, + OfflineRatePerHour: 1, + OnlineRatePerHour: 5, + ActiveExperiment: null, + }) + }) + + test('POST /api/distanceMovedRewardTracks/distance is a stub: answers an empty 200', async () => { + const res = await exports.default.fetch(`${ORIGIN}/api/distanceMovedRewardTracks/distance`, { + method: 'POST', + headers: { 'Content-Type': 'application/x-www-form-urlencoded' }, + body: 'distanceMeters=12.5', + }) + expect(res.status).toBe(200) + expect(await res.text()).toBe('') + }) + test('GET /econ/roomEconConfig/:roomId echoes the room and disables sorting tabs', async () => { const anon = await exports.default.fetch(`${ORIGIN}/econ/roomEconConfig/92`) expect(anon.status).toBe(401) @@ -7348,6 +7375,7 @@ describe('econ endpoints', () => { 'POST /api/checklist/v2/complete', 'POST /api/consumables/v1/consume', 'POST /api/consumables/v1/updateActive', + 'POST /api/distanceMovedRewardTracks/distance', 'POST /api/equipment/v1/update', 'POST /api/gamerewards/v1/request', 'POST /api/influencerpartnerprogram/remove', @@ -7372,6 +7400,7 @@ describe('econ endpoints', () => { 'POST /api/storefronts/v1/PurchaseRoomKeyWithCurrency', 'POST /api/storefronts/v2/buyItem', 'POST /api/storefronts/v3/buyInvention', + 'POST /api/timedCurrencyGrants/update', 'POST /api/ugcPurchasables/v1/items/bulk', 'PUT /api/equipment/v1/update', 'PUT /api/roomconsumables/v1/roomConsumable',