-
-
Notifications
You must be signed in to change notification settings - Fork 75
/
pagefind.test.ts
38 lines (32 loc) 路 1012 Bytes
/
pagefind.test.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import { assertSiteSnapshot, build, getSite } from "./utils.ts";
import { assertStrictEquals } from "../deps/assert.ts";
import pagefind from "../plugins/pagefind.ts";
import downloadBinary from "../deps/pagefind.ts";
import { fromFileUrl } from "../deps/path.ts";
Deno.test("Pagefind plugin", async (t) => {
const site = getSite({
src: "pagefind",
});
site.use(pagefind());
await build(site);
await assertSiteSnapshot(t, site);
});
Deno.test("Pagefind download", async () => {
const path = fromFileUrl(import.meta.resolve("./_binary/pagefind"));
const binary = await downloadBinary({
path,
extended: true,
version: "v0.10.1",
});
if (Deno.build.os === "windows") {
assertStrictEquals(binary, path + ".exe");
} else {
assertStrictEquals(binary, path);
}
const { code, stdout } = Deno.spawnSync(binary, { args: ["--version"] });
assertStrictEquals(code, 0);
assertStrictEquals(
new TextDecoder().decode(stdout).trim(),
"pagefind 0.10.1",
);
});