import { describe, it, expect } from "vitest";
import { colorSwatch } from "./color_swatch";

describe("colorSwatch", () => {
  it("string vacio retorna dark-3", () => {
    expect(colorSwatch("")).toBe("var(--mantine-color-dark-3)");
  });

  it("hex valido retorna el hex sin modificar", () => {
    expect(colorSwatch("#0ea5e9")).toBe("#0ea5e9");
    expect(colorSwatch("#dc2626")).toBe("#dc2626");
  });

  it("hex de 3 digitos retorna hex de 3 digitos", () => {
    expect(colorSwatch("#0ea")).toBe("#0ea");
  });

  it("token mantine retorna css var tono -7", () => {
    expect(colorSwatch("blue")).toBe("var(--mantine-color-blue-7)");
    expect(colorSwatch("grape")).toBe("var(--mantine-color-grape-7)");
  });

  it("valor desconocido retorna dark-3", () => {
    expect(colorSwatch("unknown")).toBe("var(--mantine-color-dark-3)");
  });
});
