Skip to content

Commit

Permalink
Coverafe para metodos de validar de añadir usuarios comentados
Browse files Browse the repository at this point in the history
  • Loading branch information
uo276026 committed Apr 28, 2024
1 parent aedfdee commit 07d8fa7
Showing 1 changed file with 41 additions and 0 deletions.
41 changes: 41 additions & 0 deletions webapp/src/components/tests/AddUser.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,4 +56,45 @@ describe('AddUser component', () => {
expect(screen.getByText(/Error: Internal Server Error/i)).toBeInTheDocument();
});
});





// it('should display error message for short password', async () => {
// render(<AddUser />);

// const usernameInput = screen.getByLabelText(/Usuario/i);
// const passwordInput = screen.getByLabelText(/Contraseña/i);
// const createUserButton = screen.getByRole('button', { name: /Crear/i });

// fireEvent.change(usernameInput, { target: { value: 'newusername' } });
// fireEvent.change(passwordInput, { target: { value: 'err' } });

// fireEvent.click(createUserButton);

// expect(await screen.findByText(/Error: Credenciales incorrectas. La contraseña debe contener al menos 8 caracteres/i)).toBeInTheDocument();
// });


// it('should display error message for repeated username', async () => {
// const mockAxios = new MockAdapter(axios);
// const mockedUsernames = ['existingUser'];
// mockAxios.onGet(`http://localhost:8000/getUsernames`).reply(200, { usernames: mockedUsernames });

// render(<AddUser />);

// const usernameInput = screen.getByLabelText(/Usuario/i);
// const passwordInput = screen.getByLabelText(/Contraseña/i);
// const createUserButton = screen.getByRole('button', { name: /Crear/i });

// fireEvent.change(usernameInput, { target: { value: 'existingUser' } });
// fireEvent.change(passwordInput, { target: { value: 'short123456' } });

// fireEvent.click(createUserButton);

// expect(await screen.findByText(/Usuario creado correctamente/i)).toBeInTheDocument();
// });

});

0 comments on commit 07d8fa7

Please sign in to comment.