score:1

Accepted answer

i think your test is actually trying to navigate using window.location

you will need to mock that out before trying the user event

let assignmock = jest.fn();

delete window.location;
window.location = { assign: assignmock };

aftereach(() => {
  assignmock.mockclear();
});

Related Query

More Query from same tag