import { describe, expect, it } from "vitest"; import { actionBadgeStyle, avatarColorFor, CATEGORY_STYLES, STATUS_STYLES } from "@/lib/colors"; describe("avatarColorFor", () => { it("is deterministic for the same seed", () => { expect(avatarColorFor("Maria Gruber")).toBe(avatarColorFor("Maria Gruber")); }); it("returns a value from the fixed palette (a hex color)", () => { expect(avatarColorFor("Anna Huber")).toMatch(/^#[0-9a-f]{6}$/i); }); }); describe("STATUS_STYLES", () => { it("has an entry for every employment status", () => { expect(Object.keys(STATUS_STYLES).sort()).toEqual(["Aktiv", "Ausgetreten", "Geplant", "Karenz"].sort()); }); }); describe("actionBadgeStyle", () => { it("maps known audit actions to their category style", () => { expect(actionBadgeStyle("Austritt")).toBe(STATUS_STYLES.Ausgetreten); expect(actionBadgeStyle("Neueinstellung")).toBe(STATUS_STYLES.Aktiv); }); // Gegen CATEGORY_STYLES.brand geprüft und nicht gegen einen abgetippten // Klassennamen: welche Farbe der Chip ohne eigene Bedeutung trägt, ist eine // Frage der Palette und hat sich mit der Umstellung auf das Manner-CD schon // einmal geändert. Der Test soll die Zuordnung sichern, nicht den Farbton. it("falls back to the neutral category style for an unknown action", () => { expect(actionBadgeStyle("Irgendwas Unbekanntes")).toBe(CATEGORY_STYLES.brand); }); });