docs/concepts/assertions/api/called-with.md
assert.calledWith(spyOrSpyCall, arg1, arg2, ...);Passes, when the fake, spy or stub was called with the provided arguments.
It's possible to assert on a dedicated spyCall: sinon.assert.calledWith(call, arg1, arg2, ...);.
import * as sinon from "sinon";
const fake = sinon.fake();
sinon.assert.calledWith(fake, "apple pie");
// => Uncaught Error [AssertError]: expected fake to be called with arguments
fake("apple pie");
// Generates no error
sinon.assert.calledWith(fake, "apple pie");
sinon.assert.calledWith(fake, "lemon meringue pie");
// => Uncaught Error [AssertError]: expected fake to be called with arguments
// => '"apple pie"' '"lemon meringue pie"'
spyCallimport * as sinon from "sinon";
const fake = sinon.fake();
fake("apple pie");
// get a spyCall instance
const call = fake.firstCall;
// Generates no error
sinon.assert.calledWith(call, "apple pie");
<<< ../../../.vitepress/tests/docs/assertions/api/called-with.test.js