feat: cleanup

This commit is contained in:
2025-01-23 00:19:43 -08:00
parent 4e3068b898
commit d3f795608c
69 changed files with 11 additions and 6695 deletions
-100
View File
@@ -1,100 +0,0 @@
/**
* @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 { getCodebergActivty } 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(getCodebergActivty).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(getCodebergActivty).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(getCodebergActivty).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);
});
});
-55
View File
@@ -1,55 +0,0 @@
/**
* @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/contribute/route";
import { getCodebergIssues } from "../../../../src/lib/codeberg";
vi.mock("../../../../src/lib/codeberg");
describe("gET /api/contribute", () => {
it("should return a sorted and limited list of activities", async() => {
expect.assertions(2);
const mockCodebergData = [
{
body: "body1",
html_url: "https://codeberg.org/repo1/issue1",
labels: [ { name: "label1" } ],
number: 1,
title: "issue1",
},
];
vi.mocked(getCodebergIssues).mockResolvedValue(mockCodebergData);
const response = await GET();
const json = await response.json();
expect(response, "did not respond with Next").toBeInstanceOf(NextResponse);
expect(json, "incorrect payload").toStrictEqual([
{
body: "body1",
labels: [ "label1" ],
number: 1,
title: "issue1",
url: "https://codeberg.org/repo1/issue1",
},
]);
});
it("should handle empty data from both sources", async() => {
expect.assertions(2);
vi.mocked(getCodebergIssues).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([]);
});
});
-29
View File
@@ -1,29 +0,0 @@
/**
* @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);
});
});
-117
View File
@@ -1,117 +0,0 @@
/**
* @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);
});
});
-36
View File
@@ -1,36 +0,0 @@
/**
* @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);
});
});
-38
View File
@@ -1,38 +0,0 @@
/**
* @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
@@ -1,38 +0,0 @@
/**
* @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
@@ -1,38 +0,0 @@
/**
* @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
@@ -1,38 +0,0 @@
/**
* @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
@@ -1,38 +0,0 @@
/**
* @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
@@ -1,38 +0,0 @@
/**
* @copyright nhcarrigan
* @license Naomi's Public License
* @author Naomi Carrigan
*/
import { describe, it, expect } from "vitest";
import { Gumroad } from "../../src/icons/Gumroad";
describe("gumroad icon", () => {
it("should have a valid width", () => {
expect.assertions(1);
expect(Gumroad.icon[0], "width is negative").toBeGreaterThan(0);
});
it("should have a valid height", () => {
expect.assertions(1);
expect(Gumroad.icon[1], "height is negative").toBeGreaterThan(0);
});
it("should not have any ligatures", () => {
expect.assertions(1);
expect(Gumroad.icon[2], "ligatures are present").toStrictEqual([]);
});
it("should have a valid unicode set", () => {
expect.assertions(1);
expect(Gumroad.icon[3], "unicode set is wrong").toBe("U+E002");
});
it("should have valid SVG path data", () => {
expect.assertions(1);
expect(Gumroad.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
@@ -1,38 +0,0 @@
/**
* @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
@@ -1,38 +0,0 @@
/**
* @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
@@ -1,38 +0,0 @@
/**
* @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
@@ -1,38 +0,0 @@
/**
* @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
@@ -1,38 +0,0 @@
/**
* @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,
);
});
});
-39
View File
@@ -1,39 +0,0 @@
/**
* @copyright nhcarrigan
* @license Naomi's Public License
* @author Naomi Carrigan
*/
import { describe, it, expect } from "vitest";
import { RetroAchievements } from "../../src/icons/RetroAchievements";
describe("retroachievements icon", () => {
it("should have a valid width", () => {
expect.assertions(1);
expect(RetroAchievements.icon[0], "width is negative").toBeGreaterThan(0);
});
it("should have a valid height", () => {
expect.assertions(1);
expect(RetroAchievements.icon[1], "height is negative").toBeGreaterThan(0);
});
it("should not have any ligatures", () => {
expect.assertions(1);
expect(RetroAchievements.icon[2], "ligatures are present").
toStrictEqual([]);
});
it("should have a valid unicode set", () => {
expect.assertions(1);
expect(RetroAchievements.icon[3], "unicode set is wrong").toBe("U+E002");
});
it("should have valid SVG path data", () => {
expect.assertions(1);
expect(RetroAchievements.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
@@ -1,38 +0,0 @@
/**
* @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
@@ -1,38 +0,0 @@
/**
* @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
@@ -1,38 +0,0 @@
/**
* @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
@@ -1,38 +0,0 @@
/**
* @copyright nhcarrigan
* @license Naomi's Public License
* @author Naomi Carrigan
*/
import { describe, it, expect } from "vitest";
import { Topmate } from "../../src/icons/Topmate";
describe("topmate icon", () => {
it("should have a valid width", () => {
expect.assertions(1);
expect(Topmate.icon[0], "width is negative").toBeGreaterThan(0);
});
it("should have a valid height", () => {
expect.assertions(1);
expect(Topmate.icon[1], "height is negative").toBeGreaterThan(0);
});
it("should not have any ligatures", () => {
expect.assertions(1);
expect(Topmate.icon[2], "ligatures are present").toStrictEqual([]);
});
it("should have a valid unicode set", () => {
expect.assertions(1);
expect(Topmate.icon[3], "unicode set is wrong").toBe("U+E002");
});
it("should have valid SVG path data", () => {
expect.assertions(1);
expect(Topmate.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
@@ -1,38 +0,0 @@
/**
* @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
@@ -1,38 +0,0 @@
/**
* @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
@@ -1,38 +0,0 @@
/**
* @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,
);
});
});
-437
View File
@@ -1,437 +0,0 @@
/**
* @copyright nhcarrigan
* @license Naomi's Public License
* @author Naomi Carrigan
*/
import { describe, it, expect, vi, beforeEach } from "vitest";
import { getCodebergActivty, getCodebergIssues } from "../../src/lib/codeberg";
describe("codeberg activity", () => {
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 getCodebergActivty();
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 getCodebergActivty();
expect(data, "did not have correct payload").
toStrictEqual(mockResponse);
// Call again to check if cached data is returned
const cachedData = await getCodebergActivty();
expect(cachedData, "did not cache correct payload").
toStrictEqual(mockResponse);
expect(global.fetch, "did not hit cache").not.toHaveBeenCalled();
});
});
describe.todo("codeberg issues", () => {
beforeEach(() => {
vi.resetAllMocks();
});
it("should fetch and cache issues", async() => {
expect.assertions(1);
const mockResponse = [
{
assignee: null,
assignees: [],
body: "Issue body",
closed_at: null,
comments: 0,
comments_url: "https://example.com/comments",
created_at: "2023-01-01T00:00:00Z",
html_url: "https://example.com/issue",
id: 1,
labels: [ { name: "good first issue" } ],
milestone: null,
number: 1,
original_author: "naomi",
original_author_id: 1,
pull_request: null,
state: "open",
title: "Issue title",
updated_at: "2023-01-01T00:00:00Z",
user: null,
},
];
vi.spyOn(global, "fetch").mockResolvedValueOnce({
json: () => {
return Promise.resolve([ { name: "mock repo" } ]);
},
});
vi.spyOn(global, "fetch").mockResolvedValueOnce({
json: () => {
return Promise.resolve(mockResponse);
},
});
const data = await getCodebergIssues();
expect(data, "did not have correct payload").
toStrictEqual(mockResponse);
});
it("should return cached data if not stale", async() => {
expect.assertions(3);
const mockResponse = [
{
assignee: null,
assignees: [],
body: "Issue body",
closed_at: null,
comments: 0,
comments_url: "https://example.com/comments",
created_at: "2023-01-01T00:00:00Z",
html_url: "https://example.com/issue",
id: 1,
labels: [ { name: "good first issue" } ],
milestone: null,
number: 1,
original_author: "naomi",
original_author_id: 1,
pull_request: null,
state: "open",
title: "Issue title",
updated_at: "2023-01-01T00:00:00Z",
user: null,
},
];
vi.spyOn(global, "fetch").mockResolvedValue({
json: () => {
return Promise.resolve(mockResponse);
},
});
const data = await getCodebergIssues();
expect(data, "did not have correct payload").
toStrictEqual(mockResponse);
// Call again to check if cached data is returned
const cachedData = await getCodebergActivty();
expect(cachedData, "did not cache correct payload").
toStrictEqual(mockResponse);
expect(global.fetch, "did not hit cache").not.toHaveBeenCalled();
});
});
-343
View File
@@ -1,343 +0,0 @@
/**
* @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();
});
});