sinon-chrome
sinon-chrome copied to clipboard
chrome.storage.onChanged.addListener
How would you mock chrome.storage.onChanged.addListener
with sinon-chrome ?
Thanks!
Working example:
const spy = jest.fn();
chrome.storage.onChanged.addListener(spy);
chrome.storage.onChanged.trigger({unrelatedKey: 123}, 'local')
expect(spy).toHaveBeenCalledWith({unrelatedKey: 123}, 'local');