diff options
author | Nico Weber <thakis@chromium.org> | 2020-07-23 09:10:49 -0400 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2020-07-23 15:18:25 +0200 |
commit | a92f7aea7a92ab4d2b40ac023b891992392c6a0a (patch) | |
tree | 99ea26453a3219be061495a6ccc65622a59a7845 /Libraries/LibWeb/Tests/Window/Base64.js | |
parent | 60599d03dd3b1673a8e635a4f0d132ccbcea9a50 (diff) | |
download | serenity-a92f7aea7a92ab4d2b40ac023b891992392c6a0a.zip |
LibWeb: Add tests for atob() and btoa()
Diffstat (limited to 'Libraries/LibWeb/Tests/Window/Base64.js')
-rw-r--r-- | Libraries/LibWeb/Tests/Window/Base64.js | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/Libraries/LibWeb/Tests/Window/Base64.js b/Libraries/LibWeb/Tests/Window/Base64.js new file mode 100644 index 0000000000..2cc12ea741 --- /dev/null +++ b/Libraries/LibWeb/Tests/Window/Base64.js @@ -0,0 +1,19 @@ +loadPage("file:///res/html/misc/blank.html"); + +afterPageLoad(() => { + test("atob", () => { + expect(atob("YQ==")).toBe("a"); + expect(atob("YWE=")).toBe("aa"); + expect(atob("YWFh")).toBe("aaa"); + expect(atob("YWFhYQ==")).toBe("aaaa"); + expect(atob("/w==")).toBe("\xff"); + }); + + test("btoa", () => { + expect(btoa("a")).toBe("YQ=="); + expect(btoa("aa")).toBe("YWE="); + expect(btoa("aaa")).toBe("YWFh"); + expect(btoa("aaaa")).toBe("YWFhYQ=="); + expect(btoa("\xff")).toBe("/w=="); + }); +}); |