Created
October 29, 2019 15:58
-
-
Save goldbergyoni/5508b12233fe327ed3564a2956a2e78f to your computer and use it in GitHub Desktop.
grey-box-component-test
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
| test('When an order error occurs, an email is sent to the admin', () => { | |
| //Arrange | |
| sinon.stub(dataAccessCode , 'saveOrder').throws(new Error('DB save failed')); | |
| const spyOnMailer = sinon.spy(mailer , "sendEmail"); | |
| const orderToAdd = {userId: 1, productId: 2, mode: 'approved'}; | |
| //Act | |
| const receivedResponse = await request(expressApp).post("/order").send(orderToAdd); | |
| //Assert | |
| expect(spyOnMailer.calledWith(configurationService.adminEmail)).toBe(true); | |
| }); | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment