feat: harden portfolio and add SEO foundations

This commit is contained in:
Evandro Fonseca Junior committed 2026-09-04 19:25:30 -03:00
1 parent b079afdd73
commit 62bcfbd8fa
121 files changed
+7769 -10469

No files matched your search

+34 -30
View File
@@ -1,12 +1,10 @@
import {
createProjectHealthSnapshot,
filterLiveProjects,
isCurrentLiveCheck,
getDemoAvailability,
type ProjectHealthSnapshot,
} from "./project-health";
describe("project health snapshot", () => {
const now = new Date("2026-07-10T12:00:00.000Z");
const snapshot: ProjectHealthSnapshot = {
checkedAt: "2026-07-10T11:55:00.000Z",
projects: {
@@ -28,36 +26,42 @@ describe("project health snapshot", () => {
},
};
it("accepts only fresh final HTTP 200 HTML projects", () => {
expect(isCurrentLiveCheck(snapshot.projects.online, now)).toBe(true);
expect(isCurrentLiveCheck(snapshot.projects.redirect, now)).toBe(false);
expect(isCurrentLiveCheck(snapshot.projects.stale, now)).toBe(false);
it("classifies demo availability from the latest observation", () => {
expect(getDemoAvailability(null, undefined)).toBe("none");
expect(getDemoAvailability("https://demo.example", undefined)).toBe(
"unknown",
);
expect(
filterLiveProjects(
[
{ id: "online", featured: true },
{ id: "redirect", featured: true },
{ id: "stale", featured: true },
{ id: "hidden", featured: false },
],
snapshot,
now,
).map((project) => project.id),
).toEqual(["online"]);
});
it("fails closed when the snapshot is absent or expired", () => {
getDemoAvailability("https://demo.example", {
status: null,
contentType: null,
checkedAt: "2026-07-10T11:55:00.000Z",
error: "network unavailable",
}),
).toBe("unknown");
expect(
filterLiveProjects([{ id: "online", featured: true }], null, now),
).toEqual([]);
getDemoAvailability("https://demo.example", snapshot.projects.online),
).toBe("available");
expect(
filterLiveProjects(
[{ id: "online", featured: true }],
{ ...snapshot, checkedAt: "2026-07-10T10:00:00.000Z" },
now,
),
).toEqual([]);
getDemoAvailability("https://demo.example", snapshot.projects.redirect),
).toBe("unavailable");
expect(
getDemoAvailability("https://demo.example", {
status: 200,
contentType: "application/json",
checkedAt: "2026-07-10T11:55:00.000Z",
}),
).toBe("unavailable");
expect(
getDemoAvailability("https://demo.example", {
status: 200,
contentType: "text/html+custom; charset=utf-8",
checkedAt: "2026-07-10T11:55:00.000Z",
}),
).toBe("unavailable");
expect(
getDemoAvailability("https://demo.example", snapshot.projects.stale),
).toBe("available");
});
it("creates a fresh health snapshot when the stored result is unavailable", async () => {