import { describe, it, expect } from "vitest";
import { colorBg } from "./color_bg";

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

  it("hex valido produce color-mix con 18 porciento", () => {
    expect(colorBg("#0ea5e9")).toBe(
      "color-mix(in srgb, #0ea5e9 18%, var(--mantine-color-dark-6))"
    );
  });

  it("hex de 3 digitos es valido", () => {
    expect(colorBg("#0ea")).toBe(
      "color-mix(in srgb, #0ea 18%, var(--mantine-color-dark-6))"
    );
  });

  it("token mantine produce color-mix con tono -9", () => {
    expect(colorBg("blue")).toBe(
      "color-mix(in srgb, var(--mantine-color-blue-9) 18%, var(--mantine-color-dark-6))"
    );
    expect(colorBg("red")).toBe(
      "color-mix(in srgb, var(--mantine-color-red-9) 18%, var(--mantine-color-dark-6))"
    );
  });

  it("valor desconocido retorna dark-6", () => {
    expect(colorBg("unknown")).toBe("var(--mantine-color-dark-6)");
    expect(colorBg("sky-blue")).toBe("var(--mantine-color-dark-6)");
  });
});
