generated from ryoppippi/deno-jsr-template
-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmod_test.ts
44 lines (38 loc) · 972 Bytes
/
mod_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
39
40
41
42
43
44
import { join } from "node:path";
import { assertSnapshot } from "@std/testing/snapshot";
import { preprocess } from "svelte/compiler";
import { importCSSPreprocess } from "./mod.ts";
async function load(_filename: string) {
const filename = join(
import.meta.dirname as string,
_filename,
);
const source = Deno.readTextFileSync(filename);
const { code } = await preprocess(
source,
[importCSSPreprocess()],
{ filename },
);
return code;
}
Deno.test(
"example svelte main",
async function (t) {
const code = await load("./test_project/Main.svelte");
await assertSnapshot(t, code);
},
);
Deno.test(
"example svelte partial",
async function (t) {
const code = await load("./test_project/Partial.svelte");
await assertSnapshot(t, code);
},
);
Deno.test(
"example svelte rename",
async function (t) {
const code = await load("./test_project/Rename.svelte");
await assertSnapshot(t, code);
},
);