Skip to content

Commit

Permalink
test: resolve merge conflicts from import alias
Browse files Browse the repository at this point in the history
  • Loading branch information
Rudi Kraeher committed Mar 4, 2022
1 parent aa0a0bb commit 4e794d5
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/tests/Login.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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) => {
Expand All @@ -30,7 +30,7 @@ afterAll(() => server.close())


it('allows the user to login successfully', async () => {
render(<Login />)
render(<Router><Login /></Router>)

fireEvent.change(screen.getByPlaceholderText('Username or Email'), {
target: { value: 'MyUsername' },
Expand Down Expand Up @@ -60,7 +60,7 @@ it('handles wrong credentials', async () => {
}),
)

render(<Login />)
render(<Router><Login /></Router>)

fireEvent.change(screen.getByPlaceholderText('Username or Email'), {
target: { value: 'MyUsername' },
Expand Down Expand Up @@ -91,7 +91,7 @@ it('handles wrong credentials', async () => {
}),
)

render(<Login />)
render(<Router><Login /></Router>)

fireEvent.change(screen.getByPlaceholderText('Username or Email'), {
target: { value: 'MyUsername' },
Expand All @@ -112,7 +112,7 @@ it('handles wrong credentials', async () => {

it('checks if the fields are empty', async () => {

render(<Login />)
render(<Router><Login /></Router>)

fireEvent.change(screen.getByLabelText("Username or Email:", {selector: "input"}), {target: { value: "" }})

Expand All @@ -131,7 +131,7 @@ it('checks if the fields are empty', async () => {


it('handles password toggle', () => {
render(<Login />)
render(<Router><Login /></Router>)

expect(screen.getByPlaceholderText('Password').type).toEqual("password")

Expand All @@ -151,9 +151,9 @@ it('redirects to Home if user is logged in', () => {

render(
<AuthContext.Provider value={{ isAuth: true }}>
<Router history={history}>
<Redirect history={history}>
<Login />
</Router>
</Redirect>
</AuthContext.Provider>
);

Expand Down

0 comments on commit 4e794d5

Please sign in to comment.