Skip to content

Commit

Permalink
fix navigation-bar unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
mairisb committed Sep 17, 2023
1 parent 537b8dc commit 29b7f0b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
11 changes: 7 additions & 4 deletions packages/client/src/app/navigation-bar/navigation-bar.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,20 @@ describe('NavigationBar', () => {
});

expect(screen.queryByTestId('login-btn')).toBeInTheDocument();
expect(screen.queryByTestId('logout-btn')).toBeNull();
expect(screen.queryByTestId('user-dropdown')).toBeNull();
});

it('should render Logout button when user is logged in', () => {
it('should render user dropdown button when user is logged in', () => {
renderWithProviders(<NavigationBar />, {
preloadedState: {
auth: { isLoggedIn: true } as AuthState,
auth: {
isLoggedIn: true,
user: { username: 'johnsmith' },
} as AuthState,
},
});

expect(screen.queryByTestId('login-btn')).toBeNull();
expect(screen.queryByTestId('logout-btn')).toBeInTheDocument();
expect(screen.queryByTestId('user-dropdown')).toBeInTheDocument();
});
});
1 change: 1 addition & 0 deletions packages/client/src/app/navigation-bar/navigation-bar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ const UserDropdown = () => {
id="nav-dropdown"
drop="down"
align="end"
data-testid="user-dropdown"
>
<NavDropdown.Item as={Link} to="/profile">
Profile
Expand Down

0 comments on commit 29b7f0b

Please sign in to comment.