fix: update tests for information-request and intermediate pages

- Fix use-is-on-intermediate-page test to check correct paths
  (/onboarding/new-account-form and /onboarding/information-request)
- Fix information-request test to use correct i18n key
  (ENTERPRISE$SELF_HOSTED_CARD_DESCRIPTION)
- Mock useTracking hook to avoid QueryClient dependency

Co-authored-by: openhands <openhands@all-hands.dev>
This commit is contained in:
openhands
2026-03-19 17:58:51 +00:00
parent a515a96f0a
commit aa6623731e
2 changed files with 16 additions and 3 deletions

View File

@@ -27,8 +27,14 @@ describe("useIsOnIntermediatePage", () => {
expect(result.current).toBe(true);
});
it("should return true when on /onboarding page", () => {
useLocationMock.mockReturnValue({ pathname: "/onboarding" });
it("should return true when on /onboarding/new-account-form page", () => {
useLocationMock.mockReturnValue({ pathname: "/onboarding/new-account-form" });
const { result } = renderHook(() => useIsOnIntermediatePage());
expect(result.current).toBe(true);
});
it("should return true when on /onboarding/information-request page", () => {
useLocationMock.mockReturnValue({ pathname: "/onboarding/information-request" });
const { result } = renderHook(() => useIsOnIntermediatePage());
expect(result.current).toBe(true);
});

View File

@@ -14,6 +14,13 @@ vi.mock("react-router", async () => {
};
});
// Mock useTracking to avoid QueryClient dependency
vi.mock("#/hooks/use-tracking", () => ({
useTracking: () => ({
trackEnterpriseLeadFormSubmitted: vi.fn(),
}),
}));
describe("InformationRequest", () => {
beforeEach(() => {
vi.clearAllMocks();
@@ -64,7 +71,7 @@ describe("InformationRequest", () => {
renderWithRouter();
expect(screen.getByText("ENTERPRISE$SELF_HOSTED_TITLE")).toBeInTheDocument();
expect(screen.getByText("ENTERPRISE$SELF_HOSTED_DESCRIPTION")).toBeInTheDocument();
expect(screen.getByText("ENTERPRISE$SELF_HOSTED_CARD_DESCRIPTION")).toBeInTheDocument();
});
it("should render SaaS features", () => {