Closed kangaro0 closed 7 years ago
@kangaro0 Hi.
Chrome api is just stubs without any behavior. You should manually trigger event in your case.
chrome.runtime.onMessage.addListener(functionSpy);
chrome.runtime.onMessage.trigger(params);
assert.calledOnce(functionSpy.withArgs(params));
Alright. I was on the wrong path here.... Thanks!
Hey,
I'm trying to test my extension's popup code. The popup has a init function which catches data from the background page. In order to do that the popup sends a request to the background page via
chrome.runtime.sendMessage( ... )
.Now I tried different approaches how to 'fake' the response from the background page, currently I'm trying this approach.
But the the listener doesn't get called, once the Popup sends the request... What am I doing wrong?