When should each of these methods be called, and why?
const spyStart = spyOn(el, 'func1');
expect(spyStart).toHaveBeenCalled();
const spyStart = spyOn(el, 'func1');
expect(spyStart).toBeCalled();
Actually .toBeCalled
is an alias to .toHaveBeenCalled
, so they do the same thing.
From the docs:
.toHaveBeenCalled() Also under the alias: .toBeCalled()
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With