Created
December 26, 2018 14:02
-
-
Save goldbergyoni/30c735fca10bf8937491d4b0bae43c47 to your computer and use it in GitHub Desktop.
Mocks focus on the internal
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| it("When a valid product is about to be deleted, ensure data access DAL was called once, with the right product and right config", async () => { | |
| //Assume we already added a product | |
| const dataAccessMock = sinon.mock(DAL); | |
| //hmmm BAD: testing the internals is actually our main goal here, not just a side-effecr | |
| dataAccessMock.expects("deleteProduct").once().withArgs(DBConfig, theProductWeJustAdded, true, false); | |
| new ProductService().deletePrice(theProductWeJustAdded); | |
| mock.verify(); | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment