Back to Sinon

spy.calledOn

docs/concepts/spies/api/called-on.md

22.1.0708 B
Original Source

spy.calledOn

Returns true, when the fake, spy or stub was called at least once with object as this.

calledOn also accepts a matcher spyCall.calledOn(sinon.match(fn)) (see matchers).

<<< ../../../.vitepress/tests/docs/spies/api/called-on.test.js

See Function.prototype.call().

Resetting calledOn to default

You can reset calledOn in three different ways: