web: load the news list on /aktuelt a page at a time
This commit is contained in:
6 files changed
+194
-16
No files matched your search
@@ -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"));
|
||||
|
||||
Reference in new issue
Block a user