@adviser/cement 0.4.56 → 0.4.57
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cjs/cli/publish-tags-cmd.cjs +5 -2
- package/cjs/cli/publish-tags-cmd.cjs.map +1 -1
- package/cjs/cli/publish-tags-cmd.d.ts.map +1 -1
- package/cjs/crypto.cjs.map +1 -1
- package/cjs/crypto.d.ts.map +1 -1
- package/cjs/future.cjs.map +1 -1
- package/cjs/future.d.ts +1 -1
- package/cjs/future.d.ts.map +1 -1
- package/cjs/future.test.cjs +1 -1
- package/cjs/future.test.cjs.map +1 -1
- package/cjs/http_header.cjs.map +1 -1
- package/cjs/http_header.test.cjs +2 -2
- package/cjs/http_header.test.cjs.map +1 -1
- package/cjs/import-meta-env.commonjs.d.ts +1 -1
- package/cjs/import-meta-env.commonjs.d.ts.map +1 -1
- package/cjs/is-promise.cjs.map +1 -1
- package/cjs/is-promise.d.ts +1 -1
- package/cjs/is-promise.d.ts.map +1 -1
- package/cjs/logger.test.cjs +6 -0
- package/cjs/logger.test.cjs.map +1 -1
- package/cjs/lru-map-set.cjs.map +1 -1
- package/cjs/lru-map-set.d.ts.map +1 -1
- package/cjs/mutable-url.test.cjs +221 -220
- package/cjs/mutable-url.test.cjs.map +1 -1
- package/cjs/on-func.cjs +12 -12
- package/cjs/on-func.cjs.map +1 -1
- package/cjs/on-func.d.ts +4 -3
- package/cjs/on-func.d.ts.map +1 -1
- package/cjs/on-func.test.cjs +17 -2
- package/cjs/on-func.test.cjs.map +1 -1
- package/cjs/on-func.test.d.ts +26 -1
- package/cjs/on-func.test.d.ts.map +1 -1
- package/cjs/path-ops.test.cjs.map +1 -1
- package/cjs/resolve-once.cjs.map +1 -1
- package/cjs/resolve-once.d.ts.map +1 -1
- package/cjs/resolve-once.test.cjs +7 -2
- package/cjs/resolve-once.test.cjs.map +1 -1
- package/cjs/tracer.cjs.map +1 -1
- package/cjs/utils/consume.test.cjs.map +1 -1
- package/cjs/utils/sorted-object.d.ts +1 -1
- package/cjs/utils/sorted-object.d.ts.map +1 -1
- package/cjs/utils/sorted-object.test.cjs +1 -1
- package/cjs/utils/sorted-object.test.cjs.map +1 -1
- package/cjs/version.cjs +1 -1
- package/deno.json +1 -1
- package/esm/cli/publish-tags-cmd.d.ts.map +1 -1
- package/esm/cli/publish-tags-cmd.js +5 -2
- package/esm/cli/publish-tags-cmd.js.map +1 -1
- package/esm/crypto.d.ts.map +1 -1
- package/esm/crypto.js.map +1 -1
- package/esm/future.d.ts +1 -1
- package/esm/future.d.ts.map +1 -1
- package/esm/future.js.map +1 -1
- package/esm/future.test.js +1 -1
- package/esm/future.test.js.map +1 -1
- package/esm/http_header.js.map +1 -1
- package/esm/http_header.test.js +2 -2
- package/esm/http_header.test.js.map +1 -1
- package/esm/import-meta-env.module.d.ts +1 -1
- package/esm/import-meta-env.module.d.ts.map +1 -1
- package/esm/is-promise.d.ts +1 -1
- package/esm/is-promise.d.ts.map +1 -1
- package/esm/is-promise.js.map +1 -1
- package/esm/logger.test.js +6 -0
- package/esm/logger.test.js.map +1 -1
- package/esm/lru-map-set.d.ts.map +1 -1
- package/esm/lru-map-set.js.map +1 -1
- package/esm/mutable-url.test.js +1 -0
- package/esm/mutable-url.test.js.map +1 -1
- package/esm/on-func.d.ts +4 -3
- package/esm/on-func.d.ts.map +1 -1
- package/esm/on-func.js +12 -12
- package/esm/on-func.js.map +1 -1
- package/esm/on-func.test.d.ts +26 -1
- package/esm/on-func.test.d.ts.map +1 -1
- package/esm/on-func.test.js +17 -2
- package/esm/on-func.test.js.map +1 -1
- package/esm/path-ops.test.js.map +1 -1
- package/esm/resolve-once.d.ts.map +1 -1
- package/esm/resolve-once.js.map +1 -1
- package/esm/resolve-once.test.js +7 -2
- package/esm/resolve-once.test.js.map +1 -1
- package/esm/tracer.js.map +1 -1
- package/esm/utils/consume.test.js.map +1 -1
- package/esm/utils/sorted-object.d.ts +1 -1
- package/esm/utils/sorted-object.d.ts.map +1 -1
- package/esm/utils/sorted-object.test.js +1 -1
- package/esm/utils/sorted-object.test.js.map +1 -1
- package/esm/version.js +1 -1
- package/package.json +1 -1
- package/src/cli/publish-tags-cmd.ts +5 -2
- package/src/crypto.ts +0 -1
- package/src/future.ts +1 -1
- package/src/http_header.ts +2 -2
- package/src/is-promise.ts +2 -2
- package/src/lru-map-set.ts +1 -3
- package/src/on-func.ts +21 -16
- package/src/resolve-once.ts +0 -1
- package/src/tracer.ts +1 -1
- package/src/utils/sorted-object.ts +1 -1
- package/ts/cjs/cli/publish-tags-cmd.d.ts.map +1 -1
- package/ts/cjs/cli/publish-tags-cmd.js +5 -2
- package/ts/cjs/cli/publish-tags-cmd.js.map +1 -1
- package/ts/cjs/crypto.d.ts.map +1 -1
- package/ts/cjs/crypto.js.map +1 -1
- package/ts/cjs/future.d.ts +1 -1
- package/ts/cjs/future.d.ts.map +1 -1
- package/ts/cjs/future.js.map +1 -1
- package/ts/cjs/future.test.js +1 -1
- package/ts/cjs/future.test.js.map +1 -1
- package/ts/cjs/http_header.js.map +1 -1
- package/ts/cjs/http_header.test.js +2 -2
- package/ts/cjs/http_header.test.js.map +1 -1
- package/ts/cjs/import-meta-env.commonjs.d.ts +1 -1
- package/ts/cjs/import-meta-env.commonjs.d.ts.map +1 -1
- package/ts/cjs/is-promise.d.ts +1 -1
- package/ts/cjs/is-promise.d.ts.map +1 -1
- package/ts/cjs/is-promise.js.map +1 -1
- package/ts/cjs/logger.test.js +6 -0
- package/ts/cjs/logger.test.js.map +1 -1
- package/ts/cjs/lru-map-set.d.ts.map +1 -1
- package/ts/cjs/lru-map-set.js.map +1 -1
- package/ts/cjs/mutable-url.test.js +221 -220
- package/ts/cjs/mutable-url.test.js.map +1 -1
- package/ts/cjs/on-func.d.ts +4 -3
- package/ts/cjs/on-func.d.ts.map +1 -1
- package/ts/cjs/on-func.js +12 -12
- package/ts/cjs/on-func.js.map +1 -1
- package/ts/cjs/on-func.test.d.ts +26 -1
- package/ts/cjs/on-func.test.d.ts.map +1 -1
- package/ts/cjs/on-func.test.js +17 -2
- package/ts/cjs/on-func.test.js.map +1 -1
- package/ts/cjs/path-ops.test.js.map +1 -1
- package/ts/cjs/resolve-once.d.ts.map +1 -1
- package/ts/cjs/resolve-once.js.map +1 -1
- package/ts/cjs/resolve-once.test.js +7 -2
- package/ts/cjs/resolve-once.test.js.map +1 -1
- package/ts/cjs/tracer.js.map +1 -1
- package/ts/cjs/utils/consume.test.js.map +1 -1
- package/ts/cjs/utils/sorted-object.d.ts +1 -1
- package/ts/cjs/utils/sorted-object.d.ts.map +1 -1
- package/ts/cjs/utils/sorted-object.test.js +1 -1
- package/ts/cjs/utils/sorted-object.test.js.map +1 -1
- package/ts/cjs/version.js +1 -1
- package/ts/esm/cli/publish-tags-cmd.d.ts.map +1 -1
- package/ts/esm/cli/publish-tags-cmd.js +5 -2
- package/ts/esm/cli/publish-tags-cmd.js.map +1 -1
- package/ts/esm/crypto.d.ts.map +1 -1
- package/ts/esm/crypto.js.map +1 -1
- package/ts/esm/future.d.ts +1 -1
- package/ts/esm/future.d.ts.map +1 -1
- package/ts/esm/future.js.map +1 -1
- package/ts/esm/future.test.js +1 -1
- package/ts/esm/future.test.js.map +1 -1
- package/ts/esm/http_header.js.map +1 -1
- package/ts/esm/http_header.test.js +2 -2
- package/ts/esm/http_header.test.js.map +1 -1
- package/ts/esm/import-meta-env.module.d.ts +1 -1
- package/ts/esm/import-meta-env.module.d.ts.map +1 -1
- package/ts/esm/is-promise.d.ts +1 -1
- package/ts/esm/is-promise.d.ts.map +1 -1
- package/ts/esm/is-promise.js.map +1 -1
- package/ts/esm/logger.test.js +6 -0
- package/ts/esm/logger.test.js.map +1 -1
- package/ts/esm/lru-map-set.d.ts.map +1 -1
- package/ts/esm/lru-map-set.js.map +1 -1
- package/ts/esm/mutable-url.test.js +1 -0
- package/ts/esm/mutable-url.test.js.map +1 -1
- package/ts/esm/on-func.d.ts +4 -3
- package/ts/esm/on-func.d.ts.map +1 -1
- package/ts/esm/on-func.js +12 -12
- package/ts/esm/on-func.js.map +1 -1
- package/ts/esm/on-func.test.d.ts +26 -1
- package/ts/esm/on-func.test.d.ts.map +1 -1
- package/ts/esm/on-func.test.js +17 -2
- package/ts/esm/on-func.test.js.map +1 -1
- package/ts/esm/path-ops.test.js.map +1 -1
- package/ts/esm/resolve-once.d.ts.map +1 -1
- package/ts/esm/resolve-once.js.map +1 -1
- package/ts/esm/resolve-once.test.js +7 -2
- package/ts/esm/resolve-once.test.js.map +1 -1
- package/ts/esm/tracer.js.map +1 -1
- package/ts/esm/utils/consume.test.js.map +1 -1
- package/ts/esm/utils/sorted-object.d.ts +1 -1
- package/ts/esm/utils/sorted-object.d.ts.map +1 -1
- package/ts/esm/utils/sorted-object.test.js +1 -1
- package/ts/esm/utils/sorted-object.test.js.map +1 -1
- package/ts/esm/version.js +1 -1
- package/tsconfig.json +1 -0
|
@@ -1,329 +1,330 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const mutable_url_js_1 = require("./mutable-url.js");
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
const vitest_1 = require("vitest");
|
|
5
|
+
(0, vitest_1.describe)("URLSearchParamsEntries", () => {
|
|
6
|
+
(0, vitest_1.it)("should iterate over URLSearchParams entries", () => {
|
|
6
7
|
const params = new URLSearchParams();
|
|
7
8
|
params.set("key1", "value1");
|
|
8
9
|
params.set("key2", "value2");
|
|
9
10
|
const entries = Array.from((0, mutable_url_js_1.URLSearchParamsEntries)(params));
|
|
10
|
-
expect(entries).toEqual([
|
|
11
|
+
(0, vitest_1.expect)(entries).toEqual([
|
|
11
12
|
["key1", "value1"],
|
|
12
13
|
["key2", "value2"],
|
|
13
14
|
]);
|
|
14
15
|
});
|
|
15
|
-
it("should handle empty URLSearchParams", () => {
|
|
16
|
+
(0, vitest_1.it)("should handle empty URLSearchParams", () => {
|
|
16
17
|
const params = new URLSearchParams();
|
|
17
18
|
const entries = Array.from((0, mutable_url_js_1.URLSearchParamsEntries)(params));
|
|
18
|
-
expect(entries).toEqual([]);
|
|
19
|
+
(0, vitest_1.expect)(entries).toEqual([]);
|
|
19
20
|
});
|
|
20
|
-
it("should handle multiple values for same key", () => {
|
|
21
|
+
(0, vitest_1.it)("should handle multiple values for same key", () => {
|
|
21
22
|
const params = new URLSearchParams();
|
|
22
23
|
params.append("key", "value1");
|
|
23
24
|
params.append("key", "value2");
|
|
24
25
|
const entries = Array.from((0, mutable_url_js_1.URLSearchParamsEntries)(params));
|
|
25
|
-
expect(entries.length).toBeGreaterThan(0);
|
|
26
|
-
expect(entries.some(([k, v]) => k === "key" && (v === "value1" || v === "value2"))).toBe(true);
|
|
26
|
+
(0, vitest_1.expect)(entries.length).toBeGreaterThan(0);
|
|
27
|
+
(0, vitest_1.expect)(entries.some(([k, v]) => k === "key" && (v === "value1" || v === "value2"))).toBe(true);
|
|
27
28
|
});
|
|
28
29
|
});
|
|
29
|
-
describe("ReadonlyURL", () => {
|
|
30
|
-
describe("constructor and basic properties", () => {
|
|
31
|
-
it("should create ReadonlyURL with http protocol", () => {
|
|
30
|
+
(0, vitest_1.describe)("ReadonlyURL", () => {
|
|
31
|
+
(0, vitest_1.describe)("constructor and basic properties", () => {
|
|
32
|
+
(0, vitest_1.it)("should create ReadonlyURL with http protocol", () => {
|
|
32
33
|
const url = mutable_url_js_1.ReadonlyURL.fromThrow("http://example.com/path");
|
|
33
|
-
expect(url.protocol).toBe("http:");
|
|
34
|
-
expect(url.hostname).toBe("example.com");
|
|
35
|
-
expect(url.pathname).toBe("/path");
|
|
34
|
+
(0, vitest_1.expect)(url.protocol).toBe("http:");
|
|
35
|
+
(0, vitest_1.expect)(url.hostname).toBe("example.com");
|
|
36
|
+
(0, vitest_1.expect)(url.pathname).toBe("/path");
|
|
36
37
|
});
|
|
37
|
-
it("should create ReadonlyURL with https protocol", () => {
|
|
38
|
+
(0, vitest_1.it)("should create ReadonlyURL with https protocol", () => {
|
|
38
39
|
const url = mutable_url_js_1.ReadonlyURL.fromThrow("https://example.com:8080/path");
|
|
39
|
-
expect(url.protocol).toBe("https:");
|
|
40
|
-
expect(url.hostname).toBe("example.com");
|
|
41
|
-
expect(url.port).toBe("8080");
|
|
42
|
-
expect(url.pathname).toBe("/path");
|
|
40
|
+
(0, vitest_1.expect)(url.protocol).toBe("https:");
|
|
41
|
+
(0, vitest_1.expect)(url.hostname).toBe("example.com");
|
|
42
|
+
(0, vitest_1.expect)(url.port).toBe("8080");
|
|
43
|
+
(0, vitest_1.expect)(url.pathname).toBe("/path");
|
|
43
44
|
});
|
|
44
|
-
it("should create ReadonlyURL with custom protocol without host part", () => {
|
|
45
|
+
(0, vitest_1.it)("should create ReadonlyURL with custom protocol without host part", () => {
|
|
45
46
|
const url = mutable_url_js_1.ReadonlyURL.fromThrow("file://path/to/file");
|
|
46
|
-
expect(url.protocol).toBe("file:");
|
|
47
|
-
expect(url.pathname).toBe("path/to/file");
|
|
47
|
+
(0, vitest_1.expect)(url.protocol).toBe("file:");
|
|
48
|
+
(0, vitest_1.expect)(url.pathname).toBe("path/to/file");
|
|
48
49
|
});
|
|
49
|
-
it("should throw error for invalid URL", () => {
|
|
50
|
-
expect(() => mutable_url_js_1.ReadonlyURL.fromThrow("invalid-url")).toThrow();
|
|
50
|
+
(0, vitest_1.it)("should throw error for invalid URL", () => {
|
|
51
|
+
(0, vitest_1.expect)(() => mutable_url_js_1.ReadonlyURL.fromThrow("invalid-url")).toThrow();
|
|
51
52
|
});
|
|
52
53
|
});
|
|
53
|
-
describe("readonly setters", () => {
|
|
54
|
+
(0, vitest_1.describe)("readonly setters", () => {
|
|
54
55
|
let url;
|
|
55
|
-
beforeEach(() => {
|
|
56
|
+
(0, vitest_1.beforeEach)(() => {
|
|
56
57
|
url = mutable_url_js_1.ReadonlyURL.fromThrow("http://example.com/path");
|
|
57
58
|
});
|
|
58
|
-
it("should throw error when setting origin", () => {
|
|
59
|
-
expect(() => {
|
|
59
|
+
(0, vitest_1.it)("should throw error when setting origin", () => {
|
|
60
|
+
(0, vitest_1.expect)(() => {
|
|
60
61
|
url.origin = "http://other.com";
|
|
61
62
|
}).toThrow("origin is readonly");
|
|
62
63
|
});
|
|
63
|
-
it("should throw error when setting href", () => {
|
|
64
|
-
expect(() => {
|
|
64
|
+
(0, vitest_1.it)("should throw error when setting href", () => {
|
|
65
|
+
(0, vitest_1.expect)(() => {
|
|
65
66
|
url.href = "http://other.com";
|
|
66
67
|
}).toThrow("href is readonly");
|
|
67
68
|
});
|
|
68
|
-
it("should throw error when setting password", () => {
|
|
69
|
-
expect(() => {
|
|
69
|
+
(0, vitest_1.it)("should throw error when setting password", () => {
|
|
70
|
+
(0, vitest_1.expect)(() => {
|
|
70
71
|
url.password = "pass";
|
|
71
72
|
}).toThrow("password is readonly");
|
|
72
73
|
});
|
|
73
|
-
it("should throw error when setting username", () => {
|
|
74
|
-
expect(() => {
|
|
74
|
+
(0, vitest_1.it)("should throw error when setting username", () => {
|
|
75
|
+
(0, vitest_1.expect)(() => {
|
|
75
76
|
url.username = "user";
|
|
76
77
|
}).toThrow("username is readonly");
|
|
77
78
|
});
|
|
78
|
-
it("should throw error when setting hash", () => {
|
|
79
|
-
expect(() => {
|
|
79
|
+
(0, vitest_1.it)("should throw error when setting hash", () => {
|
|
80
|
+
(0, vitest_1.expect)(() => {
|
|
80
81
|
url.hash = "#test";
|
|
81
82
|
}).toThrow("hash is readonly");
|
|
82
83
|
});
|
|
83
|
-
it("should throw error when setting host", () => {
|
|
84
|
-
expect(() => {
|
|
84
|
+
(0, vitest_1.it)("should throw error when setting host", () => {
|
|
85
|
+
(0, vitest_1.expect)(() => {
|
|
85
86
|
url.host = "other.com";
|
|
86
87
|
}).toThrow("host is readonly");
|
|
87
88
|
});
|
|
88
|
-
it("should throw error when setting hostname", () => {
|
|
89
|
-
expect(() => {
|
|
89
|
+
(0, vitest_1.it)("should throw error when setting hostname", () => {
|
|
90
|
+
(0, vitest_1.expect)(() => {
|
|
90
91
|
url.hostname = "other.com";
|
|
91
92
|
}).toThrow("hostname is readonly");
|
|
92
93
|
});
|
|
93
|
-
it("should throw error when setting pathname", () => {
|
|
94
|
-
expect(() => {
|
|
94
|
+
(0, vitest_1.it)("should throw error when setting pathname", () => {
|
|
95
|
+
(0, vitest_1.expect)(() => {
|
|
95
96
|
url.pathname = "/other";
|
|
96
97
|
}).toThrow("pathname is readonly");
|
|
97
98
|
});
|
|
98
|
-
it("should throw error when setting port", () => {
|
|
99
|
-
expect(() => {
|
|
99
|
+
(0, vitest_1.it)("should throw error when setting port", () => {
|
|
100
|
+
(0, vitest_1.expect)(() => {
|
|
100
101
|
url.port = "8080";
|
|
101
102
|
}).toThrow("port is readonly");
|
|
102
103
|
});
|
|
103
|
-
it("should throw error when setting protocol", () => {
|
|
104
|
-
expect(() => {
|
|
104
|
+
(0, vitest_1.it)("should throw error when setting protocol", () => {
|
|
105
|
+
(0, vitest_1.expect)(() => {
|
|
105
106
|
url.protocol = "https:";
|
|
106
107
|
}).toThrow("protocol is readonly");
|
|
107
108
|
});
|
|
108
|
-
it("should throw error when setting search", () => {
|
|
109
|
-
expect(() => {
|
|
109
|
+
(0, vitest_1.it)("should throw error when setting search", () => {
|
|
110
|
+
(0, vitest_1.expect)(() => {
|
|
110
111
|
url.search = "?test=1";
|
|
111
112
|
}).toThrow("search is readonly");
|
|
112
113
|
});
|
|
113
|
-
it("should throw error when setting searchParams", () => {
|
|
114
|
-
expect(() => {
|
|
114
|
+
(0, vitest_1.it)("should throw error when setting searchParams", () => {
|
|
115
|
+
(0, vitest_1.expect)(() => {
|
|
115
116
|
url.searchParams = new URLSearchParams();
|
|
116
117
|
}).toThrow("searchParams is readonly");
|
|
117
118
|
});
|
|
118
119
|
});
|
|
119
|
-
describe("host-related properties for non-host protocols", () => {
|
|
120
|
+
(0, vitest_1.describe)("host-related properties for non-host protocols", () => {
|
|
120
121
|
let url;
|
|
121
|
-
beforeEach(() => {
|
|
122
|
+
(0, vitest_1.beforeEach)(() => {
|
|
122
123
|
url = mutable_url_js_1.ReadonlyURL.fromThrow("file://path/to/file");
|
|
123
124
|
});
|
|
124
|
-
it("should throw error when accessing host for non-host protocol", () => {
|
|
125
|
-
expect(() => url.host).toThrow("you can use hostname only if protocol is");
|
|
125
|
+
(0, vitest_1.it)("should throw error when accessing host for non-host protocol", () => {
|
|
126
|
+
(0, vitest_1.expect)(() => url.host).toThrow("you can use hostname only if protocol is");
|
|
126
127
|
});
|
|
127
|
-
it("should throw error when accessing hostname for non-host protocol", () => {
|
|
128
|
-
expect(() => url.hostname).toThrow("you can use hostname only if protocol is");
|
|
128
|
+
(0, vitest_1.it)("should throw error when accessing hostname for non-host protocol", () => {
|
|
129
|
+
(0, vitest_1.expect)(() => url.hostname).toThrow("you can use hostname only if protocol is");
|
|
129
130
|
});
|
|
130
|
-
it("should throw error when accessing port for non-host protocol", () => {
|
|
131
|
-
expect(() => url.port).toThrow("you can use hostname only if protocol is");
|
|
131
|
+
(0, vitest_1.it)("should throw error when accessing port for non-host protocol", () => {
|
|
132
|
+
(0, vitest_1.expect)(() => url.port).toThrow("you can use hostname only if protocol is");
|
|
132
133
|
});
|
|
133
134
|
});
|
|
134
|
-
describe("search and searchParams", () => {
|
|
135
|
-
it("should handle empty search params", () => {
|
|
135
|
+
(0, vitest_1.describe)("search and searchParams", () => {
|
|
136
|
+
(0, vitest_1.it)("should handle empty search params", () => {
|
|
136
137
|
const url = mutable_url_js_1.ReadonlyURL.fromThrow("http://example.com/path");
|
|
137
|
-
expect(url.search).toBe("");
|
|
138
|
+
(0, vitest_1.expect)(url.search).toBe("");
|
|
138
139
|
});
|
|
139
|
-
it("should handle search params", () => {
|
|
140
|
+
(0, vitest_1.it)("should handle search params", () => {
|
|
140
141
|
const url = mutable_url_js_1.ReadonlyURL.fromThrow("http://example.com/path?b=2&a=1");
|
|
141
|
-
expect(url.search).toBe("?a=1&b=2");
|
|
142
|
+
(0, vitest_1.expect)(url.search).toBe("?a=1&b=2");
|
|
142
143
|
});
|
|
143
|
-
it("should encode search param values", () => {
|
|
144
|
+
(0, vitest_1.it)("should encode search param values", () => {
|
|
144
145
|
const url = mutable_url_js_1.ReadonlyURL.fromThrow("http://example.com/path");
|
|
145
146
|
url.searchParams.set("key", "value with spaces");
|
|
146
|
-
expect(url.search).toBe("?key=value%20with%20spaces");
|
|
147
|
+
(0, vitest_1.expect)(url.search).toBe("?key=value%20with%20spaces");
|
|
147
148
|
});
|
|
148
149
|
});
|
|
149
|
-
describe("toString", () => {
|
|
150
|
-
it("should return correct string for host-based URL", () => {
|
|
150
|
+
(0, vitest_1.describe)("toString", () => {
|
|
151
|
+
(0, vitest_1.it)("should return correct string for host-based URL", () => {
|
|
151
152
|
const url = mutable_url_js_1.ReadonlyURL.fromThrow("http://example.com:8080/path?a=1#hash");
|
|
152
|
-
expect(url.toString()).toBe("http://example.com:8080/path?a=1#hash");
|
|
153
|
+
(0, vitest_1.expect)(url.toString()).toBe("http://example.com:8080/path?a=1#hash");
|
|
153
154
|
});
|
|
154
|
-
it("should return correct string for non-host URL", () => {
|
|
155
|
+
(0, vitest_1.it)("should return correct string for non-host URL", () => {
|
|
155
156
|
const url = mutable_url_js_1.ReadonlyURL.fromThrow("file://path/to/file");
|
|
156
|
-
expect(url.toString()).toBe("file://path/to/file");
|
|
157
|
+
(0, vitest_1.expect)(url.toString()).toBe("file://path/to/file");
|
|
157
158
|
});
|
|
158
|
-
it("should handle URL without leading slash in pathname", () => {
|
|
159
|
+
(0, vitest_1.it)("should handle URL without leading slash in pathname", () => {
|
|
159
160
|
const url = mutable_url_js_1.ReadonlyURL.fromThrow("http://example.com");
|
|
160
|
-
expect(url.toString()).toContain("http://example.com/");
|
|
161
|
+
(0, vitest_1.expect)(url.toString()).toContain("http://example.com/");
|
|
161
162
|
});
|
|
162
163
|
});
|
|
163
|
-
describe("utility methods", () => {
|
|
164
|
+
(0, vitest_1.describe)("utility methods", () => {
|
|
164
165
|
let url;
|
|
165
|
-
beforeEach(() => {
|
|
166
|
+
(0, vitest_1.beforeEach)(() => {
|
|
166
167
|
url = mutable_url_js_1.ReadonlyURL.fromThrow("http://example.com/path");
|
|
167
168
|
});
|
|
168
|
-
it("test serialization", () => {
|
|
169
|
+
(0, vitest_1.it)("test serialization", () => {
|
|
169
170
|
const url = mutable_url_js_1.ReadonlyURL.fromThrow("http://example.com/path");
|
|
170
|
-
expect(JSON.stringify(url)).toBe(`"${url.toString()}"`);
|
|
171
|
+
(0, vitest_1.expect)(JSON.stringify(url)).toBe(`"${url.toString()}"`);
|
|
171
172
|
});
|
|
172
|
-
it("should return JSON string", () => {
|
|
173
|
-
expect(url.toJSON()).toBe(url.toString());
|
|
173
|
+
(0, vitest_1.it)("should return JSON string", () => {
|
|
174
|
+
(0, vitest_1.expect)(url.toJSON()).toBe(url.toString());
|
|
174
175
|
});
|
|
175
|
-
it("should return string for custom inspect", () => {
|
|
176
|
+
(0, vitest_1.it)("should return string for custom inspect", () => {
|
|
176
177
|
const customInspectSymbol = Symbol.for("nodejs.util.inspect.custom");
|
|
177
|
-
expect(url[customInspectSymbol]()).toBe(url.toString());
|
|
178
|
+
(0, vitest_1.expect)(url[customInspectSymbol]()).toBe(url.toString());
|
|
178
179
|
});
|
|
179
|
-
it("should clone and return same instance", () => {
|
|
180
|
+
(0, vitest_1.it)("should clone and return same instance", () => {
|
|
180
181
|
const cloned = url.clone();
|
|
181
|
-
expect(cloned).toBe(url);
|
|
182
|
+
(0, vitest_1.expect)(cloned).toBe(url);
|
|
182
183
|
});
|
|
183
184
|
});
|
|
184
185
|
});
|
|
185
|
-
describe("WritableURL", () => {
|
|
186
|
-
describe("static factory methods", () => {
|
|
187
|
-
it("should create WritableURL with fromThrow", () => {
|
|
186
|
+
(0, vitest_1.describe)("WritableURL", () => {
|
|
187
|
+
(0, vitest_1.describe)("static factory methods", () => {
|
|
188
|
+
(0, vitest_1.it)("should create WritableURL with fromThrow", () => {
|
|
188
189
|
const url = mutable_url_js_1.WritableURL.fromThrow("http://example.com/path");
|
|
189
|
-
expect(url).toBeInstanceOf(mutable_url_js_1.WritableURL);
|
|
190
|
-
expect(url.toString()).toBe("http://example.com/path");
|
|
190
|
+
(0, vitest_1.expect)(url).toBeInstanceOf(mutable_url_js_1.WritableURL);
|
|
191
|
+
(0, vitest_1.expect)(url.toString()).toBe("http://example.com/path");
|
|
191
192
|
});
|
|
192
|
-
it("should throw error with fromThrow for invalid URL", () => {
|
|
193
|
-
expect(() => mutable_url_js_1.WritableURL.fromThrow("invalid-url")).toThrow();
|
|
193
|
+
(0, vitest_1.it)("should throw error with fromThrow for invalid URL", () => {
|
|
194
|
+
(0, vitest_1.expect)(() => mutable_url_js_1.WritableURL.fromThrow("invalid-url")).toThrow();
|
|
194
195
|
});
|
|
195
|
-
it("should create Result.Ok with from for valid URL", () => {
|
|
196
|
+
(0, vitest_1.it)("should create Result.Ok with from for valid URL", () => {
|
|
196
197
|
const result = mutable_url_js_1.WritableURL.from("http://example.com/path");
|
|
197
|
-
expect(result.isOk()).toBe(true);
|
|
198
|
-
expect(result.Ok()).toBeInstanceOf(mutable_url_js_1.WritableURL);
|
|
198
|
+
(0, vitest_1.expect)(result.isOk()).toBe(true);
|
|
199
|
+
(0, vitest_1.expect)(result.Ok()).toBeInstanceOf(mutable_url_js_1.WritableURL);
|
|
199
200
|
});
|
|
200
|
-
it("should create Result.Err with from for invalid URL", () => {
|
|
201
|
+
(0, vitest_1.it)("should create Result.Err with from for invalid URL", () => {
|
|
201
202
|
const result = mutable_url_js_1.WritableURL.from("invalid-url");
|
|
202
|
-
expect(result.isErr()).toBe(true);
|
|
203
|
-
expect(result.Err().message).toContain("Invalid URL");
|
|
203
|
+
(0, vitest_1.expect)(result.isErr()).toBe(true);
|
|
204
|
+
(0, vitest_1.expect)(result.Err().message).toContain("Invalid URL");
|
|
204
205
|
});
|
|
205
206
|
});
|
|
206
|
-
describe("mutable setters", () => {
|
|
207
|
+
(0, vitest_1.describe)("mutable setters", () => {
|
|
207
208
|
let url;
|
|
208
|
-
beforeEach(() => {
|
|
209
|
+
(0, vitest_1.beforeEach)(() => {
|
|
209
210
|
url = mutable_url_js_1.WritableURL.fromThrow("http://example.com/path");
|
|
210
211
|
});
|
|
211
|
-
it("should throw error when setting origin", () => {
|
|
212
|
-
expect(() => {
|
|
212
|
+
(0, vitest_1.it)("should throw error when setting origin", () => {
|
|
213
|
+
(0, vitest_1.expect)(() => {
|
|
213
214
|
url.origin = "http://other.com";
|
|
214
215
|
}).toThrow("don't use origin");
|
|
215
216
|
});
|
|
216
|
-
it("should set href", () => {
|
|
217
|
-
expect(() => {
|
|
217
|
+
(0, vitest_1.it)("should set href", () => {
|
|
218
|
+
(0, vitest_1.expect)(() => {
|
|
218
219
|
url.href = "http://other.com/other";
|
|
219
220
|
}).toThrow("don't use href");
|
|
220
221
|
});
|
|
221
|
-
it("should set password", () => {
|
|
222
|
+
(0, vitest_1.it)("should set password", () => {
|
|
222
223
|
url.password = "newpass";
|
|
223
|
-
expect(url.password).toBe("newpass");
|
|
224
|
+
(0, vitest_1.expect)(url.password).toBe("newpass");
|
|
224
225
|
});
|
|
225
|
-
it("should set username", () => {
|
|
226
|
+
(0, vitest_1.it)("should set username", () => {
|
|
226
227
|
url.username = "newuser";
|
|
227
|
-
expect(url.username).toBe("newuser");
|
|
228
|
+
(0, vitest_1.expect)(url.username).toBe("newuser");
|
|
228
229
|
});
|
|
229
|
-
it("should set hash", () => {
|
|
230
|
+
(0, vitest_1.it)("should set hash", () => {
|
|
230
231
|
url.hash = "#newhash";
|
|
231
|
-
expect(url.hash).toBe("#newhash");
|
|
232
|
+
(0, vitest_1.expect)(url.hash).toBe("#newhash");
|
|
232
233
|
});
|
|
233
|
-
it("should set host", () => {
|
|
234
|
+
(0, vitest_1.it)("should set host", () => {
|
|
234
235
|
url.host = "other.com:9000";
|
|
235
|
-
expect(url.host).toBe("other.com:9000");
|
|
236
|
+
(0, vitest_1.expect)(url.host).toBe("other.com:9000");
|
|
236
237
|
});
|
|
237
|
-
it("should set hostname", () => {
|
|
238
|
+
(0, vitest_1.it)("should set hostname", () => {
|
|
238
239
|
url.hostname = "other.com";
|
|
239
|
-
expect(url.hostname).toBe("other.com");
|
|
240
|
+
(0, vitest_1.expect)(url.hostname).toBe("other.com");
|
|
240
241
|
});
|
|
241
|
-
it("should set pathname", () => {
|
|
242
|
+
(0, vitest_1.it)("should set pathname", () => {
|
|
242
243
|
url.pathname = "/newpath";
|
|
243
|
-
expect(url.pathname).toBe("/newpath");
|
|
244
|
+
(0, vitest_1.expect)(url.pathname).toBe("/newpath");
|
|
244
245
|
});
|
|
245
|
-
it("should set port", () => {
|
|
246
|
+
(0, vitest_1.it)("should set port", () => {
|
|
246
247
|
url.port = "9000";
|
|
247
|
-
expect(url.port).toBe("9000");
|
|
248
|
+
(0, vitest_1.expect)(url.port).toBe("9000");
|
|
248
249
|
});
|
|
249
|
-
it("should set protocol with colon", () => {
|
|
250
|
+
(0, vitest_1.it)("should set protocol with colon", () => {
|
|
250
251
|
url.protocol = "https:";
|
|
251
|
-
expect(url.protocol).toBe("https:");
|
|
252
|
+
(0, vitest_1.expect)(url.protocol).toBe("https:");
|
|
252
253
|
});
|
|
253
|
-
it("should set protocol without colon", () => {
|
|
254
|
+
(0, vitest_1.it)("should set protocol without colon", () => {
|
|
254
255
|
url.protocol = "https";
|
|
255
|
-
expect(url.protocol).toBe("https:");
|
|
256
|
+
(0, vitest_1.expect)(url.protocol).toBe("https:");
|
|
256
257
|
});
|
|
257
|
-
it("should set search", () => {
|
|
258
|
+
(0, vitest_1.it)("should set search", () => {
|
|
258
259
|
url.search = "?new=param";
|
|
259
|
-
expect(url.search).toBe("?new=param");
|
|
260
|
+
(0, vitest_1.expect)(url.search).toBe("?new=param");
|
|
260
261
|
});
|
|
261
|
-
it("should verify state change when setting username and password", () => {
|
|
262
|
+
(0, vitest_1.it)("should verify state change when setting username and password", () => {
|
|
262
263
|
url.username = "testuser";
|
|
263
264
|
url.password = "testpass";
|
|
264
|
-
expect(url.username).toBe("testuser");
|
|
265
|
-
expect(url.password).toBe("testpass");
|
|
266
|
-
expect(url.href).toContain("testuser:testpass@");
|
|
265
|
+
(0, vitest_1.expect)(url.username).toBe("testuser");
|
|
266
|
+
(0, vitest_1.expect)(url.password).toBe("testpass");
|
|
267
|
+
(0, vitest_1.expect)(url.href).toContain("testuser:testpass@");
|
|
267
268
|
});
|
|
268
|
-
it("should verify state change when setting empty values", () => {
|
|
269
|
+
(0, vitest_1.it)("should verify state change when setting empty values", () => {
|
|
269
270
|
url.hash = "#test";
|
|
270
271
|
url.search = "?test=value";
|
|
271
|
-
expect(url.hash).toBe("#test");
|
|
272
|
-
expect(url.search).toBe("?test=value");
|
|
272
|
+
(0, vitest_1.expect)(url.hash).toBe("#test");
|
|
273
|
+
(0, vitest_1.expect)(url.search).toBe("?test=value");
|
|
273
274
|
url.hash = "";
|
|
274
275
|
url.search = "";
|
|
275
|
-
expect(url.hash).toBe("");
|
|
276
|
-
expect(url.search).toBe("");
|
|
276
|
+
(0, vitest_1.expect)(url.hash).toBe("");
|
|
277
|
+
(0, vitest_1.expect)(url.search).toBe("");
|
|
277
278
|
});
|
|
278
279
|
});
|
|
279
|
-
describe("host-related setters for non-host protocols", () => {
|
|
280
|
+
(0, vitest_1.describe)("host-related setters for non-host protocols", () => {
|
|
280
281
|
let url;
|
|
281
|
-
beforeEach(() => {
|
|
282
|
+
(0, vitest_1.beforeEach)(() => {
|
|
282
283
|
url = mutable_url_js_1.WritableURL.fromThrow("file://path/to/file");
|
|
283
284
|
});
|
|
284
|
-
it("should throw error when setting hostname for non-host protocol", () => {
|
|
285
|
-
expect(() => {
|
|
285
|
+
(0, vitest_1.it)("should throw error when setting hostname for non-host protocol", () => {
|
|
286
|
+
(0, vitest_1.expect)(() => {
|
|
286
287
|
url.hostname = "example.com";
|
|
287
288
|
}).toThrow("you can use hostname only if protocol is");
|
|
288
289
|
});
|
|
289
|
-
it("should throw error when setting port for non-host protocol", () => {
|
|
290
|
-
expect(() => {
|
|
290
|
+
(0, vitest_1.it)("should throw error when setting port for non-host protocol", () => {
|
|
291
|
+
(0, vitest_1.expect)(() => {
|
|
291
292
|
url.port = "8080";
|
|
292
293
|
}).toThrow("you can use port only if protocol is");
|
|
293
294
|
});
|
|
294
295
|
});
|
|
295
|
-
describe("searchParams setter", () => {
|
|
296
|
+
(0, vitest_1.describe)("searchParams setter", () => {
|
|
296
297
|
let url;
|
|
297
|
-
beforeEach(() => {
|
|
298
|
+
(0, vitest_1.beforeEach)(() => {
|
|
298
299
|
url = mutable_url_js_1.WritableURL.fromThrow("http://example.com/path?existing=param");
|
|
299
300
|
});
|
|
300
|
-
it("should replace searchParams completely", () => {
|
|
301
|
+
(0, vitest_1.it)("should replace searchParams completely", () => {
|
|
301
302
|
const originalSearch = url.search;
|
|
302
303
|
const newParams = new URLSearchParams();
|
|
303
304
|
newParams.set("new", "value");
|
|
304
305
|
newParams.set("another", "param");
|
|
305
306
|
url.searchParams = newParams;
|
|
306
|
-
expect(url.searchParams.get("new")).toBe("value");
|
|
307
|
-
expect(url.searchParams.get("another")).toBe("param");
|
|
308
|
-
expect(url.searchParams.get("existing")).toBeNull();
|
|
309
|
-
expect(url.search).not.toBe(originalSearch);
|
|
310
|
-
expect(url.search).toContain("new=value");
|
|
311
|
-
expect(url.search).toContain("another=param");
|
|
312
|
-
});
|
|
313
|
-
it("should handle empty searchParams", () => {
|
|
307
|
+
(0, vitest_1.expect)(url.searchParams.get("new")).toBe("value");
|
|
308
|
+
(0, vitest_1.expect)(url.searchParams.get("another")).toBe("param");
|
|
309
|
+
(0, vitest_1.expect)(url.searchParams.get("existing")).toBeNull();
|
|
310
|
+
(0, vitest_1.expect)(url.search).not.toBe(originalSearch);
|
|
311
|
+
(0, vitest_1.expect)(url.search).toContain("new=value");
|
|
312
|
+
(0, vitest_1.expect)(url.search).toContain("another=param");
|
|
313
|
+
});
|
|
314
|
+
(0, vitest_1.it)("should handle empty searchParams", () => {
|
|
314
315
|
const originalSearch = url.search;
|
|
315
316
|
url.searchParams = new URLSearchParams();
|
|
316
|
-
expect(url.search).toBe("");
|
|
317
|
-
expect(url.search).not.toBe(originalSearch);
|
|
318
|
-
expect(url.searchParams.toString()).toBe("");
|
|
317
|
+
(0, vitest_1.expect)(url.search).toBe("");
|
|
318
|
+
(0, vitest_1.expect)(url.search).not.toBe(originalSearch);
|
|
319
|
+
(0, vitest_1.expect)(url.searchParams.toString()).toBe("");
|
|
319
320
|
});
|
|
320
321
|
});
|
|
321
|
-
describe("comprehensive state change verification", () => {
|
|
322
|
+
(0, vitest_1.describe)("comprehensive state change verification", () => {
|
|
322
323
|
let url;
|
|
323
|
-
beforeEach(() => {
|
|
324
|
+
(0, vitest_1.beforeEach)(() => {
|
|
324
325
|
url = mutable_url_js_1.WritableURL.fromThrow("http://example.com/path?existing=param");
|
|
325
326
|
});
|
|
326
|
-
it("should verify all mutable setters change state correctly", () => {
|
|
327
|
+
(0, vitest_1.it)("should verify all mutable setters change state correctly", () => {
|
|
327
328
|
const originalHash = url.hash;
|
|
328
329
|
const originalHost = url.host;
|
|
329
330
|
const originalHostname = url.hostname;
|
|
@@ -340,113 +341,113 @@ describe("WritableURL", () => {
|
|
|
340
341
|
url.search = "?new=value";
|
|
341
342
|
url.username = "newuser";
|
|
342
343
|
url.password = "newpass";
|
|
343
|
-
expect(url.hash).toBe("#newHash");
|
|
344
|
-
expect(url.hash).not.toBe(originalHash);
|
|
345
|
-
expect(url.host).toBe("newhost.com:8080");
|
|
346
|
-
expect(url.host).not.toBe(originalHost);
|
|
347
|
-
expect(url.hostname).toBe("newhost.com");
|
|
348
|
-
expect(url.hostname).not.toBe(originalHostname);
|
|
349
|
-
expect(url.pathname).toBe("/newpath");
|
|
350
|
-
expect(url.pathname).not.toBe(originalPathname);
|
|
351
|
-
expect(url.port).toBe("8080");
|
|
352
|
-
expect(url.port).not.toBe(originalPort);
|
|
353
|
-
expect(url.protocol).toBe("https:");
|
|
354
|
-
expect(url.protocol).not.toBe(originalProtocol);
|
|
355
|
-
expect(url.search).toBe("?new=value");
|
|
356
|
-
expect(url.search).not.toBe(originalSearch);
|
|
357
|
-
expect(url.username).toBe("newuser");
|
|
358
|
-
expect(url.username).not.toBe(originalUsername);
|
|
359
|
-
expect(url.password).toBe("newpass");
|
|
360
|
-
expect(url.password).not.toBe(originalPassword);
|
|
361
|
-
expect(url.toString()).toContain("https://");
|
|
362
|
-
expect(url.toString()).toContain("newuser:newpass@");
|
|
363
|
-
expect(url.toString()).toContain("newhost.com:8080");
|
|
364
|
-
expect(url.toString()).toContain("/newpath");
|
|
365
|
-
expect(url.toString()).toContain("?new=value");
|
|
366
|
-
expect(url.toString()).toContain("#newHash");
|
|
344
|
+
(0, vitest_1.expect)(url.hash).toBe("#newHash");
|
|
345
|
+
(0, vitest_1.expect)(url.hash).not.toBe(originalHash);
|
|
346
|
+
(0, vitest_1.expect)(url.host).toBe("newhost.com:8080");
|
|
347
|
+
(0, vitest_1.expect)(url.host).not.toBe(originalHost);
|
|
348
|
+
(0, vitest_1.expect)(url.hostname).toBe("newhost.com");
|
|
349
|
+
(0, vitest_1.expect)(url.hostname).not.toBe(originalHostname);
|
|
350
|
+
(0, vitest_1.expect)(url.pathname).toBe("/newpath");
|
|
351
|
+
(0, vitest_1.expect)(url.pathname).not.toBe(originalPathname);
|
|
352
|
+
(0, vitest_1.expect)(url.port).toBe("8080");
|
|
353
|
+
(0, vitest_1.expect)(url.port).not.toBe(originalPort);
|
|
354
|
+
(0, vitest_1.expect)(url.protocol).toBe("https:");
|
|
355
|
+
(0, vitest_1.expect)(url.protocol).not.toBe(originalProtocol);
|
|
356
|
+
(0, vitest_1.expect)(url.search).toBe("?new=value");
|
|
357
|
+
(0, vitest_1.expect)(url.search).not.toBe(originalSearch);
|
|
358
|
+
(0, vitest_1.expect)(url.username).toBe("newuser");
|
|
359
|
+
(0, vitest_1.expect)(url.username).not.toBe(originalUsername);
|
|
360
|
+
(0, vitest_1.expect)(url.password).toBe("newpass");
|
|
361
|
+
(0, vitest_1.expect)(url.password).not.toBe(originalPassword);
|
|
362
|
+
(0, vitest_1.expect)(url.toString()).toContain("https://");
|
|
363
|
+
(0, vitest_1.expect)(url.toString()).toContain("newuser:newpass@");
|
|
364
|
+
(0, vitest_1.expect)(url.toString()).toContain("newhost.com:8080");
|
|
365
|
+
(0, vitest_1.expect)(url.toString()).toContain("/newpath");
|
|
366
|
+
(0, vitest_1.expect)(url.toString()).toContain("?new=value");
|
|
367
|
+
(0, vitest_1.expect)(url.toString()).toContain("#newHash");
|
|
367
368
|
});
|
|
368
369
|
});
|
|
369
|
-
describe("clone method", () => {
|
|
370
|
-
it("should create new instance with same URL", () => {
|
|
370
|
+
(0, vitest_1.describe)("clone method", () => {
|
|
371
|
+
(0, vitest_1.it)("should create new instance with same URL", () => {
|
|
371
372
|
const url = mutable_url_js_1.WritableURL.fromThrow("http://example.com/path?param=value#hash");
|
|
372
373
|
const cloned = url.clone();
|
|
373
|
-
expect(cloned).toBeInstanceOf(mutable_url_js_1.WritableURL);
|
|
374
|
-
expect(cloned).not.toBe(url);
|
|
375
|
-
expect(cloned.toString()).toBe(url.toString());
|
|
374
|
+
(0, vitest_1.expect)(cloned).toBeInstanceOf(mutable_url_js_1.WritableURL);
|
|
375
|
+
(0, vitest_1.expect)(cloned).not.toBe(url);
|
|
376
|
+
(0, vitest_1.expect)(cloned.toString()).toBe(url.toString());
|
|
376
377
|
});
|
|
377
378
|
});
|
|
378
|
-
describe("utility methods", () => {
|
|
379
|
+
(0, vitest_1.describe)("utility methods", () => {
|
|
379
380
|
let url;
|
|
380
|
-
beforeEach(() => {
|
|
381
|
+
(0, vitest_1.beforeEach)(() => {
|
|
381
382
|
url = mutable_url_js_1.WritableURL.fromThrow("http://example.com/path");
|
|
382
383
|
});
|
|
383
|
-
it("test serialization", () => {
|
|
384
|
+
(0, vitest_1.it)("test serialization", () => {
|
|
384
385
|
const url = mutable_url_js_1.WritableURL.fromThrow("http://example.com/path");
|
|
385
|
-
expect(JSON.stringify(url)).toBe(`"${url.toString()}"`);
|
|
386
|
+
(0, vitest_1.expect)(JSON.stringify(url)).toBe(`"${url.toString()}"`);
|
|
386
387
|
});
|
|
387
|
-
it("should return JSON string", () => {
|
|
388
|
-
expect(url.toJSON()).toBe(url.toString());
|
|
388
|
+
(0, vitest_1.it)("should return JSON string", () => {
|
|
389
|
+
(0, vitest_1.expect)(url.toJSON()).toBe(url.toString());
|
|
389
390
|
});
|
|
390
|
-
it("should return string for custom inspect", () => {
|
|
391
|
+
(0, vitest_1.it)("should return string for custom inspect", () => {
|
|
391
392
|
const customInspectSymbol = Symbol.for("nodejs.util.inspect.custom");
|
|
392
|
-
expect(url[customInspectSymbol]()).toBe(url.toString());
|
|
393
|
+
(0, vitest_1.expect)(url[customInspectSymbol]()).toBe(url.toString());
|
|
393
394
|
});
|
|
394
395
|
});
|
|
395
396
|
});
|
|
396
|
-
describe("ReadonlyURL.from", () => {
|
|
397
|
-
it("should return Ok for valid url with protocol", () => {
|
|
397
|
+
(0, vitest_1.describe)("ReadonlyURL.from", () => {
|
|
398
|
+
(0, vitest_1.it)("should return Ok for valid url with protocol", () => {
|
|
398
399
|
const result = mutable_url_js_1.ReadonlyURL.from("http://example.com/foo");
|
|
399
|
-
expect(result.isOk()).toBe(true);
|
|
400
|
-
expect(result.Ok().toString()).toBe("http://example.com/foo");
|
|
400
|
+
(0, vitest_1.expect)(result.isOk()).toBe(true);
|
|
401
|
+
(0, vitest_1.expect)(result.Ok().toString()).toBe("http://example.com/foo");
|
|
401
402
|
});
|
|
402
|
-
it("should return Err for invalid url", () => {
|
|
403
|
+
(0, vitest_1.it)("should return Err for invalid url", () => {
|
|
403
404
|
const result = mutable_url_js_1.ReadonlyURL.from("not-a-url");
|
|
404
|
-
expect(result.isErr()).toBe(true);
|
|
405
|
+
(0, vitest_1.expect)(result.isErr()).toBe(true);
|
|
405
406
|
});
|
|
406
|
-
it("should return Err for invalid url 1", () => {
|
|
407
|
+
(0, vitest_1.it)("should return Err for invalid url 1", () => {
|
|
407
408
|
const result = mutable_url_js_1.ReadonlyURL.from("not-a-url:");
|
|
408
|
-
expect(result.isErr()).toBe(true);
|
|
409
|
+
(0, vitest_1.expect)(result.isErr()).toBe(true);
|
|
409
410
|
});
|
|
410
|
-
it("should return Err for invalid url 2", () => {
|
|
411
|
+
(0, vitest_1.it)("should return Err for invalid url 2", () => {
|
|
411
412
|
const result = mutable_url_js_1.ReadonlyURL.from("not-a-url:/");
|
|
412
|
-
expect(result.isErr()).toBe(true);
|
|
413
|
+
(0, vitest_1.expect)(result.isErr()).toBe(true);
|
|
413
414
|
});
|
|
414
|
-
it("should return Err for invalid urll 3", () => {
|
|
415
|
+
(0, vitest_1.it)("should return Err for invalid urll 3", () => {
|
|
415
416
|
const result = mutable_url_js_1.ReadonlyURL.from("not-a-url://kdkkef/df:dkdkfkdk");
|
|
416
|
-
expect(result.isErr()).toBe(true);
|
|
417
|
+
(0, vitest_1.expect)(result.isErr()).toBe(true);
|
|
417
418
|
});
|
|
418
|
-
it("should return Ok for custom protocol", () => {
|
|
419
|
+
(0, vitest_1.it)("should return Ok for custom protocol", () => {
|
|
419
420
|
const result = mutable_url_js_1.ReadonlyURL.from("b0lix://foo/bar");
|
|
420
|
-
expect(result.isOk()).toBe(true);
|
|
421
|
-
expect(result.Ok().toString()).toBe("b0lix://foo/bar");
|
|
421
|
+
(0, vitest_1.expect)(result.isOk()).toBe(true);
|
|
422
|
+
(0, vitest_1.expect)(result.Ok().toString()).toBe("b0lix://foo/bar");
|
|
422
423
|
});
|
|
423
424
|
});
|
|
424
|
-
describe("WritableURL.from", () => {
|
|
425
|
-
it("should return Ok for valid url with protocol", () => {
|
|
425
|
+
(0, vitest_1.describe)("WritableURL.from", () => {
|
|
426
|
+
(0, vitest_1.it)("should return Ok for valid url with protocol", () => {
|
|
426
427
|
const result = mutable_url_js_1.WritableURL.from("http://example.com/foo");
|
|
427
|
-
expect(result.isOk()).toBe(true);
|
|
428
|
-
expect(result.Ok().toString()).toBe("http://example.com/foo");
|
|
428
|
+
(0, vitest_1.expect)(result.isOk()).toBe(true);
|
|
429
|
+
(0, vitest_1.expect)(result.Ok().toString()).toBe("http://example.com/foo");
|
|
429
430
|
});
|
|
430
|
-
it("should return Err for invalid url", () => {
|
|
431
|
+
(0, vitest_1.it)("should return Err for invalid url", () => {
|
|
431
432
|
const result = mutable_url_js_1.WritableURL.from("not-a-url");
|
|
432
|
-
expect(result.isErr()).toBe(true);
|
|
433
|
+
(0, vitest_1.expect)(result.isErr()).toBe(true);
|
|
433
434
|
});
|
|
434
|
-
it("should return Err for invalid url 1", () => {
|
|
435
|
+
(0, vitest_1.it)("should return Err for invalid url 1", () => {
|
|
435
436
|
const result = mutable_url_js_1.WritableURL.from("not-a-url:");
|
|
436
|
-
expect(result.isErr()).toBe(true);
|
|
437
|
+
(0, vitest_1.expect)(result.isErr()).toBe(true);
|
|
437
438
|
});
|
|
438
|
-
it("should return Err for invalid url 2", () => {
|
|
439
|
+
(0, vitest_1.it)("should return Err for invalid url 2", () => {
|
|
439
440
|
const result = mutable_url_js_1.WritableURL.from("not-a-url:/");
|
|
440
|
-
expect(result.isErr()).toBe(true);
|
|
441
|
+
(0, vitest_1.expect)(result.isErr()).toBe(true);
|
|
441
442
|
});
|
|
442
|
-
it("should return Err for invalid urll 3", () => {
|
|
443
|
+
(0, vitest_1.it)("should return Err for invalid urll 3", () => {
|
|
443
444
|
const result = mutable_url_js_1.WritableURL.from("not-a-url://kdkkef/df:dkdkfkdk");
|
|
444
|
-
expect(result.isErr()).toBe(true);
|
|
445
|
+
(0, vitest_1.expect)(result.isErr()).toBe(true);
|
|
445
446
|
});
|
|
446
|
-
it("should return Ok for custom protocol", () => {
|
|
447
|
+
(0, vitest_1.it)("should return Ok for custom protocol", () => {
|
|
447
448
|
const result = mutable_url_js_1.WritableURL.from("b0lix://foo/bar");
|
|
448
|
-
expect(result.isOk()).toBe(true);
|
|
449
|
-
expect(result.Ok().toString()).toBe("b0lix://foo/bar");
|
|
449
|
+
(0, vitest_1.expect)(result.isOk()).toBe(true);
|
|
450
|
+
(0, vitest_1.expect)(result.Ok().toString()).toBe("b0lix://foo/bar");
|
|
450
451
|
});
|
|
451
452
|
});
|
|
452
453
|
//# sourceMappingURL=mutable-url.test.js.map
|