Skip to content

Commit

Permalink
Small fix on tests
Browse files Browse the repository at this point in the history
  • Loading branch information
MarcosBarrilVillaverde committed May 1, 2024
1 parent ed56437 commit 2b6361a
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions webapp/src/usersRanking/test/App.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ describe('App', () => {
const mockUser = Array.from({ length: 20 }, (_, index) => ({
_id: String(index + 1),
username: `User ${index + 1}`,
tpoints: 100,
avgpoints: 100,
ttime: 100,
avgtime: 100,
createdAt: '05/04/2024',
}));

Expand All @@ -36,7 +40,7 @@ describe('App', () => {
});

// Verifica que se haya llamado axios.get con el endpoint correcto
expect(axios.get).toHaveBeenCalledWith('http://localhost:8100/users');
expect(axios.get).toHaveBeenCalledWith('http://localhost:8100/usersStats');
});

test('navigates to the next page', async () => {
Expand Down Expand Up @@ -85,7 +89,7 @@ test('handles unknown error when fetching users', async () => {

render(<MemoryRouter><App /></MemoryRouter>);

expect(axios.get).toHaveBeenCalledWith('http://localhost:8100/users');
expect(axios.get).toHaveBeenCalledWith('http://localhost:8100/usersStats');
});

test('handles error with response.data.error when fetching users', async () => {
Expand All @@ -94,5 +98,5 @@ test('handles error with response.data.error when fetching users', async () => {

render(<MemoryRouter><App /></MemoryRouter>);

expect(axios.get).toHaveBeenCalledWith('http://localhost:8100/users');
expect(axios.get).toHaveBeenCalledWith('http://localhost:8100/usersStats');
});

0 comments on commit 2b6361a

Please sign in to comment.