13 changed files with 206 additions and 46 deletions
-
76src/app/intro/intro-client.test.tsx
-
35src/app/intro/intro-client.tsx
-
32src/app/request-accepted/request-accepted-client.tsx
-
3src/components/Componentes/slider-header.tsx
-
14src/components/Componentes/slider-page.test.tsx
-
21src/components/Componentes/slider-page.tsx
-
4src/components/Componentes/slider-slide-five.tsx
-
3src/components/Componentes/slider-slide-four.tsx
-
4src/components/Componentes/slider-slide-one.tsx
-
3src/components/Componentes/slider-slide-three.tsx
-
4src/components/Componentes/slider-slide-two.tsx
-
1src/components/Componentes/slider-slide.tsx
-
10src/config/features.ts
@ -0,0 +1,76 @@ |
|||||
|
import { render, screen, cleanup } from "@testing-library/react"; |
||||
|
import { describe, it, expect, vi, afterEach } from "vitest"; |
||||
|
import { QueryClient, QueryClientProvider } from "@tanstack/react-query"; |
||||
|
import IntroClient from "./intro-client"; |
||||
|
|
||||
|
vi.mock("next/navigation", () => ({ |
||||
|
useRouter: () => ({ |
||||
|
push: vi.fn(), |
||||
|
replace: vi.fn(), |
||||
|
back: vi.fn(), |
||||
|
}), |
||||
|
})); |
||||
|
|
||||
|
vi.mock("@/translations/provider", () => ({ |
||||
|
useI18n: () => ({ |
||||
|
locale: "en", |
||||
|
dictionary: { |
||||
|
"heavenly marriage": "heavenly marriage", |
||||
|
"A Path to Heavenly Marriage": "A Path to Heavenly Marriage", |
||||
|
'We have come together with the goal of creating a secure and confidential path for "permanent marriage" among Muslims': |
||||
|
'We have come together with the goal of creating a secure and confidential path for "permanent marriage" among Muslims', |
||||
|
"user profiles": "user profiles", |
||||
|
matches: "matches", |
||||
|
marriages: "marriages", |
||||
|
Submit: "Submit", |
||||
|
video: "video", |
||||
|
}, |
||||
|
}), |
||||
|
})); |
||||
|
|
||||
|
vi.mock("@/hooks/marriage/use-profile-main", () => ({ |
||||
|
useMarriageProfileQuery: () => ({ |
||||
|
data: undefined, |
||||
|
refetch: vi.fn(), |
||||
|
}), |
||||
|
})); |
||||
|
|
||||
|
vi.mock("@/hooks/marriage/use-marriage-config", () => ({ |
||||
|
useMarriageConfigQuery: () => ({ |
||||
|
data: { |
||||
|
intro_video_url: "https://example.com/intro.mp4", |
||||
|
intro_video_thumbnail_url: "/assets/images/Frame 2095586523.png", |
||||
|
}, |
||||
|
}), |
||||
|
})); |
||||
|
|
||||
|
vi.mock("@/hooks/use-habib-web-ready", () => ({ |
||||
|
useHabibWebReady: vi.fn(), |
||||
|
})); |
||||
|
|
||||
|
vi.mock("@/hooks/use-hardware-back-handler", () => ({ |
||||
|
useHardwareBackHandler: vi.fn(), |
||||
|
})); |
||||
|
|
||||
|
describe("IntroClient", () => { |
||||
|
afterEach(() => { |
||||
|
cleanup(); |
||||
|
}); |
||||
|
|
||||
|
it("renders intro page without video card when SHOW_INTRO_VIDEOS is false", () => { |
||||
|
const queryClient = new QueryClient(); |
||||
|
render( |
||||
|
<QueryClientProvider client={queryClient}> |
||||
|
<IntroClient /> |
||||
|
</QueryClientProvider>, |
||||
|
); |
||||
|
|
||||
|
expect(screen.getByText("A Path to Heavenly Marriage")).toBeInTheDocument(); |
||||
|
expect(screen.getByText("120")).toBeInTheDocument(); |
||||
|
expect(screen.getByText("user profiles")).toBeInTheDocument(); |
||||
|
expect(screen.getByText("Submit")).toBeInTheDocument(); |
||||
|
|
||||
|
// Video thumbnail image should NOT be rendered
|
||||
|
expect(screen.queryByAltText("video")).not.toBeInTheDocument(); |
||||
|
}); |
||||
|
}); |
||||
@ -0,0 +1,10 @@ |
|||||
|
/** |
||||
|
* Feature flag to control the display of intro video content: |
||||
|
* 1. Intro page video preview box (below stats / submit). |
||||
|
* 2. Intro steps slider Step 2 (video watching step). |
||||
|
* |
||||
|
* When `false`: |
||||
|
* - The intro video box on the main intro page is hidden, and elements are centered. |
||||
|
* - Step 2 (Video) in the onboarding slider is removed, reducing the slider to 4 steps with 4 indicator dots. |
||||
|
*/ |
||||
|
export const SHOW_INTRO_VIDEOS = false; |
||||
Write
Preview
Loading…
Cancel
Save
Reference in new issue