Currently, I am implementing unit test for my project and there is a file that contained window.location.href.
window.location.href
I want to mock this to test and here is m
You can try a helper:
const setURL = url => global.jsdom.reconfigure({url}); describe('Test current location', () => { test('with GET parameter', () => { setURL('https://test.com?foo=bar'); // ...your test here }); });