test: update WPT for urlpattern to 3ffda23e5a
PR-URL: https://github.com/nodejs/node/pull/58537 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Filip Skokan <panva.ip@gmail.com> Reviewed-By: Ethan Arrowood <ethan@arrowood.dev>
This commit is contained in:
parent
fce45024bf
commit
e027da9289
2
test/fixtures/wpt/README.md
vendored
2
test/fixtures/wpt/README.md
vendored
@ -29,7 +29,7 @@ Last update:
|
||||
- resources: https://github.com/web-platform-tests/wpt/tree/1e140d63ec/resources
|
||||
- streams: https://github.com/web-platform-tests/wpt/tree/bc9dcbbf1a/streams
|
||||
- url: https://github.com/web-platform-tests/wpt/tree/9504a83e01/url
|
||||
- urlpattern: https://github.com/web-platform-tests/wpt/tree/f07d05f49c/urlpattern
|
||||
- urlpattern: https://github.com/web-platform-tests/wpt/tree/3ffda23e5a/urlpattern
|
||||
- user-timing: https://github.com/web-platform-tests/wpt/tree/5ae85bf826/user-timing
|
||||
- wasm/jsapi: https://github.com/web-platform-tests/wpt/tree/cde25e7e3c/wasm/jsapi
|
||||
- wasm/webapi: https://github.com/web-platform-tests/wpt/tree/fd1b23eeaa/wasm/webapi
|
||||
|
116
test/fixtures/wpt/urlpattern/resources/urlpattern-generate-test-data.json
vendored
Normal file
116
test/fixtures/wpt/urlpattern/resources/urlpattern-generate-test-data.json
vendored
Normal file
@ -0,0 +1,116 @@
|
||||
[
|
||||
{
|
||||
"pattern": { "pathname": "/foo" },
|
||||
"component": "invalid",
|
||||
"groups": {},
|
||||
"expected": null
|
||||
},
|
||||
{
|
||||
"pattern": { "pathname": "/foo" },
|
||||
"component": "pathname",
|
||||
"groups": {},
|
||||
"expected": "/foo"
|
||||
},
|
||||
{
|
||||
"pattern": { "pathname": "/:foo" },
|
||||
"component": "pathname",
|
||||
"groups": { "foo": "bar" },
|
||||
"expected": "/bar"
|
||||
},
|
||||
{
|
||||
"pattern": { "pathname": "/:foo" },
|
||||
"component": "pathname",
|
||||
"groups": { "foo": "🍅" },
|
||||
"expected": "/%F0%9F%8D%85"
|
||||
},
|
||||
{
|
||||
"pattern": { "hostname": "{:foo}.example.com" },
|
||||
"component": "hostname",
|
||||
"groups": { "foo": "🍅" },
|
||||
"expected": "xn--fi8h.example.com"
|
||||
},
|
||||
{
|
||||
"pattern": { "pathname": "/:foo" },
|
||||
"component": "pathname",
|
||||
"groups": {},
|
||||
"expected": null
|
||||
},
|
||||
{
|
||||
"pattern": { "pathname": "/foo/:bar" },
|
||||
"component": "pathname",
|
||||
"groups": { "bar": "baz" },
|
||||
"expected": "/foo/baz"
|
||||
},
|
||||
{
|
||||
"pattern": { "pathname": "/foo:bar" },
|
||||
"component": "pathname",
|
||||
"groups": { "bar": "baz" },
|
||||
"expected": "/foobaz"
|
||||
},
|
||||
{
|
||||
"pattern": { "pathname": "/:foo/:bar" },
|
||||
"component": "pathname",
|
||||
"groups": { "foo": "baz", "bar": "qux" },
|
||||
"expected": "/baz/qux"
|
||||
},
|
||||
{
|
||||
"pattern": "https://example.com/:foo",
|
||||
"component": "pathname",
|
||||
"groups": { "foo": " " },
|
||||
"expected": "/%20"
|
||||
},
|
||||
{
|
||||
"pattern": "original-scheme://example.com/:foo",
|
||||
"component": "pathname",
|
||||
"groups": { "foo": " " },
|
||||
"expected": "/ "
|
||||
},
|
||||
{
|
||||
"pattern": { "pathname": "/:foo" },
|
||||
"component": "pathname",
|
||||
"groups": { "foo": "bar/baz" },
|
||||
"expected": null
|
||||
},
|
||||
{
|
||||
"pattern": { "pathname": "*" },
|
||||
"component": "pathname",
|
||||
"groups": {},
|
||||
"expected": null
|
||||
},
|
||||
{
|
||||
"pattern": { "pathname": "/{foo}+" },
|
||||
"component": "pathname",
|
||||
"groups": {},
|
||||
"expected": null
|
||||
},
|
||||
{
|
||||
"pattern": { "pathname": "/{foo}?" },
|
||||
"component": "pathname",
|
||||
"groups": {},
|
||||
"expected": null
|
||||
},
|
||||
{
|
||||
"pattern": { "pathname": "/{foo}*" },
|
||||
"component": "pathname",
|
||||
"groups": {},
|
||||
"expected": null
|
||||
},
|
||||
{
|
||||
"pattern": { "pathname": "/(regexp)" },
|
||||
"component": "pathname",
|
||||
"groups": {},
|
||||
"expected": null
|
||||
},
|
||||
{
|
||||
"pattern": { "pathname": "/([^\\/]+?)" },
|
||||
"component": "pathname",
|
||||
"groups": {},
|
||||
"expected": null
|
||||
},
|
||||
{
|
||||
"pattern": { "port": "([^\\:]+?)" },
|
||||
"component": "port",
|
||||
"groups": {},
|
||||
"expected": null
|
||||
}
|
||||
]
|
26
test/fixtures/wpt/urlpattern/urlpattern-generate.tentative.any.js
vendored
Normal file
26
test/fixtures/wpt/urlpattern/urlpattern-generate.tentative.any.js
vendored
Normal file
@ -0,0 +1,26 @@
|
||||
// META: global=window,worker
|
||||
|
||||
function runTests(data) {
|
||||
for (let entry of data) {
|
||||
test(function () {
|
||||
const pattern = new URLPattern(entry.pattern);
|
||||
|
||||
if (entry.expected === null) {
|
||||
assert_throws_js(TypeError, _ => pattern.generate(entry.component, entry.groups),
|
||||
'generate() should fail with TypeError');
|
||||
return;
|
||||
}
|
||||
|
||||
const result = pattern.generate(entry.component, entry.groups);
|
||||
assert_equals(result, entry.expected);
|
||||
}, `Pattern: ${JSON.stringify(entry.pattern)} ` +
|
||||
`Component: ${entry.component} ` +
|
||||
`Groups: ${JSON.stringify(entry.groups)}`);
|
||||
}
|
||||
}
|
||||
|
||||
promise_test(async function () {
|
||||
const response = await fetch('resources/urlpattern-generate-test-data.json');
|
||||
const data = await response.json();
|
||||
runTests(data);
|
||||
}, 'Loading data...');
|
2
test/fixtures/wpt/versions.json
vendored
2
test/fixtures/wpt/versions.json
vendored
@ -76,7 +76,7 @@
|
||||
"path": "url"
|
||||
},
|
||||
"urlpattern": {
|
||||
"commit": "f07d05f49c679a62dd112e18aa07405859745952",
|
||||
"commit": "3ffda23e5af7c59590b17c2710a22efd22dd4973",
|
||||
"path": "urlpattern"
|
||||
},
|
||||
"user-timing": {
|
||||
|
@ -1,4 +1,7 @@
|
||||
{
|
||||
"urlpattern-generate.tentative.any.js": {
|
||||
"skip": "generate function is not yet included in the URLPattern spec"
|
||||
},
|
||||
"resources/urlpattern-compare-tests.tentative.js": {
|
||||
"skip": "compareComponent function is not yet included in the URLPattern spec"
|
||||
},
|
||||
|
Loading…
x
Reference in New Issue
Block a user