mirror of
https://github.com/prowler-cloud/prowler.git
synced 2026-10-21 10:54:20 +00:00
Co-authored-by: Pablo F.G <pablo.fernandez@prowler.com> Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com> Co-authored-by: alejandrobailo <alejandrobailo94@gmail.com> Co-authored-by: Alejandro Bailo <59607668+alejandrobailo@users.noreply.github.com>
31 lines
865 B
TypeScript
31 lines
865 B
TypeScript
import { render } from "@testing-library/react";
|
|
import { beforeEach, describe, expect, it, vi } from "vitest";
|
|
|
|
import { usePageReadyStore } from "@/store/page-ready";
|
|
|
|
import { PageReady } from "../page-ready";
|
|
|
|
vi.mock("next/navigation", () => ({
|
|
usePathname: () => "/compliance",
|
|
}));
|
|
|
|
describe("PageReady", () => {
|
|
beforeEach(() => usePageReadyStore.setState({ readyPath: null }));
|
|
|
|
it("marks the current route ready on mount", () => {
|
|
render(<PageReady />);
|
|
expect(usePageReadyStore.getState().readyPath).toBe("/compliance");
|
|
});
|
|
|
|
it("clears readiness on unmount", () => {
|
|
const { unmount } = render(<PageReady />);
|
|
unmount();
|
|
expect(usePageReadyStore.getState().readyPath).toBeNull();
|
|
});
|
|
|
|
it("renders nothing", () => {
|
|
const { container } = render(<PageReady />);
|
|
expect(container).toBeEmptyDOMElement();
|
|
});
|
|
});
|