react-ionize icon indicating copy to clipboard operation
react-ionize copied to clipboard

Improve testability of BrowserWindow mocks

Open Vlemert opened this issue 8 years ago • 0 comments

So this is my first attempt at improving the way BrowserWindow is tested. The only way to create a mocked BrowserWindow now is to call the constructor, which makes sure that the array of windows that’s being tracked internally always represents all the windows that were actually constructed.

I added onNewWindow so tests can register a handler that is called whenever a new window is constructed. This way, tests can still mock certain functions / do whatever they want with the window.

Added acceptFirstMouse tests for bonus points.

Let me know what you think, I could extend this to the other mocked objects as well.

Vlemert avatar Apr 22 '17 10:04 Vlemert