How to test url change with Jest
I found a working method by declaring in the beginning of the test a global variable:
global.window = { location: { pathname: null } };
and checked this variable like this:
expect(global.window.location.pathname).toEqual('/new-url');
That worked fine.
instead of having to set the pathname to null, you can just check it like
expect(global.window.location.href).toContain('/new-url').
so that way you don't have to assign null to the pathname.