import { render, screen } from "@testing-library/react";
import type { ReactNode } from "react";
import CinematicHome from "./CinematicHome";
jest.mock("next/dynamic", () => {
const labels = [
"About",
"Skills",
"Experience",
"WorkModalities",
"Contact",
"LighthouseMetrics",
"Footer",
"ScrollVelocityText",
"SectionDivider",
];
let index = 0;
return () => {
const label = labels[index++] ?? "DynamicSection";
return function DynamicMock() {
return
{label}
;
};
};
});
jest.mock("../Hero", () => () => );
jest.mock("../Projects", () => () => );
jest.mock("../story/ReelDirector", () => () => (
));
jest.mock("../story/NotebookStory", () => () => (
));
jest.mock(
"./CinematicSection",
() =>
({ children }: { children: ReactNode }) => <>{children}>,
);
describe("CinematicHome", () => {
it("uses one notebook story and keeps About after it", () => {
render(
,
);
const story = screen.getByTestId("notebook-story");
const about = screen.getByTestId("dynamic-About");
expect(story).toBeInTheDocument();
expect(screen.queryByTestId("print-reel")).not.toBeInTheDocument();
expect(screen.queryByTestId("scroll-story")).not.toBeInTheDocument();
expect(
Boolean(
story.compareDocumentPosition(about) & Node.DOCUMENT_POSITION_FOLLOWING,
),
).toBe(true);
});
});