aboutsummaryrefslogtreecommitdiff
path: root/test/js/web/fetch/blob.test.ts
diff options
context:
space:
mode:
Diffstat (limited to 'test/js/web/fetch/blob.test.ts')
-rw-r--r--test/js/web/fetch/blob.test.ts17
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);