Breakpoint clones were still in the tab order, marketing always painted Log in, and at 430px the logo overlay covered Use cases and Learn. Co-authored-by: Cursor <cursoragent@cursor.com>
35 lines
1.0 KiB
TypeScript
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.getByRole("menuitem", { name: /go to your profile/i }),
|
|
).toBeInTheDocument();
|
|
expect(
|
|
screen.queryByRole("button", { name: /log in to your account/i }),
|
|
).not.toBeInTheDocument();
|
|
});
|
|
});
|