@@ -22,17 +22,6 @@ jest.mock("next/navigation", () => ({
2222 usePathname : ( ) => "/" ,
2323} ) ) ;
2424
25- jest . mock ( "@/components/themed-components/registration-link" , ( ) => {
26- return {
27- __esModule : true ,
28- default : ( { children, className } : { children ?: React . ReactNode ; className ?: string } ) => (
29- < div data-testid = "registration-link" className = { className } role = "link" aria-label = "Registration Link" >
30- { children || "Registration Link" }
31- </ div >
32- ) ,
33- } ;
34- } ) ;
35-
3625// Define the current theme and year for better test maintainability
3726const CURRENT_THEME = "Retro vs. Modern" ;
3827const HACKRPI_YEAR = getCurrentHackrpiYear ( ) ;
@@ -109,22 +98,16 @@ describe("AboutUs Component", () => {
10998 expect ( parentContainer ) . toContainElement ( venueElement ) ;
11099 } ) ;
111100
112- it ( "renders the registration link with correct styling" , ( ) => {
113- // 2025 best practice: Render the component and get the container
101+ it ( "renders the registration banner with correct styling" , ( ) => {
114102 const { container } = renderWithProviders ( < AboutUs /> ) ;
115103
116- // 2025 best practice: Use data-testid for more reliable selection
117- const registrationLink = screen . getByTestId ( "registration-link" ) ;
118- expect ( registrationLink ) . toBeInTheDocument ( ) ;
119- expect ( registrationLink ) . toHaveClass ( "text-xl" ) ;
120-
121- // 2025 best practice: Find the REGISTER NOW text using a pattern
122- const registerNowText = screen . getByText ( / R E G I S T E R N O W ! / i) ;
123- expect ( registerNowText ) . toBeInTheDocument ( ) ;
104+ const registerBanner = screen . getByTestId ( "register-now-banner" ) ;
105+ expect ( registerBanner ) . toBeInTheDocument ( ) ;
106+ expect ( registerBanner ) . toHaveTextContent ( / R E G I S T E R N O W ! / i) ;
107+ expect ( registerBanner ) . toHaveClass ( "bg-hackrpi-secondary-orange" ) ;
108+ expect ( registerBanner ) . toHaveClass ( "text-white" ) ;
124109
125- // Verify they are both in the document but don't assert they're in the same container
126- expect ( container ) . toContainElement ( registrationLink ) ;
127- expect ( container ) . toContainElement ( registerNowText ) ;
110+ expect ( container ) . toContainElement ( registerBanner ) ;
128111 } ) ;
129112
130113 it ( 'renders the scrolling "REGISTER NOW!" text with correct styling' , ( ) => {
@@ -137,7 +120,7 @@ describe("AboutUs Component", () => {
137120
138121 // Check styling directly on the element with data-testid
139122 expect ( registerBanner ) . toHaveClass ( "bg-hackrpi-secondary-orange" ) ;
140- expect ( registerBanner ) . toHaveClass ( "text-black " ) ;
123+ expect ( registerBanner ) . toHaveClass ( "text-white " ) ;
141124 expect ( registerBanner ) . toHaveClass ( "overflow-hidden" ) ;
142125 expect ( registerBanner ) . toHaveClass ( "whitespace-nowrap" ) ;
143126 } ) ;
@@ -164,11 +147,8 @@ describe("AboutUs Component", () => {
164147 const { container } = renderWithProviders ( < AboutUs /> ) ;
165148
166149 // 2025 best practice: Test for basic accessibility patterns
167- const links = screen . getAllByRole ( "link" ) ;
168- expect ( links . length ) . toBeGreaterThan ( 0 ) ;
169- links . forEach ( ( link ) => {
170- expect ( link ) . toHaveAccessibleName ( ) ;
171- } ) ;
150+ const links = screen . queryAllByRole ( "link" ) ;
151+ expect ( links . length ) . toBe ( 0 ) ;
172152
173153 const headings = screen . getAllByRole ( "heading" ) ;
174154 expect ( headings . length ) . toBeGreaterThan ( 1 ) ;
@@ -187,7 +167,7 @@ describe("AboutUs Component", () => {
187167
188168 // Check that key elements are still visible on mobile
189169 expect ( screen . getByRole ( "heading" , { name : / A b o u t H a c k R P I / i } ) ) . toBeInTheDocument ( ) ;
190- expect ( screen . getByTestId ( "registration-link " ) ) . toBeInTheDocument ( ) ;
170+ expect ( screen . getByTestId ( "register-now-banner " ) ) . toBeInTheDocument ( ) ;
191171
192172 // Clean up mobile test and set up desktop test
193173 cleanup ( ) ;
@@ -197,7 +177,7 @@ describe("AboutUs Component", () => {
197177
198178 // Verify desktop layout elements
199179 expect ( screen . getByRole ( "heading" , { name : / A b o u t H a c k R P I / i } ) ) . toBeInTheDocument ( ) ;
200- expect ( screen . getByTestId ( "registration-link " ) ) . toBeInTheDocument ( ) ;
180+ expect ( screen . getByTestId ( "register-now-banner " ) ) . toBeInTheDocument ( ) ;
201181 } ) ;
202182
203183 // 2025 Best Practice: Add automated accessibility testing
0 commit comments