Skip to content

Instantly share code, notes, and snippets.

@goldbergyoni
Last active April 4, 2021 11:55
Show Gist options
  • Select an option

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

Select an option

Save goldbergyoni/49cf85898432b79058838b67a92d793a to your computer and use it in GitHub Desktop.
Delete white-box
test("When deleting an existing order, Then the DB should have 0 records", async () => {
// Arrange
const orderToAdd = {
userId: 1,
productId: 2,
invoiceId: `123`, //unique field
};
await request(expressApp).post("/order").send(orderToAdd);
// Act
const receivedResponse = await request(expressApp).delete(`/order/${existingOrderId}`);
// Assert
const numberOfOrders = await Orders.count;
expect(numberOfOrders).toBe(0);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment