generated from nhcarrigan/template
Naomi Carrigan
857b8d331b
### Explanation _No response_ ### Issue _No response_ ### Attestations - [x] I have read and agree to the [Code of Conduct](https://docs.nhcarrigan.com/community/coc/) - [x] I have read and agree to the [Community Guidelines](https://docs.nhcarrigan.com/community/guide/). - [x] My contribution complies with the [Contributor Covenant](https://docs.nhcarrigan.com/dev/covenant/). ### Dependencies - [ ] I have pinned the dependencies to a specific patch version. ### Style - [x] I have run the linter and resolved any errors. - [x] My pull request uses an appropriate title, matching the conventional commit standards. - [x] My scope of feat/fix/chore/etc. correctly matches the nature of changes in my pull request. ### Tests - [x] My contribution adds new code, and I have added tests to cover it. - [ ] My contribution modifies existing code, and I have updated the tests to reflect these changes. - [x] All new and existing tests pass locally with my changes. - [x] Code coverage remains at or above the configured threshold. ### Documentation _No response_ ### Versioning Patch - My pull request introduces bug fixes ONLY. Reviewed-on: https://codeberg.org/nhcarrigan/portfolio/pulls/36 Co-authored-by: Naomi Carrigan <commits@nhcarrigan.com> Co-committed-by: Naomi Carrigan <commits@nhcarrigan.com>
118 lines
3.2 KiB
TypeScript
118 lines
3.2 KiB
TypeScript
/**
|
|
* @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);
|
|
});
|
|
});
|
|
|