Skip to content

Commit

Permalink
test: create named variable for path to homepage
Browse files Browse the repository at this point in the history
  • Loading branch information
Rudi Kraeher committed Mar 4, 2022
1 parent 7ad1670 commit aa0a0bb
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/tests/Login.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,8 @@ it('redirects to Home if user is logged in', () => {
const history = createBrowserHistory();
history.replace = jest.fn();

const pathToHome = '/';

render(
<AuthContext.Provider value={{ isAuth: true }}>
<Router history={history}>
Expand All @@ -158,6 +160,6 @@ it('redirects to Home if user is logged in', () => {
expect(screen.queryByRole('button', { name: "Login" })).not.toBeInTheDocument();

expect(history.replace).toHaveBeenCalledWith(expect.objectContaining({
pathname: '/'
pathname: pathToHome,
}));
});

0 comments on commit aa0a0bb

Please sign in to comment.