-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.test.ts
34 lines (29 loc) · 1.18 KB
/
index.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
import {readFileSync} from "node:fs";
import {stringPlugin} from "./index.ts";
import svg from "./fixtures/test.svg";
import md from "./fixtures/test.md";
import txt from "./fixtures/test.txt";
import pdf from "./fixtures/test.pdf";
test("exists", () => {
expect(stringPlugin).toBeFunction();
});
test("svg", async () => {
const expected = readFileSync(new URL("fixtures/test.svg", import.meta.url), "utf8");
expect(svg).toEqual(expected);
expect((await import("./fixtures/test.svg")).default).toEqual(expected);
});
test("md", async () => {
const expected = readFileSync(new URL("fixtures/test.md", import.meta.url), "utf8");
expect(md).toEqual(expected);
expect((await import("./fixtures/test.md")).default).toEqual(expected);
});
test("txt", async () => {
const expected = readFileSync(new URL("fixtures/test.txt", import.meta.url), "utf8");
expect(txt).toEqual(expected);
expect((await import("./fixtures/test.txt")).default).toEqual(expected);
});
test("pdf", async () => {
const expected = readFileSync(new URL("fixtures/test.pdf", import.meta.url), "utf8");
expect(pdf).toEqual(expected);
expect((await import("./fixtures/test.pdf")).default).toEqual(expected);
});