MCPcopy Index your code
hub / github.com/nodejs/node / runTests

Function runTests

test/fixtures/wpt/urlpattern/urlpattern-generate.tentative.any.js:3–20  ·  view source on GitHub ↗
(data)

Source from the content-addressed store, hash-verified

1// META: global=window,worker
2
3function runTests(data) {
4 for (let entry of data) {
5 test(function () {
6 const pattern = new URLPattern(entry.pattern);
7
8 if (entry.expected === null) {
9 assert_throws_js(TypeError, _ => pattern.generate(entry.component, entry.groups),
10 'generate() should fail with TypeError');
11 return;
12 }
13
14 const result = pattern.generate(entry.component, entry.groups);
15 assert_equals(result, entry.expected);
16 }, `Pattern: ${JSON.stringify(entry.pattern)} ` +
17 `Component: ${entry.component} ` +
18 `Groups: ${JSON.stringify(entry.groups)}`);
19 }
20}
21
22promise_test(async function () {
23 const response = await fetch('resources/urlpattern-generate-test-data.json');

Calls 4

testFunction · 0.50
assert_throws_jsFunction · 0.50
assert_equalsFunction · 0.50
generateMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…