-
Notifications
You must be signed in to change notification settings - Fork 17
/
registry_test.ts
109 lines (87 loc) · 3.13 KB
/
registry_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
101
102
103
104
105
106
107
108
109
import { REGISTRIES, lookup } from "./registry.ts";
import { assert, assertEquals, FakeRegistry } from "./test_deps.ts";
Deno.test("registryFakeregistry", () => {
const url = "https://fakeregistry.com/foo@0.0.1/mod.ts";
const v = lookup(url, [FakeRegistry]);
assert(v !== undefined);
const vAt = v!.at("0.0.2");
assertEquals(vAt.url, "https://fakeregistry.com/foo@0.0.2/mod.ts");
});
Deno.test("registryFakeregistryMissing", () => {
const url = "https://fakeregistry.com/foo@0.0.1/mod.ts";
const v = lookup(url, REGISTRIES);
assert(v === undefined);
});
Deno.test("registryDenolandStd", () => {
const url = "https://deno.land/std@0.35.0/foo.ts";
const v = lookup(url, REGISTRIES);
assert(v !== undefined);
const vAt = v.at("0.1.0");
assertEquals(vAt.url, "https://deno.land/std@0.1.0/foo.ts");
});
Deno.test("registryDenolandX", () => {
const url = "https://deno.land/x/foo@0.1.0/foo.ts";
const v = lookup(url, REGISTRIES);
assert(v !== undefined);
const vAt = v.at("0.2.0");
assertEquals(vAt.url, "https://deno.land/x/foo@0.2.0/foo.ts");
});
Deno.test("registryUnpkg", () => {
const url = "https://unpkg.com/foo@0.1.0/foo.ts";
const v = lookup(url, REGISTRIES);
assert(v !== undefined);
const vAt = v.at("0.2.0");
assertEquals(vAt.url, "https://unpkg.com/foo@0.2.0/foo.ts");
});
Deno.test("registryDenopkg", () => {
const url = "https://denopkg.com/bar/foo@0.1.0/foo.ts";
const v = lookup(url, REGISTRIES);
assert(v !== undefined);
const vAt = v.at("0.2.0");
assertEquals(vAt.url, "https://denopkg.com/bar/foo@0.2.0/foo.ts");
});
Deno.test("registryJspm", () => {
const url = "https://dev.jspm.io/npm:foo@0.1.0/";
const v = lookup(url, REGISTRIES);
assert(v !== undefined);
const vAt = v.at("0.2.0");
assertEquals(vAt.url, "https://dev.jspm.io/npm:foo@0.2.0/");
});
Deno.test("registryPika", () => {
const url = "https://cdn.pika.dev/foo@0.1.0/";
const v = lookup(url, REGISTRIES);
assert(v !== undefined);
const vAt = v.at("0.2.0");
assertEquals(vAt.url, "https://cdn.pika.dev/foo@0.2.0/");
});
Deno.test("registryGithubRaw", () => {
const url = "https://raw.githubusercontent.com/bar/foo/0.1.0/foo.ts";
const v = lookup(url, REGISTRIES);
assert(v !== undefined);
const vAt = v.at("0.2.0");
assertEquals(
vAt.url,
"https://raw.githubusercontent.com/bar/foo/0.2.0/foo.ts",
);
});
Deno.test("registryGitlabRaw", () => {
const url = "https://gitlab.com/bar/foo/-/raw/0.1.0/foo.ts";
const v = lookup(url, REGISTRIES);
assert(v !== undefined);
const vAt = v.at("0.2.0");
assertEquals(vAt.url, "https://gitlab.com/bar/foo/-/raw/0.2.0/foo.ts");
});
Deno.test("registryJsDelivr", () => {
const url = "https://cdn.jsdelivr.net/gh/bar/foo@0.1.0/foo.ts";
const v = lookup(url, REGISTRIES);
assert(v !== undefined);
const vAt = v.at("0.2.0");
assertEquals(vAt.url, "https://cdn.jsdelivr.net/gh/bar/foo@0.2.0/foo.ts");
});
Deno.test("registryNestLand", () => {
const url = "https://x.nest.land/foo@0.1.0/foo.ts";
const v = lookup(url, REGISTRIES);
assert(v !== undefined);
const vAt = v.at("0.2.0");
assertEquals(vAt.url, "https://x.nest.land/foo@0.2.0/foo.ts");
});