In 0.9.3 test asserting `window.location.assign` fails
Tirke opened this issue · comments
Hello, when I bump from 0.9.2 to 0.9.3 I have a test like this that is now failing. Test is stripped down a bit.
const token = 'myToken'
const redirectUrl = 'myRedirection'
window.localStorage.setItem('accessToken', token)
mockRouter.setCurrentUrl({
pathname: Routes.WorkerLogin,
query: { redirectUrl },
})
const { user } = await render()
await editPhoneInput(user, '0625045131')
await editPasswordInput(user, '1234')
await clickSignInButton(user)
await waitFor(() => {
expect(window.location.assign).toHaveBeenCalledTimes(1)
})
Error: expect(window.location.assign).toHaveBeenCalledTimes(expected)
Expected number of calls: 1
Received number of calls: 0
I do not think this is related to next-router-mock
. This lib does not touch window.location
in any way.
The only difference between 0.9.2 and 0.9.3 is the added route
parameter: #76