You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
ao3-deno/tests/work.ts

51 lines
1.7 KiB

import AO3 from "../mod.ts";
import type { Work } from "../mod.ts";
import { assert } from "https://deno.land/std@0.167.0/testing/asserts.ts";
export default function test(ao3: AO3) {
Deno.test("works", async (test) => {
let work: Work;
await test.step("initialization", async () => {
work = await ao3.getWork("43251729");
await work.init();
});
await test.step("tags", async (test) => {
assert(work.tags.length > 0, "Failed to parse any tags");
await test.step("fandoms", () => {
assert(
work.tags.includes("Bendy and the Ink Machine"),
"Failed to get correct fandom tags",
);
});
await test.step("characters", () => {
assert(
work.tags.includes("Bendy (Bendy and the Ink Machine)"),
"Failed to get correct character tags",
);
});
await test.step("ships", () => {
assert(
work.tags.includes(
"Bendy (Bendy and the Ink Machine)/Reader",
),
"Failed to get correct ship tags",
);
});
await test.step("freeforms", () => {
assert(
work.tags.includes("no beta read we die like sammy"),
"Failed to get correct freeform tags",
);
});
});
await test.step("other metadata", () => {
assert(
work.name === "Inky Desires [Bendy X Reader]",
"incorrect work name",
);
});
});
}