Skip to content

Commit

Permalink
Arreglo de test
Browse files Browse the repository at this point in the history
  • Loading branch information
lauracc97 committed Apr 22, 2024
1 parent 1c41997 commit e4b39b8
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
13 changes: 11 additions & 2 deletions webapp/src/components/AddUser.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { render, fireEvent, screen, waitFor } from '@testing-library/react';
import axios from 'axios';
import MockAdapter from 'axios-mock-adapter';
import AddUser from './AddUser';
import { BrowserRouter} from 'react-router-dom';

const mockAxios = new MockAdapter(axios);

Expand All @@ -12,7 +13,11 @@ describe('AddUser component', () => {
});

it('should add user successfully', async () => {
render(<AddUser />);
render(
<BrowserRouter>
<AddUser />
</BrowserRouter>
);

const usernameInput = screen.getByLabelText(/Username/i);
const passwordInput = screen.getByLabelText(/Password/i);
Expand All @@ -35,7 +40,11 @@ describe('AddUser component', () => {
});

it('should handle error when adding user', async () => {
render(<AddUser />);
render(
<BrowserRouter>
<AddUser />
</BrowserRouter>
);

const usernameInput = screen.getByLabelText(/Username/i);
const passwordInput = screen.getByLabelText(/Password/i);
Expand Down
5 changes: 0 additions & 5 deletions webapp/src/components/Login.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,5 @@ describe('Login component', () => {

// Verificar que no hay token en localStorage
expect(localStorage.getItem('token')).toBeNull();
console.log('AAAAAAA'
+ window.location.pathname);

// Verificamos que no se ha ido a Home
expect(window.location.pathname).not.toBe('/home');
});
});

0 comments on commit e4b39b8

Please sign in to comment.