From 899363e7c6374c0d3dc4a21a672b365591d384f4 Mon Sep 17 00:00:00 2001 From: ritacatuxo Date: Sun, 28 Apr 2024 20:36:36 +0200 Subject: [PATCH] removing repeated code in Statistics test --- webapp/src/components/stats/Statistics.test.tsx | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) diff --git a/webapp/src/components/stats/Statistics.test.tsx b/webapp/src/components/stats/Statistics.test.tsx index 12877e9..9d745c1 100644 --- a/webapp/src/components/stats/Statistics.test.tsx +++ b/webapp/src/components/stats/Statistics.test.tsx @@ -33,20 +33,7 @@ describe('Statistics component', () => { expect(screen.getByText(mockUser.email)).toBeInTheDocument(); }); - it('renders user information correctly', async () => { - const mockUser = { username: 'testuser', email: 'testuser@example.com' }; - (useUserStore.getState as jest.Mock).mockReturnValue({ user: mockUser }); - (getUser as jest.Mock).mockResolvedValue(mockUser); - - await act(async () => { - render( - - ); - }); - - 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';