File tree Expand file tree Collapse file tree
src/components/Timer/__test__ Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -36,8 +36,11 @@ describe('Countdown Component', () => {
3636 expect ( screen . getByText ( 'Goal: 01:00:00' ) ) . toBeInTheDocument ( ) ;
3737 expect ( screen . getByText ( 'Elapsed: 00:30:00' ) ) . toBeInTheDocument ( ) ;
3838 expect ( screen . getByText ( 'Time Remaining' ) ) . toBeInTheDocument ( ) ;
39- expect ( screen . getByText ( '00' ) ) . toBeInTheDocument ( ) ;
39+ expect ( screen . getAllByText ( '00' ) ) . toHaveLength ( 2 ) ;
4040 expect ( screen . getByText ( '30' ) ) . toBeInTheDocument ( ) ;
41+ expect ( screen . getByText ( 'Hours' ) ) . toBeInTheDocument ( ) ;
42+ expect ( screen . getByText ( 'minutes' ) ) . toBeInTheDocument ( ) ;
43+ expect ( screen . getByText ( 'seconds' ) ) . toBeInTheDocument ( ) ;
4144 } ) ;
4245
4346 it ( 'calls toggleTimer when the close button is clicked' , ( ) => {
@@ -51,9 +54,8 @@ describe('Countdown Component', () => {
5154 it ( 'displays correct remaining time based on props' , ( ) => {
5255 // eslint-disable-next-line react/jsx-props-no-spreading
5356 const { rerender } = render ( < Countdown { ...defaultProps } /> ) ;
54- expect ( screen . getByText ( '00' ) ) . toBeInTheDocument ( ) ; // Hours
57+ expect ( screen . getAllByText ( '00' ) ) . toHaveLength ( 2 ) ; // Hours and Seconds
5558 expect ( screen . getByText ( '30' ) ) . toBeInTheDocument ( ) ; // Minutes
56- expect ( screen . getByText ( '00' ) ) . toBeInTheDocument ( ) ; // Seconds
5759
5860 rerender (
5961 < Countdown
You can’t perform that action at this time.
0 commit comments