feat: add testimonials, fix funding
Node.js CI / Lint and Test (push) Failing after 1m4s

This commit is contained in:
2025-09-23 12:41:59 -07:00
parent 4d9fae6928
commit 445853b28f
5 changed files with 161 additions and 366 deletions
+55 -1
View File
@@ -12,6 +12,7 @@ import type { Donate } from "../src/interfaces/donate.js";
import type { Funding } from "../src/interfaces/funding.js";
import type { Projects } from "../src/interfaces/projects.js";
import type { Resume } from "../src/interfaces/resume.js";
import type { Testimonials } from "../src/interfaces/testimonials.js";
const checkUrl = async(url: string): Promise<boolean> => {
try {
@@ -463,7 +464,7 @@ describe("funding data", () => {
expect(typeof parsed.version, `Funding version should be a string`).toBe(
"string",
);
expect(parsed.version, `Funding version should be "1.0.0"`).toBe("1.0.0");
expect(parsed.version, `Funding version should be "v1.0.0"`).toBe("v1.0.0");
expect(parsed.entity, `Funding entity should be defined`).toBeDefined();
expect(
@@ -514,6 +515,8 @@ describe("funding data", () => {
Array.isArray(parsed.projects),
`Funding projects should be an array`,
).toBeTruthy();
expect(parsed.projects.length, `There should be at least one funding project`).toBeGreaterThan(0);
expect(parsed.projects.length, `There should not be more than 30 funding projects`).toBeLessThan(31);
for (const project of parsed.projects) {
expect(project, `Funding project should be defined`).toBeDefined();
expect(
@@ -754,3 +757,54 @@ describe("funding data", () => {
}
});
});
describe("testimonials data", () => {
it("should match the interface", async() => {
expect.hasAssertions();
const data = await readFile(
join(import.meta.dirname, "..", "data", "testimonials.yml"),
"utf8",
);
const parsed = parse(data) as Testimonials;
expect(parsed, `Parsed testimonials data should be defined`).toBeDefined();
expect(
Array.isArray(parsed),
`Parsed testimonials data should be an array`,
).toBeTruthy();
for (const testimonial of parsed) {
expect(testimonial, `Testimonial should be defined`).toBeDefined();
expect(
typeof testimonial.name,
`Testimonial name should be a string for ${
testimonial.name ?? "unknown"
}`,
).toBe("string");
expect(
typeof testimonial.content,
`Testimonial content should be a string for ${
testimonial.name ?? "unknown"
}`,
).toBe("string");
expect(
typeof testimonial.date,
`Testimonial date should be a string for ${
testimonial.name ?? "unknown"
}`,
).toBe("string");
// Check date is parsable in DD month YYYY format (e.g. 30 June 2023)
expect(
Boolean(/^\d{1,2} \w+ \d{4}$/.test(testimonial.date)),
`Testimonial date should be in "DD month YYYY" format for ${
testimonial.name ?? "unknown"
}`,
).toBeTruthy();
expect(
Boolean(Date.parse(testimonial.date)),
`Testimonial date should be a valid date for ${
testimonial.name ?? "unknown"
}`,
).toBeTruthy();
}
});
});