diff options
author | 2022-11-09 15:40:40 -0800 | |
---|---|---|
committer | 2022-11-09 15:40:40 -0800 | |
commit | f7f1b604443c030afe29d1059b90f72c69afe081 (patch) | |
tree | 8f2397447b2a84dab02850007264b72cc565f5d6 /test/bun.js/fetch.test.js | |
parent | da257336b0b70df8c31da647496899cf70670000 (diff) | |
download | bun-f7f1b604443c030afe29d1059b90f72c69afe081.tar.gz bun-f7f1b604443c030afe29d1059b90f72c69afe081.tar.zst bun-f7f1b604443c030afe29d1059b90f72c69afe081.zip |
Add bun-types, add typechecking, add `child_process` types (#1475)
* Add bun-types to packages
* Improve typing
* Fix types in tests
* Fix dts tests
* Run formatter
* Fix all type errors
* Add strict mode, fix type errors
* Add ffi changes
* Move workflows to root
* Add workflows
* Remove labeler
* Add child_process types
* Fix synthetic defaults issue
* Remove docs
* Move scripts
* Run prettier
* Include examples in typechecking
* captureStackTrace types
* moved captureStackTrace types to globals
* Address reviews
Co-authored-by: Colin McDonnell <colinmcd@alum.mit.edu>
Co-authored-by: Dylan Conway <dylan.conway567@gmail.com>
Diffstat (limited to 'test/bun.js/fetch.test.js')
-rw-r--r-- | test/bun.js/fetch.test.js | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/test/bun.js/fetch.test.js b/test/bun.js/fetch.test.js index 603cdfb3c..ebcdcbc8b 100644 --- a/test/bun.js/fetch.test.js +++ b/test/bun.js/fetch.test.js @@ -5,7 +5,7 @@ import { gc } from "./gc"; const exampleFixture = fs.readFileSync( import.meta.path.substring(0, import.meta.path.lastIndexOf("/")) + "/fetch.js.txt", - "utf8" + "utf8", ); describe("fetch", () => { @@ -74,7 +74,7 @@ function testBlobInterface(blobbyConstructor, hasBlobFn) { var response = blobbyConstructor(JSON.stringify(jsonObject)); if (withGC) gc(); expect(JSON.stringify(await response.json())).toBe( - JSON.stringify(jsonObject) + JSON.stringify(jsonObject), ); if (withGC) gc(); }); @@ -84,11 +84,11 @@ function testBlobInterface(blobbyConstructor, hasBlobFn) { } arrayBuffer -> json${withGC ? " (with gc) " : ""}`, async () => { if (withGC) gc(); var response = blobbyConstructor( - new TextEncoder().encode(JSON.stringify(jsonObject)) + new TextEncoder().encode(JSON.stringify(jsonObject)), ); if (withGC) gc(); expect(JSON.stringify(await response.json())).toBe( - JSON.stringify(jsonObject) + JSON.stringify(jsonObject), ); if (withGC) gc(); }); @@ -108,7 +108,7 @@ function testBlobInterface(blobbyConstructor, hasBlobFn) { } arrayBuffer -> text${withGC ? " (with gc) " : ""}`, async () => { if (withGC) gc(); var response = blobbyConstructor( - new TextEncoder().encode(JSON.stringify(jsonObject)) + new TextEncoder().encode(JSON.stringify(jsonObject)), ); if (withGC) gc(); expect(await response.text()).toBe(JSON.stringify(jsonObject)); @@ -144,7 +144,7 @@ function testBlobInterface(blobbyConstructor, hasBlobFn) { if (withGC) gc(); var response = blobbyConstructor( - new TextEncoder().encode(JSON.stringify(jsonObject)) + new TextEncoder().encode(JSON.stringify(jsonObject)), ); if (withGC) gc(); @@ -219,13 +219,13 @@ describe("Blob", () => { [ new Blob([ new TextEncoder().encode( - "π π π π π π
π π€£ π₯² βΊοΈ π π π π π π π π₯° π π π π π π π π π€ͺ π€¨ π§ π€ π π₯Έ π€© π₯³" + "π π π π π π
π π€£ π₯² βΊοΈ π π π π π π π π₯° π π π π π π π π π€ͺ π€¨ π§ π€ π π₯Έ π€© π₯³", ), ]), ], [ new TextEncoder().encode( - "π π π π π π
π π€£ π₯² βΊοΈ π π π π π π π π₯° π π π π π π π π π€ͺ π€¨ π§ π€ π π₯Έ π€© π₯³" + "π π π π π π
π π€£ π₯² βΊοΈ π π π π π π π π₯° π π π π π π π π π€ͺ π€¨ π§ π€ π π₯Έ π€© π₯³", ), ], ]; @@ -253,7 +253,7 @@ describe("Blob", () => { .split("") .map((a) => a.charCodeAt(0))}, received: ${res .split("") - .map((a) => a.charCodeAt(0))}` + .map((a) => a.charCodeAt(0))}`, ); } @@ -274,7 +274,7 @@ describe("Blob", () => { expect( await combined .slice(str.indexOf(part), str.indexOf(part) + part.length) - .text() + .text(), ).toBe(part); if (withGC) gc(); } @@ -284,7 +284,7 @@ describe("Blob", () => { expect( await combined .slice(str.indexOf(part), str.indexOf(part) + part.length) - .text() + .text(), ).toBe(part); if (withGC) gc(); } @@ -358,7 +358,7 @@ describe("Response", () => { let response = Response.json("hello"); expect(response.type).toBe("basic"); expect(response.headers.get("content-type")).toBe( - "application/json;charset=utf-8" + "application/json;charset=utf-8", ); expect(response.status).toBe(200); }); @@ -366,7 +366,7 @@ describe("Response", () => { let response = Response.json("hello", 407); expect(response.type).toBe("basic"); expect(response.headers.get("content-type")).toBe( - "application/json;charset=utf-8" + "application/json;charset=utf-8", ); expect(response.status).toBe(407); }); @@ -485,7 +485,7 @@ describe("Request", () => { testBlobInterface( (data) => new Request("https://hello.com", { body: data }), - true + true, ); }); |