Back to Sinon

spy.calledWith

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

22.1.0693 B
Original Source

spy.calledWith

Returns true, when the fake, spy or stub was called at least once with the provided arguments.

Can be used for partial matching, Sinon only checks the provided arguments against actual arguments, so a call that received the provided arguments (in the same spots) and possibly others as well will return true.

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

Resetting calledWith to default

You can reset calledWith in three different ways: