docs/concepts/assertions/api/called-once-with-exactly.md
assert.calledOnceWithExactly(spyOrSpyCall, arg1, arg2, ...);Passes, when the fake, spy or stub was called exactly once, with exactly the provided arguments.
It's possible to assert on a dedicated spyCall: sinon.assert.calledOnceWithExactly(call, arg1, arg2, ...);.
import * as sinon from "sinon";
const fake = sinon.fake();
sinon.assert.calledOnceWithExactly(fake, "apple pie");
// => Uncaught Error [AssertError]: expected fake to be called with exact arguments
fake("apple pie");
// Generates no error
sinon.assert.calledOnceWithExactly(fake, "apple pie");
fake("apple pie");
sinon.assert.calledOnceWithExactly(fake, "apple pie");
// => Uncaught Error [AssertError]: expected fake to be called once and with exact arguments
// => Call 1:
// => '"apple pie"'
// => Call 2:
// => '"apple 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.calledOnceWithExactly(fake, "apple pie");
<<< ../../../.vitepress/tests/docs/assertions/api/called-once-with-exactly.test.js