Marek Rozmus

Photo by Michael Jasmund on Unsplash

Another unit test and another mocking issue. The code to be tested is more less like this:

To test this component we need to mock:

window.location.pathname

window.open

window.location.replace

Conclusion

Now we can write some tests and check if proper methods with proper arguments are called.

Want to help me in…

--

--