@@ -104,7 +104,97 @@ describe("Talks", () => {
104104 expect ( dropdownElement ) . toBeInTheDocument ( ) ;
105105 } ) ;
106106
107- // Tests for the new topTenTalks array
107+ // Tests for the topThreeTalks array
108+ it ( "renders the top three talks section with correct awards" , ( ) => {
109+ renderWithQueryClient ( < Talks /> ) ;
110+
111+ // Check for award titles
112+ expect ( screen . getByText ( "Funniest talk" ) ) . toBeInTheDocument ( ) ;
113+ expect ( screen . getByText ( "Best Rated" ) ) . toBeInTheDocument ( ) ;
114+ expect ( screen . getByText ( "Most original" ) ) . toBeInTheDocument ( ) ;
115+ } ) ;
116+
117+ it ( "renders all top three talks with correct speaker names and talk titles" , ( ) => {
118+ renderWithQueryClient ( < Talks /> ) ;
119+
120+ // Check for speaker names
121+ expect ( screen . getByText ( "Victor Rentea" ) ) . toBeInTheDocument ( ) ;
122+ expect ( screen . getByText ( "Laura Perea" ) ) . toBeInTheDocument ( ) ;
123+ expect ( screen . getByText ( "Marc Nuri" ) ) . toBeInTheDocument ( ) ;
124+
125+ // Check for talk titles
126+ expect (
127+ screen . getByText ( "Top 10 Rest API Design Falls" ) ,
128+ ) . toBeInTheDocument ( ) ;
129+ expect ( screen . getByText ( "GenAI among us" ) ) . toBeInTheDocument ( ) ;
130+ expect (
131+ screen . getByText (
132+ "Model Context Protocol Servers 101: Unlocking the Power of AI" ,
133+ ) ,
134+ ) . toBeInTheDocument ( ) ;
135+ } ) ;
136+
137+ it ( "renders top three talks with correct images" , ( ) => {
138+ renderWithQueryClient ( < Talks /> ) ;
139+
140+ // Check for images with correct src attributes
141+ const images = screen . getAllByRole ( "img" ) ;
142+ const speakerImages = images . filter (
143+ ( img ) =>
144+ img . getAttribute ( "alt" ) === "Victor Rentea" ||
145+ img . getAttribute ( "alt" ) === "Laura Perea" ||
146+ img . getAttribute ( "alt" ) === "Marc Nuri" ,
147+ ) ;
148+
149+ expect ( speakerImages ) . toHaveLength ( 3 ) ;
150+
151+ const victorImage = speakerImages . find (
152+ ( img ) => img . getAttribute ( "alt" ) === "Victor Rentea" ,
153+ ) ;
154+ const lauraImage = speakerImages . find (
155+ ( img ) => img . getAttribute ( "alt" ) === "Laura Perea" ,
156+ ) ;
157+ const marcImage = speakerImages . find (
158+ ( img ) => img . getAttribute ( "alt" ) === "Marc Nuri" ,
159+ ) ;
160+
161+ expect ( victorImage ) . toHaveAttribute (
162+ "src" ,
163+ "https://sessionize.com/image/2fde-400o400o1-NVbZAJzrFZpcRjEe5khxjo.png" ,
164+ ) ;
165+ expect ( lauraImage ) . toHaveAttribute (
166+ "src" ,
167+ "https://sessionize.com/image/8df6-400o400o1-LKJE9Ej5xvBK92FtxJDo6U.png" ,
168+ ) ;
169+ expect ( marcImage ) . toHaveAttribute (
170+ "src" ,
171+ "https://sessionize.com/image/3a9a-400o400o1-sJBQfR5Ki5BGPEDG8GQgKM.jpg" ,
172+ ) ;
173+ } ) ;
174+
175+ it ( "renders top three talks with correct links" , ( ) => {
176+ renderWithQueryClient ( < Talks /> ) ;
177+
178+ // Check that links are correctly formatted
179+ const victorLink = screen . getByText ( "Victor Rentea" ) . closest ( "a" ) ;
180+ const lauraLink = screen . getByText ( "Laura Perea" ) . closest ( "a" ) ;
181+ const marcLink = screen . getByText ( "Marc Nuri" ) . closest ( "a" ) ;
182+
183+ expect ( victorLink ) . toHaveAttribute (
184+ "href" ,
185+ ROUTE_MEETING_DETAIL_PLAIN . replace ( ":id" , "838798" ) ,
186+ ) ;
187+ expect ( lauraLink ) . toHaveAttribute (
188+ "href" ,
189+ ROUTE_MEETING_DETAIL_PLAIN . replace ( ":id" , "945091" ) ,
190+ ) ;
191+ expect ( marcLink ) . toHaveAttribute (
192+ "href" ,
193+ ROUTE_MEETING_DETAIL_PLAIN . replace ( ":id" , "874255" ) ,
194+ ) ;
195+ } ) ;
196+
197+ // Tests for the topTenTalks array
108198 it ( "renders the top ten talks section" , ( ) => {
109199 renderWithQueryClient ( < Talks /> ) ;
110200 expect ( screen . getByText ( "🔝 Top Ten rated talks" ) ) . toBeInTheDocument ( ) ;
0 commit comments