1+ import { render , screen } from '@testing-library/react' ;
2+ import { useRouter } from 'next/navigation' ;
3+ import ThankYouPage from '../page' ;
4+
5+ // Mock next/navigation
6+ jest . mock ( 'next/navigation' , ( ) => ( {
7+ useRouter : jest . fn ( ) ,
8+ } ) ) ;
9+
10+ // Mock framer-motion
11+ jest . mock ( 'framer-motion' , ( ) => ( {
12+ motion : {
13+ div : ( { children, variants, initial, animate, transition, ...props } : any ) =>
14+ < div { ...props } > { children } </ div > ,
15+ svg : ( { children, variants, initial, animate, ...props } : any ) =>
16+ < svg { ...props } > { children } </ svg > ,
17+ path : ( { variants, ...props } : any ) => < path { ...props } /> ,
18+ h1 : ( { children, variants, ...props } : any ) => < h1 { ...props } > { children } </ h1 > ,
19+ p : ( { children, variants, ...props } : any ) => < p { ...props } > { children } </ p > ,
20+ } ,
21+ AnimatePresence : ( { children } : any ) => children ,
22+ } ) ) ;
23+
24+ const mockPush = jest . fn ( ) ;
25+
26+ describe ( 'ThankYouPage' , ( ) => {
27+ beforeEach ( ( ) => {
28+ ( useRouter as jest . Mock ) . mockReturnValue ( {
29+ push : mockPush ,
30+ } ) ;
31+ mockPush . mockClear ( ) ;
32+ } ) ;
33+
34+ it ( 'renders thank you message' , ( ) => {
35+ render ( < ThankYouPage /> ) ;
36+
37+ expect ( screen . getByText ( / t h a n k y o u / i) ) . toBeInTheDocument ( ) ;
38+ expect ( screen . getByText ( / m e s s a g e h a s b e e n s e n t / i) ) . toBeInTheDocument ( ) ;
39+ } ) ;
40+
41+ it ( 'renders animated green checkbox' , ( ) => {
42+ render ( < ThankYouPage /> ) ;
43+
44+ const checkmark = screen . getByTestId ( 'success-checkmark' ) ;
45+ expect ( checkmark ) . toBeInTheDocument ( ) ;
46+ expect ( checkmark ) . toHaveClass ( 'text-green-500' ) ;
47+ } ) ;
48+
49+ it ( 'renders back to home link' , ( ) => {
50+ render ( < ThankYouPage /> ) ;
51+
52+ const backButton = screen . getByRole ( 'button' , { name : / b a c k t o h o m e / i } ) ;
53+ expect ( backButton ) . toBeInTheDocument ( ) ;
54+ } ) ;
55+
56+ it ( 'uses proper typography fonts' , ( ) => {
57+ render ( < ThankYouPage /> ) ;
58+
59+ const heading = screen . getByRole ( 'heading' ) ;
60+ expect ( heading ) . toHaveClass ( 'font-mono' ) ;
61+ } ) ;
62+
63+ it ( 'follows design theme colors' , ( ) => {
64+ render ( < ThankYouPage /> ) ;
65+
66+ const container = screen . getByTestId ( 'thank-you-container' ) ;
67+ expect ( container ) . toHaveClass ( 'bg-background' ) ;
68+ expect ( container ) . toHaveClass ( 'text-text' ) ;
69+ } ) ;
70+
71+ it ( 'has proper responsive layout' , ( ) => {
72+ render ( < ThankYouPage /> ) ;
73+
74+ const container = screen . getByTestId ( 'thank-you-container' ) ;
75+ expect ( container ) . toHaveClass ( 'min-h-screen' ) ;
76+ expect ( container ) . toHaveClass ( 'flex' ) ;
77+ expect ( container ) . toHaveClass ( 'items-center' ) ;
78+ expect ( container ) . toHaveClass ( 'justify-center' ) ;
79+ } ) ;
80+ } ) ;
0 commit comments