Skip to content

Instantly share code, notes, and snippets.

@qunabu
Created November 26, 2020 10:29
Show Gist options
  • Save qunabu/5e8d268ca9b0cf6dd7cc45b14e361537 to your computer and use it in GitHub Desktop.
Save qunabu/5e8d268ca9b0cf6dd7cc45b14e361537 to your computer and use it in GitHub Desktop.
it("should multiply the number passed as parameter and subtract one", () => {
const multiplySpy = spyOn(Calculator, "multiple").and.callThrough();
const subtractSpy = spyOn(Calculator, "subtract").and.callThrough();
const result = Calculator.compute(21.5);
expect(multiplySpy).toHaveBeenCalledWith(21.5, 2);
expect(subtractSpy).toHaveBeenCalledWith(43, 1);
expect(result).toBe(42);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment