Mocking openURL in Jest unit tests?



  • Hoping someone else may have found a solution for this. I’m writing unit tests for our PWA at the moment. We have a number of functions that call openURL. I just want to create a mock for openURL to check that it has been called correctly. So far every solution I’ve tried has broken the unit test and generated a “TypeError: Cannot read property 'electron” of undefined" error.