Files
florian.wildeandClaude Opus 5 0ae96a50cd feat(hosts): Host-Tabelle mit Filtern, CSV-Export und Detailansicht (#007)
Suche ueber Hostname, Key, Server-ID, IP und Rechnungsnummer, fuenf Filter,
Sortierung mit nulls-last, Seitenblaettern und CSV-Export. Detailansicht mit
sechs Tabs, Notizen, Tags und Token-Widerruf. 59 Tests.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-17 21:12:41 +02:00

25 lines
901 B
TypeScript
Raw Permalink Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import { describe, expect, it } from "vitest";
import { csvDatei, csvZelle } from "@/lib/csv";
describe("CSV-Export", () => {
it("formatiert Werte deutsch", () => {
expect(csvZelle(new Date("2027-03-02T00:00:00Z"))).toBe("02.03.2027");
expect(csvZelle(1)).toBe("1");
expect(csvZelle(1234.5)).toBe("1.234,50");
expect(csvZelle(null)).toBe("");
expect(csvZelle(undefined)).toBe("");
});
it("maskiert Semikolon, Anführungszeichen und Zeilenumbrüche", () => {
expect(csvZelle("Firma; GmbH")).toBe('"Firma; GmbH"');
expect(csvZelle('Er sagte "hallo"')).toBe('"Er sagte ""hallo"""');
expect(csvZelle("Zeile1\nZeile2")).toBe('"Zeile1\nZeile2"');
});
it("schreibt BOM und Zeilenenden für Excel", () => {
const datei = csvDatei(["A", "B"], [["x", 2]]);
expect(datei.startsWith("")).toBe(true);
expect(datei).toContain("A;B\r\nx;2\r\n");
});
});