Skip to content

Commit

Permalink
test: add more WHATWG URL origin tests
Browse files Browse the repository at this point in the history
PR-URL: #11691
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Timothy Gu <timothygu99@gmail.com>
Reviewed-By: Daijiro Wachi <daijiro.wachi@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
  • Loading branch information
mscdex authored and italoacasas committed Mar 13, 2017
1 parent a98d963 commit 3d55cf0
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions test/parallel/test-whatwg-url-properties.js
Original file line number Diff line number Diff line change
Expand Up @@ -142,3 +142,19 @@ assert.strictEqual(url.searchParams, oldParams);
assert.strictEqual(opts.search, '?l=24');
assert.strictEqual(opts.hash, '#test');
}

// Test special origins
[
{ expected: 'https://whatwg.org',
url: 'blob:https://whatwg.org/d0360e2f-caee-469f-9a2f-87d5b0456f6f' },
{ expected: 'ftp://example.org', url: 'ftp://example.org/foo' },
{ expected: 'gopher://gopher.quux.org', url: 'gopher://gopher.quux.org/1/' },
{ expected: 'http://example.org', url: 'http://example.org/foo' },
{ expected: 'https://example.org', url: 'https://example.org/foo' },
{ expected: 'ws://example.org', url: 'ws://example.org/foo' },
{ expected: 'wss://example.org', url: 'wss://example.org/foo' },
{ expected: 'null', url: 'file:///tmp/mock/path' },
{ expected: 'null', url: 'npm://nodejs/rules' }
].forEach((test) => {
assert.strictEqual(new URL(test.url).origin, test.expected);
});

0 comments on commit 3d55cf0

Please sign in to comment.