feat: run vitest on non-component files (#35)

### Explanation

This gives us coverage for all of our non-rendering logic, so we can use Playwright E2E testing for the actual components.

### 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

- [x] 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.
- [x] 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

Major - My pull request introduces a breaking change.

Reviewed-on: https://codeberg.org/nhcarrigan/portfolio/pulls/35
Co-authored-by: Naomi Carrigan <commits@nhcarrigan.com>
Co-committed-by: Naomi Carrigan <commits@nhcarrigan.com>
This commit is contained in:
2024-10-31 01:54:12 +00:00
committed by Naomi the Technomancer
parent fe370dabb5
commit c43635fa44
42 changed files with 3045 additions and 36 deletions
+100
View File
@@ -0,0 +1,100 @@
/**
* @copyright nhcarrigan
* @license Naomi's Public License
* @author Naomi Carrigan
*/
/* eslint-disable new-cap */
import { NextResponse } from "next/server";
import { describe, it, expect, vi } from "vitest";
import { GET } from "../../../../src/app/api/activity/route";
import { getCodebergData } from "../../../../src/lib/codeberg";
import { getGithubData } from "../../../../src/lib/github";
vi.mock("../../../../src/lib/codeberg");
vi.mock("../../../../src/lib/github");
describe("gET /api/activity", () => {
it("should return a sorted and limited list of activities", async() => {
expect.assertions(2);
const mockCodebergData = [
{
created: "2023-01-01T00:00:00Z",
op_type: "push",
repo: { full_name: "repo1", html_url: "https://codeberg.org/repo1" },
},
];
const mockGithubData = [
{
created_at: "2023-01-02T00:00:00Z",
repo: {
name: "repo2",
url: "https://api.github.com/repos/repo2",
},
type: "pull_request",
},
];
vi.mocked(getCodebergData).mockResolvedValue(mockCodebergData);
vi.mocked(getGithubData).mockResolvedValue(mockGithubData);
const response = await GET();
const json = await response.json();
expect(response, "did not respond with Next").toBeInstanceOf(NextResponse);
expect(json, "incorrect payload").toStrictEqual([
{
date: "2023-01-02T00:00:00.000Z",
repo: "https://github.com/repo2",
repoName: "repo2",
type: "pull_request",
},
{
date: "2023-01-01T00:00:00.000Z",
repo: "https://codeberg.org/repo1",
repoName: "repo1",
type: "push",
},
]);
});
it("should handle empty data from both sources", async() => {
expect.assertions(2);
vi.mocked(getCodebergData).mockResolvedValue([]);
vi.mocked(getGithubData).mockResolvedValue([]);
const response = await GET();
const json = await response.json();
expect(response, "did not use Next to respond").
toBeInstanceOf(NextResponse);
expect(json, "was not empty array").toStrictEqual([]);
});
it("should limit the results to 100 entries", async() => {
expect.assertions(2);
const mockCodebergData = Array.from({ length: 60 }, (_, index) => {
return {
created: `2023-01-${index + 1}T00:00:00Z`,
op_type: "push",
repo: { full_name: `repo${index + 1}`, html_url: `https://codeberg.org/repo${index + 1}` },
};
});
const mockGithubData = Array.from({ length: 60 }, (_, index) => {
return {
created_at: `2023-02-${index + 1}T00:00:00Z`,
repo: { name: `repo${index + 61}`, url: `https://api.github.com/repos/repo${index + 61}` },
type: "pull_request",
};
});
vi.mocked(getCodebergData).mockResolvedValue(mockCodebergData);
vi.mocked(getGithubData).mockResolvedValue(mockGithubData);
const response = await GET();
const json = await response.json();
expect(response, "did not use Next to respond").
toBeInstanceOf(NextResponse);
expect(json, "did not limit to 100 entries").toHaveLength(100);
});
});
+37
View File
@@ -0,0 +1,37 @@
/**
* @copyright nhcarrigan
* @license Naomi's Public License
* @author Naomi Carrigan
*/
import { describe, it, expect } from "vitest";
import { Art } from "../../src/config/Art";
describe("art objects", () => {
it("should have unique names", () => {
expect.assertions(1);
const set = new Set(
Art.map((a) => {
return a.name;
}),
);
expect(set, "are not unique").toHaveLength(Art.length);
});
it("should have unique img properties", () => {
expect.assertions(1);
const set = new Set(
Art.map((a) => {
return a.img;
}),
);
expect(set, "are not unique").toHaveLength(Art.length);
});
it("should have alt text", () => {
expect.assertions(1);
const noText = Art.filter((a) => {
return a.alt.length === 0;
});
expect(noText, "found missing alt").toHaveLength(0);
});
});
+29
View File
@@ -0,0 +1,29 @@
/**
* @copyright nhcarrigan
* @license Naomi's Public License
* @author Naomi Carrigan
*/
import { describe, it, expect } from "vitest";
import { Certifications } from "../../src/config/Certifications";
describe("certification objects", () => {
it("should have unique names", () => {
expect.assertions(1);
const set = new Set(
Certifications.map((c) => {
return c.name;
}),
);
expect(set, "are not unique").toHaveLength(Certifications.length);
});
it("should have unique file names", () => {
expect.assertions(1);
const set = new Set(
Certifications.map((c) => {
return c.fileName;
}),
);
expect(set, "are not unique").toHaveLength(Certifications.length);
});
});
+47
View File
@@ -0,0 +1,47 @@
/**
* @copyright nhcarrigan
* @license Naomi's Public License
* @author Naomi Carrigan
*/
import { describe, it, expect } from "vitest";
import { Games } from "../../src/config/Games";
describe("games objects", () => {
it("should have unique names", () => {
expect.assertions(1);
const set = new Set(
Games.map((g) => {
return g.name;
}),
);
expect(set, "are not unique").toHaveLength(Games.length);
});
it("should have unique img properties", () => {
expect.assertions(1);
const set = new Set(
Games.map((g) => {
return g.img;
}),
);
expect(set, "are not unique").toHaveLength(Games.length);
});
it("should have unique urls", () => {
expect.assertions(1);
const set = new Set(
Games.map((g) => {
return g.url;
}),
);
expect(set, "are not unique").toHaveLength(Games.length);
});
it("should have alt text", () => {
expect.assertions(1);
const noText = Games.filter((g) => {
return g.alt.length === 0;
});
expect(noText, "found missing alt").toHaveLength(0);
});
});
+33
View File
@@ -0,0 +1,33 @@
/**
* @copyright nhcarrigan
* @license Naomi's Public License
* @author Naomi Carrigan
*/
import { describe, it, expect } from "vitest";
import { Jobs } from "../../src/config/Jobs";
describe("jobs objects", () => {
it("should have correct start dates", () => {
expect.hasAssertions();
for (const job of Jobs.slice(1)) {
expect(job.start.getDate(), `${job.title} has bad start`).toBe(5);
}
});
it("should have correct end dates", () => {
expect.hasAssertions();
for (const job of Jobs.slice(1)) {
if (!job.end) {
continue;
}
expect(job.end.getDate(), `${job.title} has bad end`).toBe(5);
}
});
it("should have no future start dates", () => {
expect.hasAssertions();
expect(Jobs.filter((job) => {
return job.start > new Date();
}), "have future start dates").toHaveLength(0);
});
});
+30
View File
@@ -0,0 +1,30 @@
/**
* @copyright nhcarrigan
* @license Naomi's Public License
* @author Naomi Carrigan
*/
import { describe, it, expect } from "vitest";
import { NavItems } from "../../src/config/NavItems";
describe("nav items", () => {
it("should be unique", () => {
expect.assertions(2);
const href = new Set(
NavItems.map((n) => {
return n.href;
}),
);
const text = new Set(NavItems.map((n) => {
return n.text;
}));
expect(href, "links are not unique").toHaveLength(NavItems.length);
expect(text, "names are not unique").toHaveLength(NavItems.length);
});
it("should be internal links", () => {
expect.hasAssertions();
for (const nav of NavItems) {
expect(nav.href, `${nav.href} is not internal`).toMatch(/^\/[\da-z-]+$/);
}
});
});
+29
View File
@@ -0,0 +1,29 @@
/**
* @copyright nhcarrigan
* @license Naomi's Public License
* @author Naomi Carrigan
*/
import { describe, it, expect } from "vitest";
import { Partners } from "../../src/config/Partners";
describe("partner objects", () => {
it("should have unique names", () => {
expect.assertions(1);
const set = new Set(
Partners.map((p) => {
return p.name;
}),
);
expect(set, "are not unique").toHaveLength(Partners.length);
});
it("should have unique avatars", () => {
expect.assertions(1);
const set = new Set(
Partners.map((p) => {
return p.avatar;
}),
);
expect(set, "are not unique").toHaveLength(Partners.length);
});
});
+109
View File
@@ -0,0 +1,109 @@
/**
* @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);
});
});
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);
});
});
+36
View File
@@ -0,0 +1,36 @@
/**
* @copyright nhcarrigan
* @license Naomi's Public License
* @author Naomi Carrigan
*/
import { describe, it, expect } from "vitest";
import { TeamMembers } from "../../src/config/TeamMembers";
describe("partner objects", () => {
it("should have unique names", () => {
expect.assertions(1);
const set = new Set(
TeamMembers.map((t) => {
return t.name;
}),
);
expect(set, "are not unique").toHaveLength(TeamMembers.length);
});
it("should have unique avatars", () => {
expect.assertions(1);
const set = new Set(
TeamMembers.map((t) => {
return t.avatar;
}),
);
expect(set, "are not unique").toHaveLength(TeamMembers.length);
});
it("should have no future dates", () => {
expect.assertions(1);
expect(TeamMembers.filter((t) => {
return new Date(t.joinDate) > new Date();
}), "have future dates").toHaveLength(0);
});
});
+26
View File
@@ -0,0 +1,26 @@
/**
* @copyright nhcarrigan
* @license Naomi's Public License
* @author Naomi Carrigan
*/
import { describe, it, expect } from "vitest";
import { Testimonials } from "../../src/config/Testimonials";
describe("testimonial objects", () => {
it("should have unique names", () => {
expect.assertions(1);
const set = new Set(
Testimonials.map((t) => {
return t.name;
}),
);
expect(set, "are not unique").toHaveLength(Testimonials.length);
});
it("should have no future dates", () => {
expect.assertions(1);
expect(Testimonials.filter((t) => {
return new Date(t.date) > new Date();
}), "have future dates").toHaveLength(0);
});
});
+38
View File
@@ -0,0 +1,38 @@
/**
* @copyright nhcarrigan
* @license Naomi's Public License
* @author Naomi Carrigan
*/
import { describe, it, expect } from "vitest";
import { Codeberg } from "../../src/icons/Codeberg";
describe("codeberg icon", () => {
it("should have a valid width", () => {
expect.assertions(1);
expect(Codeberg.icon[0], "width is negative").toBeGreaterThan(0);
});
it("should have a valid height", () => {
expect.assertions(1);
expect(Codeberg.icon[1], "height is negative").toBeGreaterThan(0);
});
it("should not have any ligatures", () => {
expect.assertions(1);
expect(Codeberg.icon[2], "ligatures are present").toStrictEqual([]);
});
it("should have a valid unicode set", () => {
expect.assertions(1);
expect(Codeberg.icon[3], "unicode set is wrong").toBe("U+E002");
});
it("should have valid SVG path data", () => {
expect.assertions(1);
expect(Codeberg.icon[4], "path data is bad").toMatch(
// eslint-disable-next-line stylistic/max-len
/(?:[lm]\s?-?(?:(?:\d+(?:\.\d+)?)|(?:\.\d+))[\s,]?-?(?:(?:\d+(?:\.\d+)?)|(?:\.\d+)))|(?:[hv]\s?-?(?:(?:\d+(?:\.\d+)?)|(?:\.\d+)))|(?:c\s?-?(?:(?:\d+(?:\.\d+)?)|(?:\.\d+))(?:[\s,]?-?(?:(?:\d+(?:\.\d+)?)|(?:\.\d+))){5})|(?:q\s?-?(?:(?:\d+(?:\.\d+)?)|(?:\.\d+))(?:[\s,]?-?(?:(?:\d+(?:\.\d+)?)|(?:\.\d+))){3}(?:\s?t?\s?-?(?:(?:\d+(?:\.\d+)?)|(?:\.\d+))[\s,]?-?(?:(?:\d+(?:\.\d+)?)|(?:\.\d+)))*)|(?:a\s?-?(?:(?:\d+(?:\.\d+)?)|(?:\.\d+))(?:[\s,]?-?(?:(?:\d+(?:\.\d+)?)|(?:\.\d+))){2}[\s,]?(?:[01][\s,]+){2}(?:[\s,]?-?(?:(?:\d+(?:\.\d+)?)|(?:\.\d+))){2})|(?:s\s?-?(?:(?:\d+(?:\.\d+)?)|(?:\.\d+))(?:[\s,]?-?(?:(?:\d+(?:\.\d+)?)|(?:\.\d+))){3})|z/gi,
);
});
});
+38
View File
@@ -0,0 +1,38 @@
/**
* @copyright nhcarrigan
* @license Naomi's Public License
* @author Naomi Carrigan
*/
import { describe, it, expect } from "vitest";
import { Coursera } from "../../src/icons/Coursera";
describe("coursera icon", () => {
it("should have a valid width", () => {
expect.assertions(1);
expect(Coursera.icon[0], "width is negative").toBeGreaterThan(0);
});
it("should have a valid height", () => {
expect.assertions(1);
expect(Coursera.icon[1], "height is negative").toBeGreaterThan(0);
});
it("should not have any ligatures", () => {
expect.assertions(1);
expect(Coursera.icon[2], "ligatures are present").toStrictEqual([]);
});
it("should have a valid unicode set", () => {
expect.assertions(1);
expect(Coursera.icon[3], "unicode set is wrong").toBe("U+E002");
});
it("should have valid SVG path data", () => {
expect.assertions(1);
expect(Coursera.icon[4], "path data is bad").toMatch(
// eslint-disable-next-line stylistic/max-len
/(?:[lm]\s?-?(?:(?:\d+(?:\.\d+)?)|(?:\.\d+))[\s,]?-?(?:(?:\d+(?:\.\d+)?)|(?:\.\d+)))|(?:[hv]\s?-?(?:(?:\d+(?:\.\d+)?)|(?:\.\d+)))|(?:c\s?-?(?:(?:\d+(?:\.\d+)?)|(?:\.\d+))(?:[\s,]?-?(?:(?:\d+(?:\.\d+)?)|(?:\.\d+))){5})|(?:q\s?-?(?:(?:\d+(?:\.\d+)?)|(?:\.\d+))(?:[\s,]?-?(?:(?:\d+(?:\.\d+)?)|(?:\.\d+))){3}(?:\s?t?\s?-?(?:(?:\d+(?:\.\d+)?)|(?:\.\d+))[\s,]?-?(?:(?:\d+(?:\.\d+)?)|(?:\.\d+)))*)|(?:a\s?-?(?:(?:\d+(?:\.\d+)?)|(?:\.\d+))(?:[\s,]?-?(?:(?:\d+(?:\.\d+)?)|(?:\.\d+))){2}[\s,]?(?:[01][\s,]+){2}(?:[\s,]?-?(?:(?:\d+(?:\.\d+)?)|(?:\.\d+))){2})|(?:s\s?-?(?:(?:\d+(?:\.\d+)?)|(?:\.\d+))(?:[\s,]?-?(?:(?:\d+(?:\.\d+)?)|(?:\.\d+))){3})|z/gi,
);
});
});
+38
View File
@@ -0,0 +1,38 @@
/**
* @copyright nhcarrigan
* @license Naomi's Public License
* @author Naomi Carrigan
*/
import { describe, it, expect } from "vitest";
import { Fiverr } from "../../src/icons/Fiverr";
describe("fiverr icon", () => {
it("should have a valid width", () => {
expect.assertions(1);
expect(Fiverr.icon[0], "width is negative").toBeGreaterThan(0);
});
it("should have a valid height", () => {
expect.assertions(1);
expect(Fiverr.icon[1], "height is negative").toBeGreaterThan(0);
});
it("should not have any ligatures", () => {
expect.assertions(1);
expect(Fiverr.icon[2], "ligatures are present").toStrictEqual([]);
});
it("should have a valid unicode set", () => {
expect.assertions(1);
expect(Fiverr.icon[3], "unicode set is wrong").toBe("U+E002");
});
it("should have valid SVG path data", () => {
expect.assertions(1);
expect(Fiverr.icon[4], "path data is bad").toMatch(
// eslint-disable-next-line stylistic/max-len
/(?:[lm]\s?-?(?:(?:\d+(?:\.\d+)?)|(?:\.\d+))[\s,]?-?(?:(?:\d+(?:\.\d+)?)|(?:\.\d+)))|(?:[hv]\s?-?(?:(?:\d+(?:\.\d+)?)|(?:\.\d+)))|(?:c\s?-?(?:(?:\d+(?:\.\d+)?)|(?:\.\d+))(?:[\s,]?-?(?:(?:\d+(?:\.\d+)?)|(?:\.\d+))){5})|(?:q\s?-?(?:(?:\d+(?:\.\d+)?)|(?:\.\d+))(?:[\s,]?-?(?:(?:\d+(?:\.\d+)?)|(?:\.\d+))){3}(?:\s?t?\s?-?(?:(?:\d+(?:\.\d+)?)|(?:\.\d+))[\s,]?-?(?:(?:\d+(?:\.\d+)?)|(?:\.\d+)))*)|(?:a\s?-?(?:(?:\d+(?:\.\d+)?)|(?:\.\d+))(?:[\s,]?-?(?:(?:\d+(?:\.\d+)?)|(?:\.\d+))){2}[\s,]?(?:[01][\s,]+){2}(?:[\s,]?-?(?:(?:\d+(?:\.\d+)?)|(?:\.\d+))){2})|(?:s\s?-?(?:(?:\d+(?:\.\d+)?)|(?:\.\d+))(?:[\s,]?-?(?:(?:\d+(?:\.\d+)?)|(?:\.\d+))){3})|z/gi,
);
});
});
+38
View File
@@ -0,0 +1,38 @@
/**
* @copyright nhcarrigan
* @license Naomi's Public License
* @author Naomi Carrigan
*/
import { describe, it, expect } from "vitest";
import { Gather } from "../../src/icons/Gather";
describe("gather icon", () => {
it("should have a valid width", () => {
expect.assertions(1);
expect(Gather.icon[0], "width is negative").toBeGreaterThan(0);
});
it("should have a valid height", () => {
expect.assertions(1);
expect(Gather.icon[1], "height is negative").toBeGreaterThan(0);
});
it("should not have any ligatures", () => {
expect.assertions(1);
expect(Gather.icon[2], "ligatures are present").toStrictEqual([]);
});
it("should have a valid unicode set", () => {
expect.assertions(1);
expect(Gather.icon[3], "unicode set is wrong").toBe("U+E002");
});
it("should have valid SVG path data", () => {
expect.assertions(1);
expect(Gather.icon[4], "path data is bad").toMatch(
// eslint-disable-next-line stylistic/max-len
/(?:[lm]\s?-?(?:(?:\d+(?:\.\d+)?)|(?:\.\d+))[\s,]?-?(?:(?:\d+(?:\.\d+)?)|(?:\.\d+)))|(?:[hv]\s?-?(?:(?:\d+(?:\.\d+)?)|(?:\.\d+)))|(?:c\s?-?(?:(?:\d+(?:\.\d+)?)|(?:\.\d+))(?:[\s,]?-?(?:(?:\d+(?:\.\d+)?)|(?:\.\d+))){5})|(?:q\s?-?(?:(?:\d+(?:\.\d+)?)|(?:\.\d+))(?:[\s,]?-?(?:(?:\d+(?:\.\d+)?)|(?:\.\d+))){3}(?:\s?t?\s?-?(?:(?:\d+(?:\.\d+)?)|(?:\.\d+))[\s,]?-?(?:(?:\d+(?:\.\d+)?)|(?:\.\d+)))*)|(?:a\s?-?(?:(?:\d+(?:\.\d+)?)|(?:\.\d+))(?:[\s,]?-?(?:(?:\d+(?:\.\d+)?)|(?:\.\d+))){2}[\s,]?(?:[01][\s,]+){2}(?:[\s,]?-?(?:(?:\d+(?:\.\d+)?)|(?:\.\d+))){2})|(?:s\s?-?(?:(?:\d+(?:\.\d+)?)|(?:\.\d+))(?:[\s,]?-?(?:(?:\d+(?:\.\d+)?)|(?:\.\d+))){3})|z/gi,
);
});
});
+38
View File
@@ -0,0 +1,38 @@
/**
* @copyright nhcarrigan
* @license Naomi's Public License
* @author Naomi Carrigan
*/
import { describe, it, expect } from "vitest";
import { Gog } from "../../src/icons/Gog";
describe("gog icon", () => {
it("should have a valid width", () => {
expect.assertions(1);
expect(Gog.icon[0], "width is negative").toBeGreaterThan(0);
});
it("should have a valid height", () => {
expect.assertions(1);
expect(Gog.icon[1], "height is negative").toBeGreaterThan(0);
});
it("should not have any ligatures", () => {
expect.assertions(1);
expect(Gog.icon[2], "ligatures are present").toStrictEqual([]);
});
it("should have a valid unicode set", () => {
expect.assertions(1);
expect(Gog.icon[3], "unicode set is wrong").toBe("U+E002");
});
it("should have valid SVG path data", () => {
expect.assertions(1);
expect(Gog.icon[4], "path data is bad").toMatch(
// eslint-disable-next-line stylistic/max-len
/(?:[lm]\s?-?(?:(?:\d+(?:\.\d+)?)|(?:\.\d+))[\s,]?-?(?:(?:\d+(?:\.\d+)?)|(?:\.\d+)))|(?:[hv]\s?-?(?:(?:\d+(?:\.\d+)?)|(?:\.\d+)))|(?:c\s?-?(?:(?:\d+(?:\.\d+)?)|(?:\.\d+))(?:[\s,]?-?(?:(?:\d+(?:\.\d+)?)|(?:\.\d+))){5})|(?:q\s?-?(?:(?:\d+(?:\.\d+)?)|(?:\.\d+))(?:[\s,]?-?(?:(?:\d+(?:\.\d+)?)|(?:\.\d+))){3}(?:\s?t?\s?-?(?:(?:\d+(?:\.\d+)?)|(?:\.\d+))[\s,]?-?(?:(?:\d+(?:\.\d+)?)|(?:\.\d+)))*)|(?:a\s?-?(?:(?:\d+(?:\.\d+)?)|(?:\.\d+))(?:[\s,]?-?(?:(?:\d+(?:\.\d+)?)|(?:\.\d+))){2}[\s,]?(?:[01][\s,]+){2}(?:[\s,]?-?(?:(?:\d+(?:\.\d+)?)|(?:\.\d+))){2})|(?:s\s?-?(?:(?:\d+(?:\.\d+)?)|(?:\.\d+))(?:[\s,]?-?(?:(?:\d+(?:\.\d+)?)|(?:\.\d+))){3})|z/gi,
);
});
});
+38
View File
@@ -0,0 +1,38 @@
/**
* @copyright nhcarrigan
* @license Naomi's Public License
* @author Naomi Carrigan
*/
import { describe, it, expect } from "vitest";
import { Kofi } from "../../src/icons/KoFi";
describe("kofi icon", () => {
it("should have a valid width", () => {
expect.assertions(1);
expect(Kofi.icon[0], "width is negative").toBeGreaterThan(0);
});
it("should have a valid height", () => {
expect.assertions(1);
expect(Kofi.icon[1], "height is negative").toBeGreaterThan(0);
});
it("should not have any ligatures", () => {
expect.assertions(1);
expect(Kofi.icon[2], "ligatures are present").toStrictEqual([]);
});
it("should have a valid unicode set", () => {
expect.assertions(1);
expect(Kofi.icon[3], "unicode set is wrong").toBe("U+E002");
});
it("should have valid SVG path data", () => {
expect.assertions(1);
expect(Kofi.icon[4], "path data is bad").toMatch(
// eslint-disable-next-line stylistic/max-len
/(?:[lm]\s?-?(?:(?:\d+(?:\.\d+)?)|(?:\.\d+))[\s,]?-?(?:(?:\d+(?:\.\d+)?)|(?:\.\d+)))|(?:[hv]\s?-?(?:(?:\d+(?:\.\d+)?)|(?:\.\d+)))|(?:c\s?-?(?:(?:\d+(?:\.\d+)?)|(?:\.\d+))(?:[\s,]?-?(?:(?:\d+(?:\.\d+)?)|(?:\.\d+))){5})|(?:q\s?-?(?:(?:\d+(?:\.\d+)?)|(?:\.\d+))(?:[\s,]?-?(?:(?:\d+(?:\.\d+)?)|(?:\.\d+))){3}(?:\s?t?\s?-?(?:(?:\d+(?:\.\d+)?)|(?:\.\d+))[\s,]?-?(?:(?:\d+(?:\.\d+)?)|(?:\.\d+)))*)|(?:a\s?-?(?:(?:\d+(?:\.\d+)?)|(?:\.\d+))(?:[\s,]?-?(?:(?:\d+(?:\.\d+)?)|(?:\.\d+))){2}[\s,]?(?:[01][\s,]+){2}(?:[\s,]?-?(?:(?:\d+(?:\.\d+)?)|(?:\.\d+))){2})|(?:s\s?-?(?:(?:\d+(?:\.\d+)?)|(?:\.\d+))(?:[\s,]?-?(?:(?:\d+(?:\.\d+)?)|(?:\.\d+))){3})|z/gi,
);
});
});
+38
View File
@@ -0,0 +1,38 @@
/**
* @copyright nhcarrigan
* @license Naomi's Public License
* @author Naomi Carrigan
*/
import { describe, it, expect } from "vitest";
import { Matrix } from "../../src/icons/Matrix";
describe("matrix icon", () => {
it("should have a valid width", () => {
expect.assertions(1);
expect(Matrix.icon[0], "width is negative").toBeGreaterThan(0);
});
it("should have a valid height", () => {
expect.assertions(1);
expect(Matrix.icon[1], "height is negative").toBeGreaterThan(0);
});
it("should not have any ligatures", () => {
expect.assertions(1);
expect(Matrix.icon[2], "ligatures are present").toStrictEqual([]);
});
it("should have a valid unicode set", () => {
expect.assertions(1);
expect(Matrix.icon[3], "unicode set is wrong").toBe("U+E002");
});
it("should have valid SVG path data", () => {
expect.assertions(1);
expect(Matrix.icon[4], "path data is bad").toMatch(
// eslint-disable-next-line stylistic/max-len
/(?:[lm]\s?-?(?:(?:\d+(?:\.\d+)?)|(?:\.\d+))[\s,]?-?(?:(?:\d+(?:\.\d+)?)|(?:\.\d+)))|(?:[hv]\s?-?(?:(?:\d+(?:\.\d+)?)|(?:\.\d+)))|(?:c\s?-?(?:(?:\d+(?:\.\d+)?)|(?:\.\d+))(?:[\s,]?-?(?:(?:\d+(?:\.\d+)?)|(?:\.\d+))){5})|(?:q\s?-?(?:(?:\d+(?:\.\d+)?)|(?:\.\d+))(?:[\s,]?-?(?:(?:\d+(?:\.\d+)?)|(?:\.\d+))){3}(?:\s?t?\s?-?(?:(?:\d+(?:\.\d+)?)|(?:\.\d+))[\s,]?-?(?:(?:\d+(?:\.\d+)?)|(?:\.\d+)))*)|(?:a\s?-?(?:(?:\d+(?:\.\d+)?)|(?:\.\d+))(?:[\s,]?-?(?:(?:\d+(?:\.\d+)?)|(?:\.\d+))){2}[\s,]?(?:[01][\s,]+){2}(?:[\s,]?-?(?:(?:\d+(?:\.\d+)?)|(?:\.\d+))){2})|(?:s\s?-?(?:(?:\d+(?:\.\d+)?)|(?:\.\d+))(?:[\s,]?-?(?:(?:\d+(?:\.\d+)?)|(?:\.\d+))){3})|z/gi,
);
});
});
+38
View File
@@ -0,0 +1,38 @@
/**
* @copyright nhcarrigan
* @license Naomi's Public License
* @author Naomi Carrigan
*/
import { describe, it, expect } from "vitest";
import { Peerlist } from "../../src/icons/Peerlist";
describe("peerlist icon", () => {
it("should have a valid width", () => {
expect.assertions(1);
expect(Peerlist.icon[0], "width is negative").toBeGreaterThan(0);
});
it("should have a valid height", () => {
expect.assertions(1);
expect(Peerlist.icon[1], "height is negative").toBeGreaterThan(0);
});
it("should not have any ligatures", () => {
expect.assertions(1);
expect(Peerlist.icon[2], "ligatures are present").toStrictEqual([]);
});
it("should have a valid unicode set", () => {
expect.assertions(1);
expect(Peerlist.icon[3], "unicode set is wrong").toBe("U+E002");
});
it("should have valid SVG path data", () => {
expect.assertions(1);
expect(Peerlist.icon[4], "path data is bad").toMatch(
// eslint-disable-next-line stylistic/max-len
/(?:[lm]\s?-?(?:(?:\d+(?:\.\d+)?)|(?:\.\d+))[\s,]?-?(?:(?:\d+(?:\.\d+)?)|(?:\.\d+)))|(?:[hv]\s?-?(?:(?:\d+(?:\.\d+)?)|(?:\.\d+)))|(?:c\s?-?(?:(?:\d+(?:\.\d+)?)|(?:\.\d+))(?:[\s,]?-?(?:(?:\d+(?:\.\d+)?)|(?:\.\d+))){5})|(?:q\s?-?(?:(?:\d+(?:\.\d+)?)|(?:\.\d+))(?:[\s,]?-?(?:(?:\d+(?:\.\d+)?)|(?:\.\d+))){3}(?:\s?t?\s?-?(?:(?:\d+(?:\.\d+)?)|(?:\.\d+))[\s,]?-?(?:(?:\d+(?:\.\d+)?)|(?:\.\d+)))*)|(?:a\s?-?(?:(?:\d+(?:\.\d+)?)|(?:\.\d+))(?:[\s,]?-?(?:(?:\d+(?:\.\d+)?)|(?:\.\d+))){2}[\s,]?(?:[01][\s,]+){2}(?:[\s,]?-?(?:(?:\d+(?:\.\d+)?)|(?:\.\d+))){2})|(?:s\s?-?(?:(?:\d+(?:\.\d+)?)|(?:\.\d+))(?:[\s,]?-?(?:(?:\d+(?:\.\d+)?)|(?:\.\d+))){3})|z/gi,
);
});
});
+38
View File
@@ -0,0 +1,38 @@
/**
* @copyright nhcarrigan
* @license Naomi's Public License
* @author Naomi Carrigan
*/
import { describe, it, expect } from "vitest";
import { Pixiv } from "../../src/icons/Pixiv";
describe("pixiv icon", () => {
it("should have a valid width", () => {
expect.assertions(1);
expect(Pixiv.icon[0], "width is negative").toBeGreaterThan(0);
});
it("should have a valid height", () => {
expect.assertions(1);
expect(Pixiv.icon[1], "height is negative").toBeGreaterThan(0);
});
it("should not have any ligatures", () => {
expect.assertions(1);
expect(Pixiv.icon[2], "ligatures are present").toStrictEqual([]);
});
it("should have a valid unicode set", () => {
expect.assertions(1);
expect(Pixiv.icon[3], "unicode set is wrong").toBe("U+E002");
});
it("should have valid SVG path data", () => {
expect.assertions(1);
expect(Pixiv.icon[4], "path data is bad").toMatch(
// eslint-disable-next-line stylistic/max-len
/(?:[lm]\s?-?(?:(?:\d+(?:\.\d+)?)|(?:\.\d+))[\s,]?-?(?:(?:\d+(?:\.\d+)?)|(?:\.\d+)))|(?:[hv]\s?-?(?:(?:\d+(?:\.\d+)?)|(?:\.\d+)))|(?:c\s?-?(?:(?:\d+(?:\.\d+)?)|(?:\.\d+))(?:[\s,]?-?(?:(?:\d+(?:\.\d+)?)|(?:\.\d+))){5})|(?:q\s?-?(?:(?:\d+(?:\.\d+)?)|(?:\.\d+))(?:[\s,]?-?(?:(?:\d+(?:\.\d+)?)|(?:\.\d+))){3}(?:\s?t?\s?-?(?:(?:\d+(?:\.\d+)?)|(?:\.\d+))[\s,]?-?(?:(?:\d+(?:\.\d+)?)|(?:\.\d+)))*)|(?:a\s?-?(?:(?:\d+(?:\.\d+)?)|(?:\.\d+))(?:[\s,]?-?(?:(?:\d+(?:\.\d+)?)|(?:\.\d+))){2}[\s,]?(?:[01][\s,]+){2}(?:[\s,]?-?(?:(?:\d+(?:\.\d+)?)|(?:\.\d+))){2})|(?:s\s?-?(?:(?:\d+(?:\.\d+)?)|(?:\.\d+))(?:[\s,]?-?(?:(?:\d+(?:\.\d+)?)|(?:\.\d+))){3})|z/gi,
);
});
});
+38
View File
@@ -0,0 +1,38 @@
/**
* @copyright nhcarrigan
* @license Naomi's Public License
* @author Naomi Carrigan
*/
import { describe, it, expect } from "vitest";
import { Polywork } from "../../src/icons/Polywork";
describe("polywork icon", () => {
it("should have a valid width", () => {
expect.assertions(1);
expect(Polywork.icon[0], "width is negative").toBeGreaterThan(0);
});
it("should have a valid height", () => {
expect.assertions(1);
expect(Polywork.icon[1], "height is negative").toBeGreaterThan(0);
});
it("should not have any ligatures", () => {
expect.assertions(1);
expect(Polywork.icon[2], "ligatures are present").toStrictEqual([]);
});
it("should have a valid unicode set", () => {
expect.assertions(1);
expect(Polywork.icon[3], "unicode set is wrong").toBe("U+E002");
});
it("should have valid SVG path data", () => {
expect.assertions(1);
expect(Polywork.icon[4], "path data is bad").toMatch(
// eslint-disable-next-line stylistic/max-len
/(?:[lm]\s?-?(?:(?:\d+(?:\.\d+)?)|(?:\.\d+))[\s,]?-?(?:(?:\d+(?:\.\d+)?)|(?:\.\d+)))|(?:[hv]\s?-?(?:(?:\d+(?:\.\d+)?)|(?:\.\d+)))|(?:c\s?-?(?:(?:\d+(?:\.\d+)?)|(?:\.\d+))(?:[\s,]?-?(?:(?:\d+(?:\.\d+)?)|(?:\.\d+))){5})|(?:q\s?-?(?:(?:\d+(?:\.\d+)?)|(?:\.\d+))(?:[\s,]?-?(?:(?:\d+(?:\.\d+)?)|(?:\.\d+))){3}(?:\s?t?\s?-?(?:(?:\d+(?:\.\d+)?)|(?:\.\d+))[\s,]?-?(?:(?:\d+(?:\.\d+)?)|(?:\.\d+)))*)|(?:a\s?-?(?:(?:\d+(?:\.\d+)?)|(?:\.\d+))(?:[\s,]?-?(?:(?:\d+(?:\.\d+)?)|(?:\.\d+))){2}[\s,]?(?:[01][\s,]+){2}(?:[\s,]?-?(?:(?:\d+(?:\.\d+)?)|(?:\.\d+))){2})|(?:s\s?-?(?:(?:\d+(?:\.\d+)?)|(?:\.\d+))(?:[\s,]?-?(?:(?:\d+(?:\.\d+)?)|(?:\.\d+))){3})|z/gi,
);
});
});
+38
View File
@@ -0,0 +1,38 @@
/**
* @copyright nhcarrigan
* @license Naomi's Public License
* @author Naomi Carrigan
*/
import { describe, it, expect } from "vitest";
import { Saylor } from "../../src/icons/Saylor";
describe("saylor icon", () => {
it("should have a valid width", () => {
expect.assertions(1);
expect(Saylor.icon[0], "width is negative").toBeGreaterThan(0);
});
it("should have a valid height", () => {
expect.assertions(1);
expect(Saylor.icon[1], "height is negative").toBeGreaterThan(0);
});
it("should not have any ligatures", () => {
expect.assertions(1);
expect(Saylor.icon[2], "ligatures are present").toStrictEqual([]);
});
it("should have a valid unicode set", () => {
expect.assertions(1);
expect(Saylor.icon[3], "unicode set is wrong").toBe("U+E002");
});
it("should have valid SVG path data", () => {
expect.assertions(1);
expect(Saylor.icon[4], "path data is bad").toMatch(
// eslint-disable-next-line stylistic/max-len
/(?:[lm]\s?-?(?:(?:\d+(?:\.\d+)?)|(?:\.\d+))[\s,]?-?(?:(?:\d+(?:\.\d+)?)|(?:\.\d+)))|(?:[hv]\s?-?(?:(?:\d+(?:\.\d+)?)|(?:\.\d+)))|(?:c\s?-?(?:(?:\d+(?:\.\d+)?)|(?:\.\d+))(?:[\s,]?-?(?:(?:\d+(?:\.\d+)?)|(?:\.\d+))){5})|(?:q\s?-?(?:(?:\d+(?:\.\d+)?)|(?:\.\d+))(?:[\s,]?-?(?:(?:\d+(?:\.\d+)?)|(?:\.\d+))){3}(?:\s?t?\s?-?(?:(?:\d+(?:\.\d+)?)|(?:\.\d+))[\s,]?-?(?:(?:\d+(?:\.\d+)?)|(?:\.\d+)))*)|(?:a\s?-?(?:(?:\d+(?:\.\d+)?)|(?:\.\d+))(?:[\s,]?-?(?:(?:\d+(?:\.\d+)?)|(?:\.\d+))){2}[\s,]?(?:[01][\s,]+){2}(?:[\s,]?-?(?:(?:\d+(?:\.\d+)?)|(?:\.\d+))){2})|(?:s\s?-?(?:(?:\d+(?:\.\d+)?)|(?:\.\d+))(?:[\s,]?-?(?:(?:\d+(?:\.\d+)?)|(?:\.\d+))){3})|z/gi,
);
});
});
+38
View File
@@ -0,0 +1,38 @@
/**
* @copyright nhcarrigan
* @license Naomi's Public License
* @author Naomi Carrigan
*/
import { describe, it, expect } from "vitest";
import { TeeSpring } from "../../src/icons/TeeSpring";
describe("teespring icon", () => {
it("should have a valid width", () => {
expect.assertions(1);
expect(TeeSpring.icon[0], "width is negative").toBeGreaterThan(0);
});
it("should have a valid height", () => {
expect.assertions(1);
expect(TeeSpring.icon[1], "height is negative").toBeGreaterThan(0);
});
it("should not have any ligatures", () => {
expect.assertions(1);
expect(TeeSpring.icon[2], "ligatures are present").toStrictEqual([]);
});
it("should have a valid unicode set", () => {
expect.assertions(1);
expect(TeeSpring.icon[3], "unicode set is wrong").toBe("U+E002");
});
it("should have valid SVG path data", () => {
expect.assertions(1);
expect(TeeSpring.icon[4], "path data is bad").toMatch(
// eslint-disable-next-line stylistic/max-len
/(?:[lm]\s?-?(?:(?:\d+(?:\.\d+)?)|(?:\.\d+))[\s,]?-?(?:(?:\d+(?:\.\d+)?)|(?:\.\d+)))|(?:[hv]\s?-?(?:(?:\d+(?:\.\d+)?)|(?:\.\d+)))|(?:c\s?-?(?:(?:\d+(?:\.\d+)?)|(?:\.\d+))(?:[\s,]?-?(?:(?:\d+(?:\.\d+)?)|(?:\.\d+))){5})|(?:q\s?-?(?:(?:\d+(?:\.\d+)?)|(?:\.\d+))(?:[\s,]?-?(?:(?:\d+(?:\.\d+)?)|(?:\.\d+))){3}(?:\s?t?\s?-?(?:(?:\d+(?:\.\d+)?)|(?:\.\d+))[\s,]?-?(?:(?:\d+(?:\.\d+)?)|(?:\.\d+)))*)|(?:a\s?-?(?:(?:\d+(?:\.\d+)?)|(?:\.\d+))(?:[\s,]?-?(?:(?:\d+(?:\.\d+)?)|(?:\.\d+))){2}[\s,]?(?:[01][\s,]+){2}(?:[\s,]?-?(?:(?:\d+(?:\.\d+)?)|(?:\.\d+))){2})|(?:s\s?-?(?:(?:\d+(?:\.\d+)?)|(?:\.\d+))(?:[\s,]?-?(?:(?:\d+(?:\.\d+)?)|(?:\.\d+))){3})|z/gi,
);
});
});
+38
View File
@@ -0,0 +1,38 @@
/**
* @copyright nhcarrigan
* @license Naomi's Public License
* @author Naomi Carrigan
*/
import { describe, it, expect } from "vitest";
import { Throne } from "../../src/icons/Throne";
describe("throne icon", () => {
it("should have a valid width", () => {
expect.assertions(1);
expect(Throne.icon[0], "width is negative").toBeGreaterThan(0);
});
it("should have a valid height", () => {
expect.assertions(1);
expect(Throne.icon[1], "height is negative").toBeGreaterThan(0);
});
it("should not have any ligatures", () => {
expect.assertions(1);
expect(Throne.icon[2], "ligatures are present").toStrictEqual([]);
});
it("should have a valid unicode set", () => {
expect.assertions(1);
expect(Throne.icon[3], "unicode set is wrong").toBe("U+E002");
});
it("should have valid SVG path data", () => {
expect.assertions(1);
expect(Throne.icon[4], "path data is bad").toMatch(
// eslint-disable-next-line stylistic/max-len
/(?:[lm]\s?-?(?:(?:\d+(?:\.\d+)?)|(?:\.\d+))[\s,]?-?(?:(?:\d+(?:\.\d+)?)|(?:\.\d+)))|(?:[hv]\s?-?(?:(?:\d+(?:\.\d+)?)|(?:\.\d+)))|(?:c\s?-?(?:(?:\d+(?:\.\d+)?)|(?:\.\d+))(?:[\s,]?-?(?:(?:\d+(?:\.\d+)?)|(?:\.\d+))){5})|(?:q\s?-?(?:(?:\d+(?:\.\d+)?)|(?:\.\d+))(?:[\s,]?-?(?:(?:\d+(?:\.\d+)?)|(?:\.\d+))){3}(?:\s?t?\s?-?(?:(?:\d+(?:\.\d+)?)|(?:\.\d+))[\s,]?-?(?:(?:\d+(?:\.\d+)?)|(?:\.\d+)))*)|(?:a\s?-?(?:(?:\d+(?:\.\d+)?)|(?:\.\d+))(?:[\s,]?-?(?:(?:\d+(?:\.\d+)?)|(?:\.\d+))){2}[\s,]?(?:[01][\s,]+){2}(?:[\s,]?-?(?:(?:\d+(?:\.\d+)?)|(?:\.\d+))){2})|(?:s\s?-?(?:(?:\d+(?:\.\d+)?)|(?:\.\d+))(?:[\s,]?-?(?:(?:\d+(?:\.\d+)?)|(?:\.\d+))){3})|z/gi,
);
});
});
+38
View File
@@ -0,0 +1,38 @@
/**
* @copyright nhcarrigan
* @license Naomi's Public License
* @author Naomi Carrigan
*/
import { describe, it, expect } from "vitest";
import { TreeNation } from "../../src/icons/TreeNation";
describe("treenation icon", () => {
it("should have a valid width", () => {
expect.assertions(1);
expect(TreeNation.icon[0], "width is negative").toBeGreaterThan(0);
});
it("should have a valid height", () => {
expect.assertions(1);
expect(TreeNation.icon[1], "height is negative").toBeGreaterThan(0);
});
it("should not have any ligatures", () => {
expect.assertions(1);
expect(TreeNation.icon[2], "ligatures are present").toStrictEqual([]);
});
it("should have a valid unicode set", () => {
expect.assertions(1);
expect(TreeNation.icon[3], "unicode set is wrong").toBe("U+E002");
});
it("should have valid SVG path data", () => {
expect.assertions(1);
expect(TreeNation.icon[4], "path data is bad").toMatch(
// eslint-disable-next-line stylistic/max-len
/(?:[lm]\s?-?(?:(?:\d+(?:\.\d+)?)|(?:\.\d+))[\s,]?-?(?:(?:\d+(?:\.\d+)?)|(?:\.\d+)))|(?:[hv]\s?-?(?:(?:\d+(?:\.\d+)?)|(?:\.\d+)))|(?:c\s?-?(?:(?:\d+(?:\.\d+)?)|(?:\.\d+))(?:[\s,]?-?(?:(?:\d+(?:\.\d+)?)|(?:\.\d+))){5})|(?:q\s?-?(?:(?:\d+(?:\.\d+)?)|(?:\.\d+))(?:[\s,]?-?(?:(?:\d+(?:\.\d+)?)|(?:\.\d+))){3}(?:\s?t?\s?-?(?:(?:\d+(?:\.\d+)?)|(?:\.\d+))[\s,]?-?(?:(?:\d+(?:\.\d+)?)|(?:\.\d+)))*)|(?:a\s?-?(?:(?:\d+(?:\.\d+)?)|(?:\.\d+))(?:[\s,]?-?(?:(?:\d+(?:\.\d+)?)|(?:\.\d+))){2}[\s,]?(?:[01][\s,]+){2}(?:[\s,]?-?(?:(?:\d+(?:\.\d+)?)|(?:\.\d+))){2})|(?:s\s?-?(?:(?:\d+(?:\.\d+)?)|(?:\.\d+))(?:[\s,]?-?(?:(?:\d+(?:\.\d+)?)|(?:\.\d+))){3})|z/gi,
);
});
});
+38
View File
@@ -0,0 +1,38 @@
/**
* @copyright nhcarrigan
* @license Naomi's Public License
* @author Naomi Carrigan
*/
import { describe, it, expect } from "vitest";
import { Udemy } from "../../src/icons/Udemy";
describe("udemy icon", () => {
it("should have a valid width", () => {
expect.assertions(1);
expect(Udemy.icon[0], "width is negative").toBeGreaterThan(0);
});
it("should have a valid height", () => {
expect.assertions(1);
expect(Udemy.icon[1], "height is negative").toBeGreaterThan(0);
});
it("should not have any ligatures", () => {
expect.assertions(1);
expect(Udemy.icon[2], "ligatures are present").toStrictEqual([]);
});
it("should have a valid unicode set", () => {
expect.assertions(1);
expect(Udemy.icon[3], "unicode set is wrong").toBe("U+E002");
});
it("should have valid SVG path data", () => {
expect.assertions(1);
expect(Udemy.icon[4], "path data is bad").toMatch(
// eslint-disable-next-line stylistic/max-len
/(?:[lm]\s?-?(?:(?:\d+(?:\.\d+)?)|(?:\.\d+))[\s,]?-?(?:(?:\d+(?:\.\d+)?)|(?:\.\d+)))|(?:[hv]\s?-?(?:(?:\d+(?:\.\d+)?)|(?:\.\d+)))|(?:c\s?-?(?:(?:\d+(?:\.\d+)?)|(?:\.\d+))(?:[\s,]?-?(?:(?:\d+(?:\.\d+)?)|(?:\.\d+))){5})|(?:q\s?-?(?:(?:\d+(?:\.\d+)?)|(?:\.\d+))(?:[\s,]?-?(?:(?:\d+(?:\.\d+)?)|(?:\.\d+))){3}(?:\s?t?\s?-?(?:(?:\d+(?:\.\d+)?)|(?:\.\d+))[\s,]?-?(?:(?:\d+(?:\.\d+)?)|(?:\.\d+)))*)|(?:a\s?-?(?:(?:\d+(?:\.\d+)?)|(?:\.\d+))(?:[\s,]?-?(?:(?:\d+(?:\.\d+)?)|(?:\.\d+))){2}[\s,]?(?:[01][\s,]+){2}(?:[\s,]?-?(?:(?:\d+(?:\.\d+)?)|(?:\.\d+))){2})|(?:s\s?-?(?:(?:\d+(?:\.\d+)?)|(?:\.\d+))(?:[\s,]?-?(?:(?:\d+(?:\.\d+)?)|(?:\.\d+))){3})|z/gi,
);
});
});
+38
View File
@@ -0,0 +1,38 @@
/**
* @copyright nhcarrigan
* @license Naomi's Public License
* @author Naomi Carrigan
*/
import { describe, it, expect } from "vitest";
import { VRoid } from "../../src/icons/VRoid";
describe("vroid icon", () => {
it("should have a valid width", () => {
expect.assertions(1);
expect(VRoid.icon[0], "width is negative").toBeGreaterThan(0);
});
it("should have a valid height", () => {
expect.assertions(1);
expect(VRoid.icon[1], "height is negative").toBeGreaterThan(0);
});
it("should not have any ligatures", () => {
expect.assertions(1);
expect(VRoid.icon[2], "ligatures are present").toStrictEqual([]);
});
it("should have a valid unicode set", () => {
expect.assertions(1);
expect(VRoid.icon[3], "unicode set is wrong").toBe("U+E002");
});
it("should have valid SVG path data", () => {
expect.assertions(1);
expect(VRoid.icon[4], "path data is bad").toMatch(
// eslint-disable-next-line stylistic/max-len
/(?:[lm]\s?-?(?:(?:\d+(?:\.\d+)?)|(?:\.\d+))[\s,]?-?(?:(?:\d+(?:\.\d+)?)|(?:\.\d+)))|(?:[hv]\s?-?(?:(?:\d+(?:\.\d+)?)|(?:\.\d+)))|(?:c\s?-?(?:(?:\d+(?:\.\d+)?)|(?:\.\d+))(?:[\s,]?-?(?:(?:\d+(?:\.\d+)?)|(?:\.\d+))){5})|(?:q\s?-?(?:(?:\d+(?:\.\d+)?)|(?:\.\d+))(?:[\s,]?-?(?:(?:\d+(?:\.\d+)?)|(?:\.\d+))){3}(?:\s?t?\s?-?(?:(?:\d+(?:\.\d+)?)|(?:\.\d+))[\s,]?-?(?:(?:\d+(?:\.\d+)?)|(?:\.\d+)))*)|(?:a\s?-?(?:(?:\d+(?:\.\d+)?)|(?:\.\d+))(?:[\s,]?-?(?:(?:\d+(?:\.\d+)?)|(?:\.\d+))){2}[\s,]?(?:[01][\s,]+){2}(?:[\s,]?-?(?:(?:\d+(?:\.\d+)?)|(?:\.\d+))){2})|(?:s\s?-?(?:(?:\d+(?:\.\d+)?)|(?:\.\d+))(?:[\s,]?-?(?:(?:\d+(?:\.\d+)?)|(?:\.\d+))){3})|z/gi,
);
});
});
+38
View File
@@ -0,0 +1,38 @@
/**
* @copyright nhcarrigan
* @license Naomi's Public License
* @author Naomi Carrigan
*/
import { describe, it, expect } from "vitest";
import { Volunteer } from "../../src/icons/Volunteer";
describe("volunteer icon", () => {
it("should have a valid width", () => {
expect.assertions(1);
expect(Volunteer.icon[0], "width is negative").toBeGreaterThan(0);
});
it("should have a valid height", () => {
expect.assertions(1);
expect(Volunteer.icon[1], "height is negative").toBeGreaterThan(0);
});
it("should not have any ligatures", () => {
expect.assertions(1);
expect(Volunteer.icon[2], "ligatures are present").toStrictEqual([]);
});
it("should have a valid unicode set", () => {
expect.assertions(1);
expect(Volunteer.icon[3], "unicode set is wrong").toBe("U+E002");
});
it("should have valid SVG path data", () => {
expect.assertions(1);
expect(Volunteer.icon[4], "path data is bad").toMatch(
// eslint-disable-next-line stylistic/max-len
/(?:[lm]\s?-?(?:(?:\d+(?:\.\d+)?)|(?:\.\d+))[\s,]?-?(?:(?:\d+(?:\.\d+)?)|(?:\.\d+)))|(?:[hv]\s?-?(?:(?:\d+(?:\.\d+)?)|(?:\.\d+)))|(?:c\s?-?(?:(?:\d+(?:\.\d+)?)|(?:\.\d+))(?:[\s,]?-?(?:(?:\d+(?:\.\d+)?)|(?:\.\d+))){5})|(?:q\s?-?(?:(?:\d+(?:\.\d+)?)|(?:\.\d+))(?:[\s,]?-?(?:(?:\d+(?:\.\d+)?)|(?:\.\d+))){3}(?:\s?t?\s?-?(?:(?:\d+(?:\.\d+)?)|(?:\.\d+))[\s,]?-?(?:(?:\d+(?:\.\d+)?)|(?:\.\d+)))*)|(?:a\s?-?(?:(?:\d+(?:\.\d+)?)|(?:\.\d+))(?:[\s,]?-?(?:(?:\d+(?:\.\d+)?)|(?:\.\d+))){2}[\s,]?(?:[01][\s,]+){2}(?:[\s,]?-?(?:(?:\d+(?:\.\d+)?)|(?:\.\d+))){2})|(?:s\s?-?(?:(?:\d+(?:\.\d+)?)|(?:\.\d+))(?:[\s,]?-?(?:(?:\d+(?:\.\d+)?)|(?:\.\d+))){3})|z/gi,
);
});
});
+345
View File
@@ -0,0 +1,345 @@
/**
* @copyright nhcarrigan
* @license Naomi's Public License
* @author Naomi Carrigan
*/
import { describe, it, expect, vi, beforeEach } from "vitest";
import { getCodebergData } from "../../src/lib/codeberg";
describe("codeberg", () => {
beforeEach(() => {
vi.resetAllMocks();
});
it("should fetch and cache activities", async() => {
expect.assertions(1);
const mockResponse = [
{
act_user: {
active: true,
avatar_url: "https://example.com/avatar.png",
created: "2023-01-01T00:00:00Z",
description: "Developer",
email: "naomi@example.com",
followers_count: 100,
following_count: 50,
full_name: "Naomi Carrigan",
html_url: "https://example.com",
id: 1,
is_admin: false,
language: "en",
last_login: "2023-01-01T00:00:00Z",
location: "Earth",
login: "naomi",
login_name: "naomi",
prohibit_login: false,
pronouns: "she/her",
restricted: false,
source_id: 1,
starred_repos_count: 10,
username: "naomi",
visibility: "public",
website: "https://example.com",
},
act_user_id: 1,
comment: {
assets: [],
body: "A comment",
created_at: "2023-01-01T00:00:00Z",
html_url: "https://example.com/comment",
id: 1,
issue_url: "https://example.com/issue",
original_author: "naomi",
original_author_id: 1,
pull_request_url: "https://example.com/pr",
updated_at: "2023-01-01T00:00:00Z",
user: null,
},
comment_id: 1,
content: "Activity content",
created: "2023-01-01T00:00:00Z",
id: 1,
is_private: false,
op_type: "create",
ref_name: "main",
repo: {
allow_fast_forward_only_merge: false,
allow_merge_commits: true,
allow_rebase: true,
allow_rebase_explicit: true,
allow_rebase_update: true,
allow_squash_merge: true,
archived: false,
archived_at: "2023-01-01T00:00:00Z",
avatar_url: "https://example.com/avatar.png",
clone_url: "https://example.com/repo.git",
created_at: "2023-01-01T00:00:00Z",
default_allow_maintainer_edit: true,
default_branch: "main",
default_delete_branch_after_merge: true,
default_merge_style: "merge",
description: "A repository",
empty: false,
external_tracker: {
external_tracker_format: "format",
external_tracker_regexp_pattern: "pattern",
external_tracker_style: "style",
external_tracker_url: "https://example.com/tracker",
},
fork: false,
forks_count: 5,
full_name: "naomi/repo",
globally_editable_wiki: false,
has_actions: true,
has_issues: true,
has_packages: true,
has_projects: true,
has_pull_requests: true,
has_releases: true,
has_wiki: true,
html_url: "https://example.com/repo",
id: 1,
ignore_whitespace_conflicts: false,
internal: false,
language: "TypeScript",
languages_url: "https://example.com/languages",
link: "https://example.com/repo",
mirror: false,
mirror_interval: "24h",
mirror_updated: "2023-01-01T00:00:00Z",
name: "repo",
object_format_name: "format",
open_issues_count: 1,
open_pr_counter: 0,
original_url: "https://example.com/repo",
owner: {
active: true,
avatar_url: "https://example.com/avatar.png",
created: "2023-01-01T00:00:00Z",
description: "Developer",
email: "naomi@example.com",
followers_count: 100,
following_count: 50,
full_name: "Naomi Carrigan",
html_url: "https://example.com",
id: 1,
is_admin: false,
language: "en",
last_login: "2023-01-01T00:00:00Z",
location: "Earth",
login: "naomi",
login_name: "naomi",
prohibit_login: false,
pronouns: "she/her",
restricted: false,
source_id: 1,
starred_repos_count: 10,
username: "naomi",
visibility: "public",
website: "https://example.com",
},
parent: null,
permissions: {
admin: true,
pull: true,
push: true,
},
private: false,
release_counter: 0,
repo_transfer: null,
size: 100,
ssh_url: "git@example.com:repo.git",
stars_count: 10,
template: false,
topics: [],
updated_at: "2023-01-01T00:00:00Z",
url: "https://example.com/repo",
watchers_count: 3,
website: "https://example.com",
wiki_branch: "main",
},
repo_id: 1,
user_id: 1,
},
];
vi.spyOn(global, "fetch").mockResolvedValue({
json: () => {
return Promise.resolve(mockResponse);
},
});
const data = await getCodebergData();
expect(data, "did not have correct payload").
toStrictEqual(mockResponse);
});
it("should return cached data if not stale", async() => {
expect.assertions(3);
const mockResponse = [
{
act_user: {
active: true,
avatar_url: "https://example.com/avatar.png",
created: "2023-01-01T00:00:00Z",
description: "Developer",
email: "naomi@example.com",
followers_count: 100,
following_count: 50,
full_name: "Naomi Carrigan",
html_url: "https://example.com",
id: 1,
is_admin: false,
language: "en",
last_login: "2023-01-01T00:00:00Z",
location: "Earth",
login: "naomi",
login_name: "naomi",
prohibit_login: false,
pronouns: "she/her",
restricted: false,
source_id: 1,
starred_repos_count: 10,
username: "naomi",
visibility: "public",
website: "https://example.com",
},
act_user_id: 1,
comment: {
assets: [],
body: "A comment",
created_at: "2023-01-01T00:00:00Z",
html_url: "https://example.com/comment",
id: 1,
issue_url: "https://example.com/issue",
original_author: "naomi",
original_author_id: 1,
pull_request_url: "https://example.com/pr",
updated_at: "2023-01-01T00:00:00Z",
user: null,
},
comment_id: 1,
content: "Activity content",
created: "2023-01-01T00:00:00Z",
id: 1,
is_private: false,
op_type: "create",
ref_name: "main",
repo: {
allow_fast_forward_only_merge: false,
allow_merge_commits: true,
allow_rebase: true,
allow_rebase_explicit: true,
allow_rebase_update: true,
allow_squash_merge: true,
archived: false,
archived_at: "2023-01-01T00:00:00Z",
avatar_url: "https://example.com/avatar.png",
clone_url: "https://example.com/repo.git",
created_at: "2023-01-01T00:00:00Z",
default_allow_maintainer_edit: true,
default_branch: "main",
default_delete_branch_after_merge: true,
default_merge_style: "merge",
description: "A repository",
empty: false,
external_tracker: {
external_tracker_format: "format",
external_tracker_regexp_pattern: "pattern",
external_tracker_style: "style",
external_tracker_url: "https://example.com/tracker",
},
fork: false,
forks_count: 5,
full_name: "naomi/repo",
globally_editable_wiki: false,
has_actions: true,
has_issues: true,
has_packages: true,
has_projects: true,
has_pull_requests: true,
has_releases: true,
has_wiki: true,
html_url: "https://example.com/repo",
id: 1,
ignore_whitespace_conflicts: false,
internal: false,
language: "TypeScript",
languages_url: "https://example.com/languages",
link: "https://example.com/repo",
mirror: false,
mirror_interval: "24h",
mirror_updated: "2023-01-01T00:00:00Z",
name: "repo",
object_format_name: "format",
open_issues_count: 1,
open_pr_counter: 0,
original_url: "https://example.com/repo",
owner: {
active: true,
avatar_url: "https://example.com/avatar.png",
created: "2023-01-01T00:00:00Z",
description: "Developer",
email: "naomi@example.com",
followers_count: 100,
following_count: 50,
full_name: "Naomi Carrigan",
html_url: "https://example.com",
id: 1,
is_admin: false,
language: "en",
last_login: "2023-01-01T00:00:00Z",
location: "Earth",
login: "naomi",
login_name: "naomi",
prohibit_login: false,
pronouns: "she/her",
restricted: false,
source_id: 1,
starred_repos_count: 10,
username: "naomi",
visibility: "public",
website: "https://example.com",
},
parent: null,
permissions: {
admin: true,
pull: true,
push: true,
},
private: false,
release_counter: 0,
repo_transfer: null,
size: 100,
ssh_url: "git@example.com:repo.git",
stars_count: 10,
template: false,
topics: [],
updated_at: "2023-01-01T00:00:00Z",
url: "https://example.com/repo",
watchers_count: 3,
website: "https://example.com",
wiki_branch: "main",
},
repo_id: 1,
user_id: 1,
},
];
vi.spyOn(global, "fetch").mockResolvedValue({
json: () => {
return Promise.resolve(mockResponse);
},
});
const data = await getCodebergData();
expect(data, "did not have correct payload").
toStrictEqual(mockResponse);
// Call again to check if cached data is returned
const cachedData = await getCodebergData();
expect(cachedData, "did not cache correct payload").
toStrictEqual(mockResponse);
expect(global.fetch, "did not hit cache").not.toHaveBeenCalled();
});
});
+343
View File
@@ -0,0 +1,343 @@
/**
* @copyright nhcarrigan
* @license Naomi's Public License
* @author Naomi Carrigan
*/
import { describe, it, expect, vi, beforeEach } from "vitest";
import { getGithubData } from "../../src/lib/github";
describe("github", () => {
beforeEach(() => {
vi.resetAllMocks();
});
it("should fetch and cache activities", async() => {
expect.assertions(1);
const mockResponse = [
{
act_user: {
active: true,
avatar_url: "https://example.com/avatar.png",
created: "2023-01-01T00:00:00Z",
description: "Developer",
email: "naomi@example.com",
followers_count: 100,
following_count: 50,
full_name: "Naomi Carrigan",
html_url: "https://example.com",
id: 1,
is_admin: false,
language: "en",
last_login: "2023-01-01T00:00:00Z",
location: "Earth",
login: "naomi",
login_name: "naomi",
prohibit_login: false,
pronouns: "she/her",
restricted: false,
source_id: 1,
starred_repos_count: 10,
username: "naomi",
visibility: "public",
website: "https://example.com",
},
act_user_id: 1,
comment: {
assets: [],
body: "A comment",
created_at: "2023-01-01T00:00:00Z",
html_url: "https://example.com/comment",
id: 1,
issue_url: "https://example.com/issue",
original_author: "naomi",
original_author_id: 1,
pull_request_url: "https://example.com/pr",
updated_at: "2023-01-01T00:00:00Z",
user: null,
},
comment_id: 1,
content: "Activity content",
created: "2023-01-01T00:00:00Z",
id: 1,
is_private: false,
op_type: "create",
ref_name: "main",
repo: {
allow_fast_forward_only_merge: false,
allow_merge_commits: true,
allow_rebase: true,
allow_rebase_explicit: true,
allow_rebase_update: true,
allow_squash_merge: true,
archived: false,
archived_at: "2023-01-01T00:00:00Z",
avatar_url: "https://example.com/avatar.png",
clone_url: "https://example.com/repo.git",
created_at: "2023-01-01T00:00:00Z",
default_allow_maintainer_edit: true,
default_branch: "main",
default_delete_branch_after_merge: true,
default_merge_style: "merge",
description: "A repository",
empty: false,
external_tracker: {
external_tracker_format: "format",
external_tracker_regexp_pattern: "pattern",
external_tracker_style: "style",
external_tracker_url: "https://example.com/tracker",
},
fork: false,
forks_count: 5,
full_name: "naomi/repo",
globally_editable_wiki: false,
has_actions: true,
has_issues: true,
has_packages: true,
has_projects: true,
has_pull_requests: true,
has_releases: true,
has_wiki: true,
html_url: "https://example.com/repo",
id: 1,
ignore_whitespace_conflicts: false,
internal: false,
language: "TypeScript",
languages_url: "https://example.com/languages",
link: "https://example.com/repo",
mirror: false,
mirror_interval: "24h",
mirror_updated: "2023-01-01T00:00:00Z",
name: "repo",
object_format_name: "format",
open_issues_count: 1,
open_pr_counter: 0,
original_url: "https://example.com/repo",
owner: {
active: true,
avatar_url: "https://example.com/avatar.png",
created: "2023-01-01T00:00:00Z",
description: "Developer",
email: "naomi@example.com",
followers_count: 100,
following_count: 50,
full_name: "Naomi Carrigan",
html_url: "https://example.com",
id: 1,
is_admin: false,
language: "en",
last_login: "2023-01-01T00:00:00Z",
location: "Earth",
login: "naomi",
login_name: "naomi",
prohibit_login: false,
pronouns: "she/her",
restricted: false,
source_id: 1,
starred_repos_count: 10,
username: "naomi",
visibility: "public",
website: "https://example.com",
},
parent: null,
permissions: {
admin: true,
pull: true,
push: true,
},
private: false,
release_counter: 0,
repo_transfer: null,
size: 100,
ssh_url: "git@example.com:repo.git",
stars_count: 10,
template: false,
topics: [],
updated_at: "2023-01-01T00:00:00Z",
url: "https://example.com/repo",
watchers_count: 3,
website: "https://example.com",
wiki_branch: "main",
},
repo_id: 1,
user_id: 1,
},
];
vi.spyOn(global, "fetch").mockResolvedValue({
json: () => {
return Promise.resolve(mockResponse);
},
});
const data = await getGithubData();
expect(data, "did not have correct payload").toStrictEqual(mockResponse);
});
it("should return cached data if not stale", async() => {
expect.assertions(3);
const mockResponse = [
{
act_user: {
active: true,
avatar_url: "https://example.com/avatar.png",
created: "2023-01-01T00:00:00Z",
description: "Developer",
email: "naomi@example.com",
followers_count: 100,
following_count: 50,
full_name: "Naomi Carrigan",
html_url: "https://example.com",
id: 1,
is_admin: false,
language: "en",
last_login: "2023-01-01T00:00:00Z",
location: "Earth",
login: "naomi",
login_name: "naomi",
prohibit_login: false,
pronouns: "she/her",
restricted: false,
source_id: 1,
starred_repos_count: 10,
username: "naomi",
visibility: "public",
website: "https://example.com",
},
act_user_id: 1,
comment: {
assets: [],
body: "A comment",
created_at: "2023-01-01T00:00:00Z",
html_url: "https://example.com/comment",
id: 1,
issue_url: "https://example.com/issue",
original_author: "naomi",
original_author_id: 1,
pull_request_url: "https://example.com/pr",
updated_at: "2023-01-01T00:00:00Z",
user: null,
},
comment_id: 1,
content: "Activity content",
created: "2023-01-01T00:00:00Z",
id: 1,
is_private: false,
op_type: "create",
ref_name: "main",
repo: {
allow_fast_forward_only_merge: false,
allow_merge_commits: true,
allow_rebase: true,
allow_rebase_explicit: true,
allow_rebase_update: true,
allow_squash_merge: true,
archived: false,
archived_at: "2023-01-01T00:00:00Z",
avatar_url: "https://example.com/avatar.png",
clone_url: "https://example.com/repo.git",
created_at: "2023-01-01T00:00:00Z",
default_allow_maintainer_edit: true,
default_branch: "main",
default_delete_branch_after_merge: true,
default_merge_style: "merge",
description: "A repository",
empty: false,
external_tracker: {
external_tracker_format: "format",
external_tracker_regexp_pattern: "pattern",
external_tracker_style: "style",
external_tracker_url: "https://example.com/tracker",
},
fork: false,
forks_count: 5,
full_name: "naomi/repo",
globally_editable_wiki: false,
has_actions: true,
has_issues: true,
has_packages: true,
has_projects: true,
has_pull_requests: true,
has_releases: true,
has_wiki: true,
html_url: "https://example.com/repo",
id: 1,
ignore_whitespace_conflicts: false,
internal: false,
language: "TypeScript",
languages_url: "https://example.com/languages",
link: "https://example.com/repo",
mirror: false,
mirror_interval: "24h",
mirror_updated: "2023-01-01T00:00:00Z",
name: "repo",
object_format_name: "format",
open_issues_count: 1,
open_pr_counter: 0,
original_url: "https://example.com/repo",
owner: {
active: true,
avatar_url: "https://example.com/avatar.png",
created: "2023-01-01T00:00:00Z",
description: "Developer",
email: "naomi@example.com",
followers_count: 100,
following_count: 50,
full_name: "Naomi Carrigan",
html_url: "https://example.com",
id: 1,
is_admin: false,
language: "en",
last_login: "2023-01-01T00:00:00Z",
location: "Earth",
login: "naomi",
login_name: "naomi",
prohibit_login: false,
pronouns: "she/her",
restricted: false,
source_id: 1,
starred_repos_count: 10,
username: "naomi",
visibility: "public",
website: "https://example.com",
},
parent: null,
permissions: {
admin: true,
pull: true,
push: true,
},
private: false,
release_counter: 0,
repo_transfer: null,
size: 100,
ssh_url: "git@example.com:repo.git",
stars_count: 10,
template: false,
topics: [],
updated_at: "2023-01-01T00:00:00Z",
url: "https://example.com/repo",
watchers_count: 3,
website: "https://example.com",
wiki_branch: "main",
},
repo_id: 1,
user_id: 1,
},
];
vi.spyOn(global, "fetch").mockResolvedValue({
json: () => {
return Promise.resolve(mockResponse);
},
});
const data = await getGithubData();
expect(data, "did not have correct payload").toStrictEqual(mockResponse);
// Call again to check if cached data is returned
const cachedData = await getGithubData();
expect(cachedData, "did not cache correct payload").
toStrictEqual(mockResponse);
expect(global.fetch, "did not hit cache").not.toHaveBeenCalled();
});
});