aboutsummaryrefslogtreecommitdiff
path: root/test/bun.js/fetch.test.js
diff options
context:
space:
mode:
Diffstat (limited to 'test/bun.js/fetch.test.js')
-rw-r--r--test/bun.js/fetch.test.js22
1 files changed, 22 insertions, 0 deletions
diff --git a/test/bun.js/fetch.test.js b/test/bun.js/fetch.test.js
index 519d6bbdd..af5de1b5a 100644
--- a/test/bun.js/fetch.test.js
+++ b/test/bun.js/fetch.test.js
@@ -160,6 +160,28 @@ function testBlobInterface(blobbyConstructor, hasBlobFn) {
if (withGC) gc();
});
+ it(`${
+ jsonObject.hello === true ? "latin1" : "utf16"
+ } arrayBuffer -> invalid json${
+ withGC ? " (with gc) " : ""
+ }`, async () => {
+ if (withGC) gc();
+ var response = blobbyConstructor(
+ new TextEncoder().encode(
+ JSON.stringify(jsonObject) + " NOW WE ARE INVALID JSON",
+ ),
+ );
+ if (withGC) gc();
+ var failed = false;
+ try {
+ await response.json();
+ } catch (e) {
+ failed = true;
+ }
+ expect(failed).toBe(true);
+ if (withGC) gc();
+ });
+
it(`${jsonObject.hello === true ? "latin1" : "utf16"} text${
withGC ? " (with gc) " : ""
}`, async () => {