Files
overlord/Overlord-Server/src/qr.test.ts
T
2026-06-01 16:37:23 -05:00

21 lines
666 B
TypeScript

import { describe, expect, test } from "bun:test";
import { createQrSvg } from "./qr";
describe("qr svg", () => {
test("creates an inline SVG QR for otpauth payloads", () => {
const svg = createQrSvg(
"otpauth://totp/Overlord:admin?secret=JBSWY3DPEHPK3PXP&issuer=Overlord&algorithm=SHA1&digits=6&period=30",
);
expect(svg).toContain("<svg");
expect(svg).toContain("aria-label=\"MFA setup QR code\"");
expect(svg).toContain("<rect");
});
test("supports larger payloads through the QR library", () => {
const svg = createQrSvg("x".repeat(200));
expect(svg).toContain("<svg");
expect(svg).toContain("viewBox=");
});
});