mirror of
https://github.com/OpenHands/OpenHands.git
synced 2026-03-22 05:37:20 +08:00
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:
@@ -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);
|
||||
});
|
||||
|
||||
@@ -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", () => {
|
||||
|
||||
Reference in New Issue
Block a user