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.
34 lines
1.0 KiB
34 lines
1.0 KiB
import Wattpad from "../mod.ts";
|
|
import type { User } from "../mod.ts";
|
|
import { assert } from "https://deno.land/std@0.167.0/testing/asserts.ts";
|
|
|
|
export default function test(watt: Wattpad) {
|
|
Deno.test("users", async (test) => {
|
|
let user: User;
|
|
await test.step("initialization", async () => {
|
|
user = watt.getUser("DustyAngel47");
|
|
await user.init();
|
|
});
|
|
|
|
await test.step("metadata", () => {
|
|
assert(
|
|
user.username === "DustyAngel47",
|
|
"incorrect username (somehow)",
|
|
);
|
|
assert(
|
|
user.displayName === "DustyAngel47",
|
|
"incorrect display name",
|
|
);
|
|
});
|
|
|
|
await test.step("stories", async () => {
|
|
await user.updateStories(0);
|
|
// FIXME: should be resistant to me publishing more than one fic
|
|
assert(
|
|
user.stories.find((story) => story.id === "327425279"),
|
|
"incorrect stories found",
|
|
);
|
|
});
|
|
});
|
|
}
|