Skip to content

Commit aa0a0bb

Browse files
author
Rudi Kraeher
committed
test: create named variable for path to homepage
1 parent 7ad1670 commit aa0a0bb

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/tests/Login.test.jsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,8 @@ it('redirects to Home if user is logged in', () => {
147147
const history = createBrowserHistory();
148148
history.replace = jest.fn();
149149

150+
const pathToHome = '/';
151+
150152
render(
151153
<AuthContext.Provider value={{ isAuth: true }}>
152154
<Router history={history}>
@@ -158,6 +160,6 @@ it('redirects to Home if user is logged in', () => {
158160
expect(screen.queryByRole('button', { name: "Login" })).not.toBeInTheDocument();
159161

160162
expect(history.replace).toHaveBeenCalledWith(expect.objectContaining({
161-
pathname: '/'
163+
pathname: pathToHome,
162164
}));
163165
});

0 commit comments

Comments
 (0)