diff --git a/src/tests/Login.test.jsx b/src/tests/Login.test.jsx index 1d504f6..b82afbd 100644 --- a/src/tests/Login.test.jsx +++ b/src/tests/Login.test.jsx @@ -6,9 +6,9 @@ import '@testing-library/jest-dom'; import Login from "../login/Login"; import { act } from 'react-dom/test-utils'; import { BASE_API } from "../config"; -import { Router } from 'react-router-dom'; import { createBrowserHistory } from 'history'; import { AuthContext } from '../AuthContext'; +import { BrowserRouter as Router, Router as Redirect } from 'react-router-dom'; const server = setupServer( rest.post(`${BASE_API}/login`, (req, res, ctx) => { @@ -30,7 +30,7 @@ afterAll(() => server.close()) it('allows the user to login successfully', async () => { - render() + render() fireEvent.change(screen.getByPlaceholderText('Username or Email'), { target: { value: 'MyUsername' }, @@ -60,7 +60,7 @@ it('handles wrong credentials', async () => { }), ) - render() + render() fireEvent.change(screen.getByPlaceholderText('Username or Email'), { target: { value: 'MyUsername' }, @@ -91,7 +91,7 @@ it('handles wrong credentials', async () => { }), ) - render() + render() fireEvent.change(screen.getByPlaceholderText('Username or Email'), { target: { value: 'MyUsername' }, @@ -112,7 +112,7 @@ it('handles wrong credentials', async () => { it('checks if the fields are empty', async () => { - render() + render() fireEvent.change(screen.getByLabelText("Username or Email:", {selector: "input"}), {target: { value: "" }}) @@ -131,7 +131,7 @@ it('checks if the fields are empty', async () => { it('handles password toggle', () => { - render() + render() expect(screen.getByPlaceholderText('Password').type).toEqual("password") @@ -151,9 +151,9 @@ it('redirects to Home if user is logged in', () => { render( - + - + );