@@ -24,13 +24,11 @@ describe( 'TopBar', () => {
2424 jest . clearAllMocks ( ) ;
2525 } ) ;
2626 it ( 'Test unauthenticated TopBar has the Log in button' , async ( ) => {
27- const user = userEvent . setup ( ) ;
2827 const authenticate = jest . fn ( ) ;
2928 ( useAuth as jest . Mock ) . mockReturnValue ( { isAuthenticated : false , authenticate } ) ;
3029 await act ( async ( ) => render ( < TopBar onToggleSidebar = { jest . fn ( ) } /> ) ) ;
30+ expect ( screen . queryByRole ( 'button' , { name : 'Account' } ) ) . not . toBeInTheDocument ( ) ;
3131 expect ( screen . getByRole ( 'button' , { name : 'Log in' } ) ) . toBeVisible ( ) ;
32- await user . click ( screen . getByRole ( 'button' , { name : 'Log in' } ) ) ;
33- expect ( authenticate ) . toHaveBeenCalledTimes ( 1 ) ;
3432 } ) ;
3533
3634 it ( 'Test authenticated TopBar does not have the log in button and it has the settings and account buttons' , async ( ) => {
@@ -39,15 +37,6 @@ describe( 'TopBar', () => {
3937 expect ( screen . queryByRole ( 'button' , { name : 'Log in' } ) ) . not . toBeInTheDocument ( ) ;
4038 expect ( screen . getByRole ( 'button' , { name : 'Account' } ) ) . toBeVisible ( ) ;
4139 } ) ;
42- it ( 'disables log in button when offline' , async ( ) => {
43- ( useOffline as jest . Mock ) . mockReturnValue ( true ) ;
44- ( useAuth as jest . Mock ) . mockReturnValue ( { isAuthenticated : false } ) ;
45- await act ( async ( ) => render ( < TopBar onToggleSidebar = { jest . fn ( ) } /> ) ) ;
46- const loginButton = screen . getByRole ( 'button' , { name : 'Log in' } ) ;
47- expect ( loginButton ) . toHaveAttribute ( 'aria-disabled' , 'true' ) ;
48- fireEvent . mouseOver ( loginButton ) ;
49- expect ( screen . getByRole ( 'tooltip' , { name : 'You’re currently offline.' } ) ) . toBeVisible ( ) ;
50- } ) ;
5140
5241 it ( 'shows offline indicator' , async ( ) => {
5342 ( useOffline as jest . Mock ) . mockReturnValue ( true ) ;
0 commit comments