Skip to content

Commit

Permalink
removing repeated code in Statistics test
Browse files Browse the repository at this point in the history
  • Loading branch information
ritacatuxo committed Apr 28, 2024
1 parent a5fcd6e commit 899363e
Showing 1 changed file with 1 addition and 14 deletions.
15 changes: 1 addition & 14 deletions webapp/src/components/stats/Statistics.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,20 +33,7 @@ describe('Statistics component', () => {
expect(screen.getByText(mockUser.email)).toBeInTheDocument();
});

it('renders user information correctly', async () => {
const mockUser = { username: 'testuser', email: '[email protected]' };
(useUserStore.getState as jest.Mock).mockReturnValue({ user: mockUser });
(getUser as jest.Mock).mockResolvedValue(mockUser);

await act(async () => {
render(<Router>
<Statistics />
</Router>);
});

expect(screen.getByText(mockUser.username)).toBeInTheDocument();
expect(screen.getByText(mockUser.email)).toBeInTheDocument();
});


it('handles error during user retrieval', async () => {
const errorMessage = 'Failed to retrieve user';
Expand Down

0 comments on commit 899363e

Please sign in to comment.