Skip to content

Commit

Permalink
Bug 1696986 [wpt PR 27894] - Fetch: redo Content-Length parser test n…
Browse files Browse the repository at this point in the history
…ames, a=testonly

Automatic update from web-platform-tests
Fetch: redo Content-Length parser test names

See whatwg/fetch#1183 for context.

--

wpt-commits: 34f0fc0f2d7e04c980e6ec708b590c0c220127e4
wpt-pr: 27894

UltraBlame original commit: b75ba7dbf5a92b46ca08d90e19e22af43647ef01
  • Loading branch information
marco-c committed Mar 15, 2021
1 parent cdde91e commit 20aa309
Showing 1 changed file with 5 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,16 @@ promise_test(() => {
}, "Loading JSON…");

function runTests(testUnits) {
testUnits.forEach(testUnit => {
const input = encodeURIComponent(testUnit.input);
testUnits.forEach(({ input, output }) => {
promise_test(t => {
const result = fetch("resources/content-length.py?length=" + input);
if (testUnit.output === null) {
const result = fetch(`resources/content-length.py?length=${encodeURIComponent(input)}`);
if (output === null) {
return promise_rejects_js(t, TypeError, result);
} else {
return result.then(res => res.text()).then(text => {
assert_equals(text.length, testUnit.output);
assert_equals(text.length, output);
});
}
}, input);
}, `Input: ${format_value(input)}. Expected: ${output === null ? "network error" : output}.`);
});
}

0 comments on commit 20aa309

Please sign in to comment.