diff options
author | 2023-07-11 19:14:34 -0700 | |
---|---|---|
committer | 2023-07-11 19:14:34 -0700 | |
commit | cbb88672f217a90db1aa1eb29cd92d5d9035b22b (patch) | |
tree | 43a00501f3cde495967e116f0b660777051551f8 /test/js/web/util/atob.test.js | |
parent | 1f900cff453700b19bca2acadfe26da4468c1282 (diff) | |
parent | 34b0e7a2bbd8bf8097341cdb0075d0908283e834 (diff) | |
download | bun-jarred/esm-conditions.tar.gz bun-jarred/esm-conditions.tar.zst bun-jarred/esm-conditions.zip |
Merge branch 'main' into jarred/esm-conditionsjarred/esm-conditions
Diffstat (limited to 'test/js/web/util/atob.test.js')
-rw-r--r-- | test/js/web/util/atob.test.js | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/test/js/web/util/atob.test.js b/test/js/web/util/atob.test.js index 4945829e1..20c029f14 100644 --- a/test/js/web/util/atob.test.js +++ b/test/js/web/util/atob.test.js @@ -60,18 +60,15 @@ it("btoa", () => { expect(btoa("abcde")).toBe("YWJjZGU="); expect(btoa("abcdef")).toBe("YWJjZGVm"); expect(typeof btoa).toBe("function"); - try { - btoa(); - throw new Error("Expected error"); - } catch (error) { - expect(error.name).toBe("TypeError"); - } + expect(() => btoa()).toThrow("btoa requires 1 argument (a string)"); var window = "[object Window]"; expect(btoa("")).toBe(""); expect(btoa(null)).toBe("bnVsbA=="); expect(btoa(undefined)).toBe("dW5kZWZpbmVk"); expect(btoa(window)).toBe("W29iamVjdCBXaW5kb3dd"); expect(btoa("éé")).toBe("6ek="); + // check for utf16 + expect(btoa("🧐éé".substring("🧐".length))).toBe("6ek="); expect(btoa("\u0080\u0081")).toBe("gIE="); expect(btoa(Bun)).toBe(btoa("[object Bun]")); }); |