web: load the news list on /aktuelt a page at a time

This commit is contained in:
ponas committed 2026-10-14 01:36:26 +02:00
1 parent 67c41e926e
commit c657afa253
6 files changed
+194 -16

No files matched your search

+18
View File
@@ -167,6 +167,24 @@ describe("events api", () => {
});
});
describe("news api", () => {
test("pages through the articles for \"load more\" on /aktuelt", async () => {
const res = await fetch(app("/api/v1/news?offset=0&limit=5"));
expect(res.status).toBe(200);
const body = (await res.json()) as {
news: Array<{ slug: string }>;
total: number;
};
expect(body.total).toBe(1);
expect(body.news.map((n) => n.slug)).toEqual([SLUGS.news]);
});
test("rejects a limit that is too large", async () => {
const res = await fetch(app("/api/v1/news?limit=1000"));
expect(res.status).toBe(400);
});
});
describe("image optimizer", () => {
test("optimizes a CMS-hosted image", async () => {
const src = encodeURIComponent(mock("/media/pig.png"));