mirror of
https://github.com/djdevin/recflare.git
synced 2026-09-09 07:01:27 -07:00
more routes
This commit is contained in:
@@ -57,10 +57,22 @@ const app = new Hono<App>()
|
||||
// array = no club subscription memberships (the client chokes on null).
|
||||
.get('/subscription/mine/member', (c) => c.json([]))
|
||||
|
||||
// Details for a given subscription. The client deserializes this into an
|
||||
// object, so it must return `{}` (not `[]`).
|
||||
// Subscription details for an account (numeric id) — simulated: no club, no subs.
|
||||
.get('/subscription/details/:accountId{[0-9]+}', (c) =>
|
||||
c.json({
|
||||
accountId: Number.parseInt(c.req.param('accountId'), 10),
|
||||
clubId: 0,
|
||||
subscriberCount: 0,
|
||||
})
|
||||
)
|
||||
|
||||
// Details for a named subscription (e.g. `rrplus`). The client deserializes this
|
||||
// into an object, so it must return `{}` (not `[]`).
|
||||
.get('/subscription/details/:subscription', (c) => c.json({}))
|
||||
|
||||
// Subscriber count for an account. No club subscriptions yet → 0.
|
||||
.get('/subscription/subscriberCount/:accountId{[0-9]+}', (c) => c.json(0))
|
||||
|
||||
// The player's clubs that have unread announcements (MyClubsWithUnread-
|
||||
// Announcements). No DB → empty list.
|
||||
.get('/announcements/v2/mine/unread', (c) => c.json([]))
|
||||
|
||||
@@ -56,6 +56,18 @@ describe('clubs endpoints', () => {
|
||||
expect(await res.json()).toEqual({})
|
||||
})
|
||||
|
||||
test('GET /subscription/details/:accountId returns simulated details', async () => {
|
||||
const res = await exports.default.fetch(`${ORIGIN}/subscription/details/2`)
|
||||
expect(res.status).toBe(200)
|
||||
expect(await res.json()).toEqual({ accountId: 2, clubId: 0, subscriberCount: 0 })
|
||||
})
|
||||
|
||||
test('GET /subscription/subscriberCount/:id returns 0', async () => {
|
||||
const res = await exports.default.fetch(`${ORIGIN}/subscription/subscriberCount/2`)
|
||||
expect(res.status).toBe(200)
|
||||
expect(await res.json()).toBe(0)
|
||||
})
|
||||
|
||||
test('GET /announcements/v2/mine/unread returns []', async () => {
|
||||
const res = await exports.default.fetch(`${ORIGIN}/announcements/v2/mine/unread`)
|
||||
expect(res.status).toBe(200)
|
||||
|
||||
Reference in New Issue
Block a user