95 lines
3.1 KiB
TypeScript
95 lines
3.1 KiB
TypeScript
import { getFeaturedProjects, portfolio } from "./portfolio-data";
|
|
import type { ProjectHealthSnapshot } from "./project-health";
|
|
|
|
describe("getFeaturedProjects", () => {
|
|
it("keeps every featured project and classifies demo availability", () => {
|
|
const snapshot: ProjectHealthSnapshot = {
|
|
checkedAt: "2026-07-10T12:00:00.000Z",
|
|
projects: {
|
|
"sev-modaintima": {
|
|
status: 200,
|
|
contentType: "text/html; charset=utf-8",
|
|
checkedAt: "2026-07-10T12:00:00.000Z",
|
|
},
|
|
},
|
|
};
|
|
|
|
const result = getFeaturedProjects(snapshot);
|
|
|
|
expect(result.map(({ id }) => id)).toEqual(
|
|
portfolio.projects
|
|
.filter(({ featured }) => featured !== false)
|
|
.map(({ id }) => id),
|
|
);
|
|
expect(
|
|
result.find(({ id }) => id === "sev-modaintima")?.demoAvailability,
|
|
).toBe("available");
|
|
expect(
|
|
result.find(({ id }) => id === "sev-modaintima")?.demoCheckedAt,
|
|
).toBe("2026-07-10T12:00:00.000Z");
|
|
expect(result.find(({ id }) => id === "twins-lab")?.demoAvailability).toBe(
|
|
"none",
|
|
);
|
|
expect(
|
|
result.find(({ id }) => id === "twins-lab")?.demoCheckedAt,
|
|
).toBeNull();
|
|
});
|
|
|
|
it("excludes an isolated featured false fixture and restores the portfolio", () => {
|
|
const originalLength = portfolio.projects.length;
|
|
const hiddenProject = {
|
|
...portfolio.projects[0],
|
|
id: "hidden-test-fixture",
|
|
featured: false,
|
|
};
|
|
portfolio.projects.push(hiddenProject);
|
|
|
|
try {
|
|
expect(
|
|
getFeaturedProjects(null).some(
|
|
({ id }) => id === "hidden-test-fixture",
|
|
),
|
|
).toBe(false);
|
|
} finally {
|
|
portfolio.projects.length = originalLength;
|
|
}
|
|
|
|
expect(portfolio.projects).toHaveLength(originalLength);
|
|
});
|
|
});
|
|
|
|
describe("factual portfolio records", () => {
|
|
function serializeProject(id: string) {
|
|
const project = portfolio.projects.find((item) => item.id === id);
|
|
expect(project).toBeDefined();
|
|
if (!project) throw new Error(`Missing project ${id}`);
|
|
return JSON.stringify(project);
|
|
}
|
|
|
|
it("keeps every public field of the three cases within verified claims", () => {
|
|
const nutriscan = serializeProject("nutriscan");
|
|
const twins = serializeProject("twins-lab");
|
|
const asServicos = serializeProject("as-servicos");
|
|
|
|
expect(nutriscan).toContain("Open Food Facts");
|
|
expect(nutriscan).not.toMatch(
|
|
/Next\.js\s*\d|PWA|Service Worker|MongoDB|históric|scanner|offline|NutriScore|produç|24\/7|2M\+|disponibilidade|volume de produtos|resultado de saúde/i,
|
|
);
|
|
|
|
expect(twins).toContain("SSE");
|
|
expect(twins).not.toMatch(
|
|
/WebSockets?|OpenRouter|sub[- ]segundo|produç|preditiv|ROI|precisão|equipamento real/i,
|
|
);
|
|
|
|
expect(asServicos).toContain("Three.js");
|
|
expect(asServicos).not.toMatch(
|
|
/produç|clientes?|leads?|ranking|performance|resultado comercial|anime\.js|shadcn/i,
|
|
);
|
|
});
|
|
it("does not publish the unavailable Twins Lab demo", () => {
|
|
expect(
|
|
portfolio.projects.find((item) => item.id === "twins-lab")?.demoUrl,
|
|
).toBeUndefined();
|
|
});
|
|
});
|