Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: sendMessage promise should resolve to undefined when no listeners reply #140

Merged
merged 1 commit into from Jul 4, 2018

Conversation

rpl
Copy link
Member

@rpl rpl commented Jul 2, 2018

This PR contains the changes from #131 with the addition of some small tweaks (from the last review on #131) and an additional integration test (to check that the behavior of the polyfill in Chrome is the same of the one on Firefox with the native promised APIs).

Fixes #130


test("sendMessage and no listener answers", async (t) => {
const reply = await browser.runtime.sendMessage("test - sendMessage and no listener answers");
t.equal(reply, undefined, "Got undefined as a reply a expected");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo: as expected

},
};

fakeChrome.runtime.sendMessage.onFirstCall().callsArgWith(1, ["res1", "res2"]);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: Use .callsArg(1) or callsArgWith(1, [undefined]); .
In reality the sendMessage callback won't ever be invoked with two arguments.

@ExE-Boss ExE-Boss mentioned this pull request Jul 3, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants