CI / verify (push) Failing after 5m9s
Align the notebook browser with the physical LCD, refresh real project captures and navigation, simplify service content, and stabilize hero hydration.
83 lines
2.4 KiB
TypeScript
83 lines
2.4 KiB
TypeScript
import {
|
|
getFeaturedProjects,
|
|
type PortfolioProjectView,
|
|
} from "@/lib/portfolio-data";
|
|
import { selectNotebookProjects } from "./notebookProjects";
|
|
|
|
const projectsFixture = getFeaturedProjects(null);
|
|
|
|
describe("selectNotebookProjects", () => {
|
|
it("returns featured projects in notebook order", () => {
|
|
const result = selectNotebookProjects(projectsFixture);
|
|
|
|
expect(result.map((project) => project.id)).toEqual([
|
|
"nutriscan",
|
|
"sc-plus",
|
|
"sev-modaintima",
|
|
"as-servicos",
|
|
]);
|
|
});
|
|
|
|
it("omits a project when its screenshot mapping is missing", () => {
|
|
const result = selectNotebookProjects([
|
|
...projectsFixture,
|
|
{ ...projectsFixture[0], id: "unknown-live-project" },
|
|
]);
|
|
|
|
expect(
|
|
result.some((project) => project.id === "unknown-live-project"),
|
|
).toBe(false);
|
|
});
|
|
|
|
it("omits a project with an unapproved demo URL", () => {
|
|
const projectsWithUnsafeUrl = projectsFixture.map((project) =>
|
|
project.id === "nutriscan"
|
|
? { ...project, demoUrl: "javascript:alert(1)" }
|
|
: project,
|
|
);
|
|
const result = selectNotebookProjects(projectsWithUnsafeUrl);
|
|
|
|
expect(result.some((project) => project.id === "nutriscan")).toBe(false);
|
|
});
|
|
|
|
it("keeps a project without a demo so its local evidence remains visible", () => {
|
|
const projectsWithoutDemo = projectsFixture.map((project) =>
|
|
project.id === "nutriscan"
|
|
? {
|
|
...project,
|
|
demoUrl: null,
|
|
demoAvailability: "none" as const,
|
|
demoCheckedAt: null,
|
|
}
|
|
: project,
|
|
) as unknown as PortfolioProjectView[];
|
|
|
|
expect(
|
|
selectNotebookProjects(projectsWithoutDemo).some(
|
|
(project) => project.id === "nutriscan",
|
|
),
|
|
).toBe(true);
|
|
});
|
|
|
|
it("keeps an unavailable project when its local evidence and URL exist", () => {
|
|
const projectsWithUnavailableDemo = projectsFixture.map((project) =>
|
|
project.id === "nutriscan"
|
|
? {
|
|
...project,
|
|
demoAvailability: "unavailable" as const,
|
|
demoCheckedAt: "2026-09-04T12:00:00.000Z",
|
|
}
|
|
: project,
|
|
);
|
|
|
|
expect(
|
|
selectNotebookProjects(projectsWithUnavailableDemo).find(
|
|
(project) => project.id === "nutriscan",
|
|
),
|
|
).toMatchObject({
|
|
demoAvailability: "unavailable",
|
|
demoCheckedAt: "2026-09-04T12:00:00.000Z",
|
|
});
|
|
});
|
|
});
|