From 5414b2aedc6834fe8bee73d79a04e133c9c1c8d6 Mon Sep 17 00:00:00 2001 From: Anne van Kesteren Date: Wed, 10 Mar 2021 21:15:21 +0000 Subject: [PATCH] Bug 1696986 [wpt PR 27894] - Fetch: redo Content-Length parser test names, a=testonly Automatic update from web-platform-tests Fetch: redo Content-Length parser test names See https://github.com/whatwg/fetch/pull/1183 for context. -- wpt-commits: 34f0fc0f2d7e04c980e6ec708b590c0c220127e4 wpt-pr: 27894 --- .../tests/fetch/content-length/parsing.window.js | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/testing/web-platform/tests/fetch/content-length/parsing.window.js b/testing/web-platform/tests/fetch/content-length/parsing.window.js index 73fbb482e042c..5028ad943dee6 100644 --- a/testing/web-platform/tests/fetch/content-length/parsing.window.js +++ b/testing/web-platform/tests/fetch/content-length/parsing.window.js @@ -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}.`); }); }