import { parseColor } from "./parseColor";

describe("parseColor", () => {
  it("should parse hex color", () => {
    expect(parseColor("#FF0000")).toEqual({ r: 255, g: 0, b: 0 });
    expect(parseColor("00FF00")).toEqual({ r: 0, g: 255, b: 0 });
  });

  it("should parse rgb color", () => {
    expect(parseColor("rgb(0, 0, 255)")).toEqual({ r: 0, g: 0, b: 255, a: 1 });
  });

  it("should parse rgba color", () => {
    expect(parseColor("rgba(0, 0, 255, 0.5)")).toEqual({
      r: 0,
      g: 0,
      b: 255,
      a: 0.5,
    });
  });

  it("should default alpha to 1 if not provided in rgba-like pattern", () => {
    expect(parseColor("rgba(0, 0, 255)")).toEqual({ r: 0, g: 0, b: 255, a: 1 });
  });
});
