sinon-chrome icon indicating copy to clipboard operation
sinon-chrome copied to clipboard

chrome.storage.onChanged.addListener

Open maximedb opened this issue 4 years ago • 1 comments

How would you mock chrome.storage.onChanged.addListener with sinon-chrome ?

Thanks!

maximedb avatar Oct 21 '19 09:10 maximedb

Working example:

const spy = jest.fn();
chrome.storage.onChanged.addListener(spy);
chrome.storage.onChanged.trigger({unrelatedKey: 123}, 'local')
expect(spy).toHaveBeenCalledWith({unrelatedKey: 123}, 'local');

fregante avatar Oct 28 '23 08:10 fregante