diff options
author | Kitson Kelly <me@kitsonkelly.com> | 2018-10-23 22:43:43 +1100 |
---|---|---|
committer | Ryan Dahl <ry@tinyclouds.org> | 2018-10-23 04:43:43 -0700 |
commit | c0492ef061afd5af2044d5952432d223615841a7 (patch) | |
tree | f7c0c30e4fd25868b4d3f8e1913d04a655cebc2a /js/fetch_test.ts | |
parent | de85f9443598ba5a75102be77f6f27a5cf0c0a9a (diff) |
Make Headers more idiomatic (#1062)
Diffstat (limited to 'js/fetch_test.ts')
-rw-r--r-- | js/fetch_test.ts | 25 |
1 files changed, 4 insertions, 21 deletions
diff --git a/js/fetch_test.ts b/js/fetch_test.ts index 2f73544aa..f92968d78 100644 --- a/js/fetch_test.ts +++ b/js/fetch_test.ts @@ -26,16 +26,6 @@ testPerm({ net: true }, async function fetchHeaders() { assert(headers.get("Server").startsWith("SimpleHTTP")); }); -test(async function headersAppend() { - let err; - try { - const headers = new Headers([["foo", "bar", "baz"]]); - } catch (e) { - err = e; - } - assert(err instanceof TypeError); -}); - testPerm({ net: true }, async function fetchBlob() { const response = await fetch("http://localhost:4545/package.json"); const headers = response.headers; @@ -69,14 +59,10 @@ test(function newHeaderTest() { try { new Headers(null); } catch (e) { - assertEqual(e.message, "Failed to construct 'Headers': Invalid value"); - } - - try { - const init = [["a", "b", "c"]]; - new Headers(init); - } catch (e) { - assertEqual(e.message, "Failed to construct 'Headers': Invalid value"); + assertEqual( + e.message, + "Failed to construct 'Headers'; The provided value was not valid" + ); } }); @@ -163,7 +149,6 @@ test(function headerGetSuccess() { test(function headerEntriesSuccess() { const headers = new Headers(headerDict); const iterators = headers.entries(); - assertEqual(Object.prototype.toString.call(iterators), "[object Iterator]"); for (const it of iterators) { const key = it[0]; const value = it[1]; @@ -175,7 +160,6 @@ test(function headerEntriesSuccess() { test(function headerKeysSuccess() { const headers = new Headers(headerDict); const iterators = headers.keys(); - assertEqual(Object.prototype.toString.call(iterators), "[object Iterator]"); for (const it of iterators) { assert(headers.has(it)); } @@ -189,7 +173,6 @@ test(function headerValuesSuccess() { for (const pair of entries) { values.push(pair[1]); } - assertEqual(Object.prototype.toString.call(iterators), "[object Iterator]"); for (const it of iterators) { assert(values.includes(it)); } |