/**
 * @copyright nhcarrigan
 * @license Naomi's Public License
 * @author Naomi Carrigan
 */
import { faBriefcase, faMoneyBill } from "@fortawesome/free-solid-svg-icons";
import { describe, it, expect } from "vitest";
import { HireMe, Donate, Socials } from "../../src/config/Socials";

describe("socials objects", () => {
  it("should have unique labels", () => {
    expect.assertions(1);
    const set = new Set(
      Socials.map((s) => {
        return s.label;
      }),
    );
    expect(set, "are not unique").toHaveLength(Socials.length);
  });

  it("should have unique links", () => {
    expect.assertions(1);
    const set = new Set(
      Socials.map((s) => {
        return s.link;
      }),
    );
    expect(set, "are not unique").toHaveLength(Socials.length);
  });

  it("should have unique icons", () => {
    expect.assertions(1);
    const set = new Set(
      Socials.map((s) => {
        return s.icon;
      }),
    );
    expect(set, "are not unique").toHaveLength(Socials.length);
  });

  it("should have hex codes for colours", () => {
    expect.hasAssertions();
    for (const social of Socials) {
      expect(social.color, `${social.label} is not a hex code`).toMatch(/^#[\da-f]{6}$/i);
      expect(social.background, `${social.label} is not a hex code`).toMatch(/^#[\da-f]{6}$/i);
    }
  });
});

describe("hire me object", () => {
  it("should have correct label", () => {
    expect.assertions(1);
    expect(HireMe.label, "does not").toBe("Hire Us!");
  });

  it("should have correct link", () => {
    expect.assertions(1);
    expect(HireMe.link, "does not").
      toBe("https://docs.nhcarrigan.com/about/hire/");
  });

  it("should have correct colours", () => {
    expect.assertions(2);
    expect(HireMe.color, "colour is wrong").toBe("#003600");
    expect(HireMe.background, "background is wrong").toBe(`linear-gradient(
              90deg,
              #5bcefa,
              #f5a9b8,
              #ffffff,
              #f5a9b8,
              #5bcefa
            )`);
  });

  it("should have correct icon", () => {
    expect.assertions(1);
    expect(HireMe.icon, "does not").toBe(faBriefcase);
  });
});

describe("donate object", () => {
  it("should have correct label", () => {
    expect.assertions(1);
    expect(Donate.label, "does not").toBe("Donate 💜");
  });

  it("should have correct link", () => {
    expect.assertions(1);
    expect(Donate.link, "does not").
      toBe("https://docs.nhcarrigan.com/about/donate/");
  });

  it("should have correct colours", () => {
    expect.assertions(2);
    expect(Donate.color, "has wrong colour").toBe("#003600");
    expect(Donate.background, "has wrong background").toBe(`linear-gradient(
              90deg,
              rgba(255, 0, 0, 1) 0%,
              rgba(251, 7, 217, 1) 10%,
              rgba(186, 12, 248, 1) 20%,
              rgba(95, 21, 242, 1) 30%,
              rgba(28, 127, 238, 1) 40%,
              rgba(47, 201, 226, 1) 50%,
              rgba(63, 218, 216, 1) 60%,
              rgba(79, 220, 74, 1) 70%,
              rgba(208, 222, 33, 1) 80%,
              rgba(255, 154, 0, 1) 90%,
              rgba(255, 0, 0, 1) 100%
            )`);
  });

  it("should have correct icon", () => {
    expect.assertions(1);
    expect(Donate.icon, "does not").toBe(faMoneyBill);
  });
});