diff options
author | 2023-03-07 22:16:55 -0800 | |
---|---|---|
committer | 2023-03-07 22:16:55 -0800 | |
commit | 88ad5ed73cc6e6e0f006905a7e161a942a8ea277 (patch) | |
tree | 614581917af0db22e8898bc2dcc467d5408fffc5 /test/js/web/fetch/blob.test.ts | |
parent | 4d3eefa45f0c5adcb278a81f6f536227ffac9550 (diff) | |
download | bun-88ad5ed73cc6e6e0f006905a7e161a942a8ea277.tar.gz bun-88ad5ed73cc6e6e0f006905a7e161a942a8ea277.tar.zst bun-88ad5ed73cc6e6e0f006905a7e161a942a8ea277.zip |
Make `Blob.prototype.type` more spec compliant
Diffstat (limited to 'test/js/web/fetch/blob.test.ts')
-rw-r--r-- | test/js/web/fetch/blob.test.ts | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/test/js/web/fetch/blob.test.ts b/test/js/web/fetch/blob.test.ts index ba44f8c1b..51b9c0ea8 100644 --- a/test/js/web/fetch/blob.test.ts +++ b/test/js/web/fetch/blob.test.ts @@ -28,6 +28,23 @@ test("Blob.slice", () => { expect(blob.slice("text/plain;charset=utf-8").type).toBe("text/plain;charset=utf-8"); }); +test("Blob.prototype.type setter", () => { + var blob = new Blob(["Bun", "Foo"], { type: "text/foo" }); + expect(blob.type).toBe("text/foo"); + blob.type = "text/bar"; + expect(blob.type).toBe("text/bar"); + blob.type = "text/baz"; + expect(blob.type).toBe("text/baz"); + blob.type = "text/baz; charset=utf-8"; + expect(blob.type).toBe("text/baz; charset=utf-8"); + // @ts-expect-error + blob.type = NaN; + expect(blob.type).toBe(""); + // @ts-expect-error + blob.type = Symbol(); + expect(blob.type).toBe(""); +}); + test("new Blob", () => { var blob = new Blob(["Bun", "Foo"], { type: "text/foo" }); expect(blob.size).toBe(6); |