Files
cobble/src/utils/url-base64-to-uint8-array.test.ts
T
tben dbfe48796b Make the app an installable PWA with phone layout and Web Push
Add a generated manifest, icon set, offline page and service worker that never caches authenticated HTML, plus install and update UI. Turn the rail into a drawer below md with container-query internals, dvh and safe-area handling, and reconnect the socket after visibility/network changes. Add Web Push subscriptions, presence-aware delivery, notification settings and tests.
2026-10-19 17:12:16 +01:00

22 lines
683 B
TypeScript

import { describe, expect, test } from "bun:test";
import urlBase64ToUint8Array from "./url-base64-to-uint8-array";
describe("urlBase64ToUint8Array", () => {
test("decodes base64url without padding", () => {
expect([...urlBase64ToUint8Array("AQID")]).toEqual([1, 2, 3]);
});
test("handles the URL-safe characters and missing padding", () => {
const bytes = urlBase64ToUint8Array("-_8");
expect([...bytes]).toEqual([0xfb, 0xff]);
});
test("returns a fresh typed array", () => {
const bytes = urlBase64ToUint8Array("AQID");
expect(bytes).toBeInstanceOf(Uint8Array);
expect(bytes.byteLength).toBe(3);
});
});