mirror of
https://github.com/denoland/deno.git
synced 2025-09-26 12:19:12 +00:00
Enable TS strict mode by default (#3899)
Fixes #3324 Co-authored-by: Kitson Kelly <me@kitsonkelly.com>
This commit is contained in:
parent
852823fa50
commit
90125566bb
56 changed files with 314 additions and 179 deletions
|
@ -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> {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue