Skip to content

Instantly share code, notes, and snippets.

@goldbergyoni
Created December 26, 2018 14:07
Show Gist options
  • Select an option

  • Save goldbergyoni/fab6112a9e0dbe0c6333ba82a2f8a495 to your computer and use it in GitHub Desktop.

Select an option

Save goldbergyoni/fab6112a9e0dbe0c6333ba82a2f8a495 to your computer and use it in GitHub Desktop.
Spies
it("When a valid product is about to be deleted, ensure an email is sent", async () => {
//Assume we already added here a product
const spy = sinon.spy(Emailer.prototype, "sendEmail");
new ProductService().deletePrice(theProductWeJustAdded);
//hmmm OK: we deal with internals? Yes, but as a side effect of testing the requirements (sending an email)
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment