1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 20:08:13 +00:00

LibWeb: Add tests for atob() and btoa()

This commit is contained in:
Nico Weber 2020-07-23 09:10:49 -04:00 committed by Andreas Kling
parent 60599d03dd
commit a92f7aea7a
2 changed files with 24 additions and 5 deletions

View file

@ -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==");
});
});