Open History to see the last commit
1import { expect, it } from "vite-plus/test";
2
3import { archiveImageUrl } from "./archiveImageUrl";
4
5it("shows an archived SVG from a data URL", () => {
6 const svg = new TextEncoder().encode('<svg xmlns="http://www.w3.org/2000/svg"><rect/></svg>');
7 for (const path of ["art/logo.svg", "LOGO.SVG"]) {
8 expect(archiveImageUrl(path, svg).url).toBe(
9 `data:image/svg+xml;base64,${btoa(String.fromCharCode(...svg))}`,
10 );
11 }
12 const png = archiveImageUrl("art/logo.png", new Uint8Array([137, 80, 78, 71]));
13 expect(png.url).toMatch(/^blob:/);
14 png.revoke();
15});