extend-chrome / jest-chrome

A complete mock of the Chrome API for Chrome extensions for use with Jest.
MIT License
124 stars 24 forks source link

`expect(chrome.runtime.onMessage.addListener).toHaveBeenCalled()` #20

Open fregante opened 1 year ago

fregante commented 1 year ago

Is your feature request related to a problem? Please describe.

I'm trying to test that a function is registering events, but it seem that this use case was not considered. The readme helpfully demoes the testing of events but not in the same way.

Describe the solution you'd like

addListener should be mocked so that I can expect calls on it