-
Notifications
You must be signed in to change notification settings - Fork 2
/
test.ts
52 lines (47 loc) · 1.28 KB
/
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
45
46
47
48
49
50
51
52
import { assertEquals } from "@std/assert/equals";
import { join } from "@std/path";
import { asURL, instantiate, stats } from "./mod.ts";
Deno.test({
name: "generate stats - typescript base",
async fn() {
await instantiate();
const actual = await stats(
new URL("./src/fixtures/main.ts", import.meta.url),
);
assertEquals(actual.size, 4);
},
});
Deno.test({
name: "generate stats - javascript base",
async fn() {
await instantiate();
const actual = await stats(
new URL("./src/fixtures/index.js", import.meta.url),
);
assertEquals(actual.size, 4);
},
});
Deno.test({
name: "asURL - relative",
fn() {
const expected = new URL("mod.ts", import.meta.url);
const actual = asURL("./mod.ts");
assertEquals(actual.toString(), expected.toString());
},
});
Deno.test({
name: "asURL - relative base supplied",
fn() {
const expected = new URL("test/mod.ts", import.meta.url);
const actual = asURL("./mod.ts", join(Deno.cwd(), "test"));
assertEquals(actual.toString(), expected.toString());
},
});
Deno.test({
name: "asURL - absolute",
fn() {
const expected = new URL("mod.ts", import.meta.url);
const actual = asURL(join(Deno.cwd(), "./mod.ts"));
assertEquals(actual.toString(), expected.toString());
},
});