test(stats): read continue-listening books from the scroller envelope

The scroller route returns a DashboardScrollerResponse of books and total, but this spec still
parsed the body as a bare array, so it failed before reaching its assertions.
This commit is contained in:
neon
2026-09-28 22:29:44 +00:00
parent 35d5a8c2d6
commit 1be423fb54
@@ -1,7 +1,7 @@
import { randomUUID } from 'crypto'; import { randomUUID } from 'crypto';
import { and, eq } from 'drizzle-orm'; import { and, eq } from 'drizzle-orm';
import type { AudiobookManifest, AudiobookPlaybackState } from '@bookorbit/types'; import type { AudiobookManifest, AudiobookPlaybackState, DashboardScrollerResponse } from '@bookorbit/types';
import * as schema from '../src/db/schema'; import * as schema from '../src/db/schema';
import { import {
@@ -48,7 +48,7 @@ describe('Dashboard continue-listening scroller (e2e)', { timeout: SCENARIO_TIME
headers: authHeader(reader.accessToken), headers: authHeader(reader.accessToken),
}); });
expect(response.statusCode).toBe(200); expect(response.statusCode).toBe(200);
return (response.json() as Array<{ id: number }>).map((book) => book.id); return response.json<DashboardScrollerResponse>().books.map((book) => book.id);
} }
async function getReadStatus(): Promise<string | null> { async function getReadStatus(): Promise<string | null> {