Skip to content

Commit 3d55cf0

Browse files
mscdexitaloacasas
authored andcommitted
test: add more WHATWG URL origin tests
PR-URL: #11691 Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Joyee Cheung <[email protected]> Reviewed-By: Timothy Gu <[email protected]> Reviewed-By: Daijiro Wachi <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: James M Snell <[email protected]>
1 parent a98d963 commit 3d55cf0

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

test/parallel/test-whatwg-url-properties.js

+16
Original file line numberDiff line numberDiff line change
@@ -142,3 +142,19 @@ assert.strictEqual(url.searchParams, oldParams);
142142
assert.strictEqual(opts.search, '?l=24');
143143
assert.strictEqual(opts.hash, '#test');
144144
}
145+
146+
// Test special origins
147+
[
148+
{ expected: 'https://whatwg.org',
149+
url: 'blob:https://whatwg.org/d0360e2f-caee-469f-9a2f-87d5b0456f6f' },
150+
{ expected: 'ftp://example.org', url: 'ftp://example.org/foo' },
151+
{ expected: 'gopher://gopher.quux.org', url: 'gopher://gopher.quux.org/1/' },
152+
{ expected: 'http://example.org', url: 'http://example.org/foo' },
153+
{ expected: 'https://example.org', url: 'https://example.org/foo' },
154+
{ expected: 'ws://example.org', url: 'ws://example.org/foo' },
155+
{ expected: 'wss://example.org', url: 'wss://example.org/foo' },
156+
{ expected: 'null', url: 'file:///tmp/mock/path' },
157+
{ expected: 'null', url: 'npm://nodejs/rules' }
158+
].forEach((test) => {
159+
assert.strictEqual(new URL(test.url).origin, test.expected);
160+
});

0 commit comments

Comments
 (0)