UNPKG

333 BJavaScriptView Raw
1import * as app from "./index";
2import * as math from "./math";
3
4math.add = jest.fn();
5math.subtract = jest.fn();
6
7test("calls math.add", () => {
8 app.doAdd(1, 2);
9 expect(math.add).toHaveBeenCalledWith(1, 2);
10});
11
12test("calls math.subtract", () => {
13 app.doSubtract(1, 2);
14 expect(math.subtract).toHaveBeenCalledWith(1, 2);
15});