forked from denoland/fresh
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdev_test.ts
46 lines (42 loc) · 1.14 KB
/
dev_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
import { collect } from "../src/dev/mod.ts";
import { assert, dirname, fromFileUrl, join } from "./deps.ts";
Deno.test({
name: "routes collect",
fn: async () => {
const { routes } = await collect(
join(dirname(fromFileUrl(import.meta.url)), "fixture"),
);
assert(
!routes.includes("routes/not_found.test.ts") &&
!routes.includes("routes\\not_found.test.ts"),
);
assert(
!routes.includes("routes/_404_test.tsx") &&
!routes.includes("routes\\_404_test.tsx"),
);
assert(
!routes.includes("routes/islands/test_test.tsx") &&
!routes.includes("routes\\islands\\test_test.tsx"),
);
},
});
Deno.test({
name: "routes collect with custom pattern",
fn: async () => {
const { routes } = await collect(
join(
dirname(fromFileUrl(import.meta.url)),
"fixture_router_ignore_files",
),
/[\.|_]cy\.[t|j]s(x)?$/,
);
assert(
!routes.includes("routes/index.cy.ts") &&
!routes.includes("routes\\index.cy.ts"),
);
assert(
routes.includes("routes/index.tsx") ||
routes.includes("routes\\index.tsx"),
);
},
});