Some stuff
ci/woodpecker/push/woodpecker Pipeline failed
Details
ci/woodpecker/push/woodpecker Pipeline failed
Details
Co-authored-by: Tymon <nomyTx@users.noreply.github.com>master
parent
b41a734cd3
commit
f97020d326
@ -1,9 +0,0 @@
|
|||||||
// deno-lint-ignore-file no-explicit-any
|
|
||||||
export default async function asyncForEach(
|
|
||||||
array: any[],
|
|
||||||
callback: (val: any, index: number, array: any[]) => Promise<void>,
|
|
||||||
) {
|
|
||||||
for (let index = 0; index < array.length; index++) {
|
|
||||||
await callback(array[index], index, array);
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,8 +1,10 @@
|
|||||||
import AO3 from "../src/classes/AO3.ts";
|
import AO3 from "../src/classes/AO3.ts";
|
||||||
import workTest from "./work.ts";
|
import workTest from "./work.ts";
|
||||||
import chaptersTest from "./chapter.ts";
|
import chaptersTest from "./chapter.ts";
|
||||||
|
import searchTest from "./search.ts";
|
||||||
|
|
||||||
const ao3 = new AO3();
|
const ao3 = new AO3();
|
||||||
|
|
||||||
await workTest(ao3);
|
await workTest(ao3);
|
||||||
await chaptersTest(ao3);
|
await chaptersTest(ao3);
|
||||||
|
await searchTest(ao3);
|
||||||
|
@ -0,0 +1,35 @@
|
|||||||
|
import AO3 from "../mod.ts";
|
||||||
|
import type { Search } from "../mod.ts";
|
||||||
|
import { assert } from "https://deno.land/std@0.167.0/testing/asserts.ts";
|
||||||
|
|
||||||
|
export default function test(ao3: AO3) {
|
||||||
|
Deno.test("searches", async (test) => {
|
||||||
|
await test.step("specific search", async () => {
|
||||||
|
const search = ao3.search({
|
||||||
|
freeform: [
|
||||||
|
"no beta we die like sammy",
|
||||||
|
"not at all your honor",
|
||||||
|
],
|
||||||
|
fandoms: ["Bendy and the Ink Machine"],
|
||||||
|
});
|
||||||
|
await search.update(0);
|
||||||
|
|
||||||
|
assert(search.results[0].id === "43251729", "incorrect work found");
|
||||||
|
});
|
||||||
|
await test.step("broad search", async () => {
|
||||||
|
const search = ao3.search({
|
||||||
|
freeform: [
|
||||||
|
"Smut",
|
||||||
|
],
|
||||||
|
});
|
||||||
|
await search.update(0);
|
||||||
|
assert(search.results.length > 10, "not enough search results");
|
||||||
|
|
||||||
|
await search.update(1);
|
||||||
|
assert(
|
||||||
|
search.results.length > 10,
|
||||||
|
"could not find second page of results",
|
||||||
|
);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
Loading…
Reference in new issue