concept test("cancels operation in category javascript
appears as: test("ccels operation

This is an excerpt from Manning's book Testing JavaScript Applications.
const { inventory, addToInventory } = require("./inventoryController"); beforeEach(() => inventory.set("cheesecake", 0)); test("cancels operation for invalid quantities", () => { expect.hasAssertions(); #1 try { addToInventory("cheesecake", "not a number"); } catch (e) { expect(inventory.get("cheesecake")).toBe(0); } });
Figure 3.7. The range of results accepted by the type assertion.
![]()