feat: definir contratos do notebook story
This commit is contained in:
1 parent
d89dde21ee
commit
8b858528f8
4 files changed
+337
No files matched your search
@@ -0,0 +1,51 @@
|
||||
import { portfolio, type PortfolioProject } from "@/lib/portfolio-data";
|
||||
import { selectNotebookProjects } from "./notebookProjects";
|
||||
|
||||
const projectsFixture = portfolio.projects as PortfolioProject[];
|
||||
|
||||
describe("selectNotebookProjects", () => {
|
||||
it("returns the four ordered projects with local screenshots", () => {
|
||||
const result = selectNotebookProjects(projectsFixture);
|
||||
|
||||
expect(result.map((project) => project.id)).toEqual([
|
||||
"nutriscan",
|
||||
"sc-plus",
|
||||
"sev-modaintima",
|
||||
"as-servicos",
|
||||
]);
|
||||
expect(result.every((project) => project.screenshotSrc.startsWith("/assets/prints/"))).toBe(true);
|
||||
});
|
||||
|
||||
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 without an approved demo URL", () => {
|
||||
const result = selectNotebookProjects(
|
||||
projectsFixture.map((project) =>
|
||||
project.id === "nutriscan" ? { ...project, demoUrl: null } : project,
|
||||
),
|
||||
);
|
||||
|
||||
expect(result.some((project) => project.id === "nutriscan")).toBe(false);
|
||||
});
|
||||
|
||||
it("copies only the browser contract fields", () => {
|
||||
const [project] = selectNotebookProjects(projectsFixture);
|
||||
|
||||
expect(project).toEqual({
|
||||
id: "nutriscan",
|
||||
title: "NutriScan",
|
||||
subtitle: "Análise Nutricional Inteligente",
|
||||
demoUrl: "https://nutriscan.evandro.dev.br",
|
||||
technologies: expect.arrayContaining(["Next.js 14", "TypeScript"]),
|
||||
screenshotSrc: "/assets/prints/print-nutriscan.png",
|
||||
});
|
||||
expect(project).not.toHaveProperty("description");
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user