Files
community-rule/tests/components/TopWithPathname.test.tsx
T
adilalloandCursor 33cdaf135c Match Home, top nav, hero, and logo wall to the current marketing frames.
Puts Workshops in the header, pairs the hero with a static rule card and breakpoint CTAs, and shows the three pilot marks with no wall label.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-11-02 18:50:32 -07:00

35 lines
1.0 KiB
TypeScript

import { describe, expect, it, vi } from "vitest";
import "@testing-library/jest-dom/vitest";
import TopWithPathname from "../../app/components/navigation/Top/TopWithPathname";
import { renderWithProviders, screen } from "../utils/test-utils";
const { pushMock } = vi.hoisted(() => ({ pushMock: vi.fn() }));
vi.mock("next/navigation", () => ({
useRouter: () => ({
push: pushMock,
replace: vi.fn(),
prefetch: vi.fn(),
back: vi.fn(),
forward: vi.fn(),
refresh: vi.fn(),
}),
usePathname: () => "/learn",
}));
vi.mock("../../lib/create/api", () => ({
fetchAuthSession: () => new Promise(() => {}),
}));
describe("TopWithPathname", () => {
it("renders Profile from the server session before /api/auth/session resolves", () => {
renderWithProviders(<TopWithPathname initialSignedIn />);
expect(
screen.getAllByRole("menuitem", { name: /go to your profile/i }).length,
).toBeGreaterThan(0);
expect(
screen.queryByRole("button", { name: /log in to your account/i }),
).not.toBeInTheDocument();
});
});