1import { describe, expect, it } from "vite-plus/test";
2
3import { describeOversizedThemeFile, MAX_THEME_FILE_BYTES } from "./ThemeImportDialog";
4
5describe("theme import size guard", () => {
6 it("accepts anything a theme file could plausibly be", () => {
7 for (const bytes of [0, 4_096, MAX_THEME_FILE_BYTES]) {
8 expect(describeOversizedThemeFile(bytes)).toBeNull();
9 }
10 });
11
12 it("rejects a file too large to be a theme and names its size", () => {
13 const message = describeOversizedThemeFile(100 * 1024 * 1024);
14 expect(message).toContain("100.0 MB");
15 expect(message).toContain("256 KB");
16 });
17
18 it("reports sizes just past the limit in KB", () => {
19 expect(describeOversizedThemeFile(MAX_THEME_FILE_BYTES + 1)).toContain("256 KB");
20 });
21});