Automatiska tester, och rättningar som testerna hittade

Vitest med enhetstester utan databas och databastester mot en egen
testdatabas vars namn måste sluta på _test. Rättar tomma MAP_*-värden
i .env och säkerhetskopior med å, ä och ö i filnamnet.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
bobbanandClaude Sonnet 5.5 committed 2026-11-01 23:19:30 +01:00
1 parent 4e8d79ee10
commit dcb5d43429
30 files changed
+2872 -13

No files matched your search

+22
View File
@@ -0,0 +1,22 @@
import { describe, expect, it } from "vitest";
import { formatBytes, formatDuration } from "@/lib/format";
describe("formatBytes", () => {
it("visar storlekar med svenskt decimaltecken", () => {
expect(formatBytes(0)).toBe("0 B");
expect(formatBytes(1023)).toBe("1023 B");
expect(formatBytes(1536)).toBe("1,5 KB");
expect(formatBytes(1024 * 1024)).toBe("1,0 MB");
expect(formatBytes(150 * 1024 * 1024)).toBe("150 MB");
expect(formatBytes(3 * 1024 ** 3)).toBe("3,0 GB");
});
});
describe("formatDuration", () => {
it("visar dagar, timmar och minuter", () => {
expect(formatDuration(59)).toBe("0 min");
expect(formatDuration(3600)).toBe("1 h 0 min");
expect(formatDuration(93784)).toBe("1 d 2 h 3 min");
expect(formatDuration(86400)).toBe("1 d 0 h 0 min");
});
});