Skip to content

Commit c5525e4

Browse files
author
Rudi Kraeher
committed
test: resolve merge conflicts from import alias
1 parent aa0a0bb commit c5525e4

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

src/tests/Login.test.jsx

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ import '@testing-library/jest-dom';
66
import Login from "../login/Login";
77
import { act } from 'react-dom/test-utils';
88
import { BASE_API } from "../config";
9-
import { Router } from 'react-router-dom';
109
import { createBrowserHistory } from 'history';
1110
import { AuthContext } from '../AuthContext';
11+
import { BrowserRouter as Router, Router as Redirect } from 'react-router-dom';
1212

1313
const server = setupServer(
1414
rest.post(`${BASE_API}/login`, (req, res, ctx) => {
@@ -30,7 +30,7 @@ afterAll(() => server.close())
3030

3131

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

3535
fireEvent.change(screen.getByPlaceholderText('Username or Email'), {
3636
target: { value: 'MyUsername' },
@@ -60,7 +60,7 @@ it('handles wrong credentials', async () => {
6060
}),
6161
)
6262

63-
render(<Login />)
63+
render(<Router><Login></Login></Router>)
6464

6565
fireEvent.change(screen.getByPlaceholderText('Username or Email'), {
6666
target: { value: 'MyUsername' },
@@ -91,7 +91,7 @@ it('handles wrong credentials', async () => {
9191
}),
9292
)
9393

94-
render(<Login />)
94+
render(<Router><Login></Login></Router>)
9595

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

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

115-
render(<Login />)
115+
render(<Router><Login></Login></Router>)
116116

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

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

132132

133133
it('handles password toggle', () => {
134-
render(<Login />)
134+
render(<Router><Login></Login></Router>)
135135

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

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

152152
render(
153153
<AuthContext.Provider value={{ isAuth: true }}>
154-
<Router history={history}>
154+
<Redirect history={history}>
155155
<Login />
156-
</Router>
156+
</Redirect>
157157
</AuthContext.Provider>
158158
);
159159

0 commit comments

Comments
 (0)