diff options
author | Maximilien Mellen <maxmellen0@gmail.com> | 2020-02-19 21:36:18 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-02-19 15:36:18 -0500 |
commit | 90125566bbaed8b5c6e55ca8dbc432e3433fb73c (patch) | |
tree | bf798a408b26264641260395ce8cfc9d4bb37637 /cli/js/fetch_test.ts | |
parent | 852823fa505d75d61e70e1330bbf366aa248e650 (diff) |
Enable TS strict mode by default (#3899)
Fixes #3324
Co-authored-by: Kitson Kelly <me@kitsonkelly.com>
Diffstat (limited to 'cli/js/fetch_test.ts')
-rw-r--r-- | cli/js/fetch_test.ts | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/cli/js/fetch_test.ts b/cli/js/fetch_test.ts index 2b3d03a38..c63d05501 100644 --- a/cli/js/fetch_test.ts +++ b/cli/js/fetch_test.ts @@ -54,7 +54,7 @@ testPerm({ net: true }, async function fetchHeaders(): Promise<void> { const response = await fetch("http://localhost:4545/cli/tests/fixture.json"); const headers = response.headers; assertEquals(headers.get("Content-Type"), "application/json"); - assert(headers.get("Server").startsWith("SimpleHTTP")); + assert(headers.get("Server")!.startsWith("SimpleHTTP")); }); testPerm({ net: true }, async function fetchBlob(): Promise<void> { @@ -93,10 +93,10 @@ testPerm({ net: true }, async function responseClone(): Promise<void> { assert(response !== response1); assertEquals(response.status, response1.status); assertEquals(response.statusText, response1.statusText); - const ab = await response.arrayBuffer(); - const ab1 = await response1.arrayBuffer(); - for (let i = 0; i < ab.byteLength; i++) { - assertEquals(ab[i], ab1[i]); + const u8a = new Uint8Array(await response.arrayBuffer()); + const u8a1 = new Uint8Array(await response1.arrayBuffer()); + for (let i = 0; i < u8a.byteLength; i++) { + assertEquals(u8a[i], u8a1[i]); } }); @@ -119,7 +119,7 @@ testPerm({ net: true }, async function fetchMultipartFormDataSuccess(): Promise< ); const formData = await response.formData(); assert(formData.has("field_1")); - assertEquals(formData.get("field_1").toString(), "value_1 \r\n"); + assertEquals(formData.get("field_1")!.toString(), "value_1 \r\n"); assert(formData.has("field_2")); /* TODO(ry) Re-enable this test once we bring back the global File type. const file = formData.get("field_2") as File; @@ -136,9 +136,9 @@ testPerm( ); const formData = await response.formData(); assert(formData.has("field_1")); - assertEquals(formData.get("field_1").toString(), "Hi"); + assertEquals(formData.get("field_1")!.toString(), "Hi"); assert(formData.has("field_2")); - assertEquals(formData.get("field_2").toString(), "<Deno>"); + assertEquals(formData.get("field_2")!.toString(), "<Deno>"); } ); @@ -179,7 +179,7 @@ testPerm({ net: true }, async function fetchInitStringBody(): Promise<void> { }); const text = await response.text(); assertEquals(text, data); - assert(response.headers.get("content-type").startsWith("text/plain")); + assert(response.headers.get("content-type")!.startsWith("text/plain")); }); testPerm({ net: true }, async function fetchRequestInitStringBody(): Promise< @@ -220,7 +220,7 @@ testPerm({ net: true }, async function fetchInitURLSearchParamsBody(): Promise< assertEquals(text, data); assert( response.headers - .get("content-type") + .get("content-type")! .startsWith("application/x-www-form-urlencoded") ); }); @@ -236,7 +236,7 @@ testPerm({ net: true }, async function fetchInitBlobBody(): Promise<void> { }); const text = await response.text(); assertEquals(text, data); - assert(response.headers.get("content-type").startsWith("text/javascript")); + assert(response.headers.get("content-type")!.startsWith("text/javascript")); }); testPerm({ net: true }, async function fetchUserAgent(): Promise<void> { |