I am trying to test whether a window.location.href changes after a button is clicked. When in my component I use useNavigate to navigate to another page of my app, I can easily test the change of url. However when I try other navigation options like href="" or calling window.location.assign('...'), none of them are working in tests.
Here is the expectation I use in every scenario: expect(global.window.location.href).toBe('...')
Why does the url change in tests when I use useNavigate and why it doesn't when I use window.location.assign?