summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibWeb/Tests/Window/Base64.js
blob: f37c5a7c5cb8054eef733aecec8b8216830df4c5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
describe("Base64", () => {
    loadLocalPage("/res/html/misc/blank.html");

    afterInitialPageLoad(page => {
        test("atob", () => {
            expect(page.atob("YQ==")).toBe("a");
            expect(page.atob("YWE=")).toBe("aa");
            expect(page.atob("YWFh")).toBe("aaa");
            expect(page.atob("YWFhYQ==")).toBe("aaaa");
            expect(page.atob("/w==")).toBe("\xff");
        });

        test("btoa", () => {
            expect(page.btoa("a")).toBe("YQ==");
            expect(page.btoa("aa")).toBe("YWE=");
            expect(page.btoa("aaa")).toBe("YWFh");
            expect(page.btoa("aaaa")).toBe("YWFhYQ==");
            expect(page.btoa("\xff")).toBe("/w==");
        });
    });
    waitForPageToLoad();
});