Files
mangabaka-seeder/test/fixtures.test.ts
T

14 lines
877 B
TypeScript

import { expect, test } from "bun:test";
import { fixtureBytes, fixtureJson, fixtureText } from "./helpers/fixtures";
test("captured fixtures are the pages and payloads we expect", async () => {
expect(await fixtureText("webtoons/tower-of-god.html")).toContain('property="og:image"');
expect(await fixtureText("webtoons/crow-time-canvas.html")).toMatch(/isChallenge\s*:\s*true/);
expect(await fixtureText("webtoons/zombie-revelation-mature.html")).toMatch(/ageGradeNotice\s*:\s*true/);
expect(await fixtureText("wayback/tower-of-god-cdx-www.txt")).toMatch(/^2015\d{10} /m);
const page1 = await fixtureJson<{ data: unknown[]; pagination: { next: string | null } }>("mangabaka/images-9999-page1.json");
expect(page1.data.length).toBe(24);
expect(page1.pagination.next).toContain("page=2");
expect((await fixtureBytes("images/poster-95.jpg"))[0]).toBe(0xff);
});