-
-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathregistries_test.ts
100 lines (97 loc) · 1.92 KB
/
registries_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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
import { tryParse } from "@molt/core/specs";
import { get as getUpdate } from "@molt/core/updates";
import { assertEquals, assertFalse } from "@std/assert";
type RegistryTestSpec = [
name: string,
url: string,
updatable: boolean,
];
const SPECS = [
[
"deno.land/std",
"https://deno.land/[email protected]/version.ts",
true,
],
[
"deno.land/x",
"https://deno.land/x/[email protected]/lib/path.ts",
true,
],
[
"npm:",
"npm:[email protected]",
true,
],
[
"jsr:",
"jsr:@std/[email protected]",
true,
],
[
"jsr.io",
"https://jsr.io/@molt/core/0.18.4/mod.ts",
false,
],
[
"cdn.jsdelivr.net/npm",
"https://cdn.jsdelivr.net/npm/[email protected]",
false,
],
[
"cdn.jsdelivr.net/gh",
"https://cdn.jsdelivr.net/gh/hasundue/molt@8a4a9a7/lib/path.ts",
false,
],
[
"cdn.skypack.dev",
"https://cdn.skypack.dev/[email protected]",
false,
],
[
"ga.jspm.io",
"https://ga.jspm.io/npm:[email protected]/development/is-server.js",
false,
],
[
"esm.run",
"https://esm.run/[email protected]",
false,
],
[
"esm.sh",
"https://esm.sh/[email protected]",
true,
],
[
"x.nest.land",
"https://x.nest.land/[email protected]/mod.ts",
false,
],
[
"pax.deno.dev",
"https://pax.deno.dev/hasundue/molt@8a4a9a7/lib/path.ts",
false,
],
[
"raw.githubusercontent.com",
"https://raw.githubusercontent.com/hasundue/molt/8a4a9a7/lib/path.ts",
false,
],
[
"unpkg.com",
"https://unpkg.com/[email protected]",
true,
],
] satisfies RegistryTestSpec[];
Deno.test("registries", async (t) => {
for (const spec of SPECS) {
await t.step("registry - " + spec[0], async () => {
const dep = tryParse(spec[1]);
if (!dep) {
return assertFalse(spec[2]);
}
const updated = await getUpdate(dep);
assertEquals(!!updated, spec[2], Deno.inspect(updated));
});
}
});