assertSpyCall
import { assertSpyCall } from "jsr:@ende/testing/mock";function
function assertSpyCall<Self, Args extends unknown[], Return>(spy: SpyLike<Self, Args, Return>, callIndex: number, expected?: ExpectedSpyCall<Self, Args, Return>): voidAsserts that a spy is called as expected.
spy: SpyLike<Self, Args, Return>The spy to check
callIndex: numberThe index of the call to check
expected?: ExpectedSpyCall<Self, Args, Return>The expected spy call.
Example: Usage
import { assertSpyCall, spy } from "@ende/testing/mock";
const func = spy((a: number, b: number) => a + b);
func(3, 4);
func(5, 6);
// asserts each call made to the spy function.
assertSpyCall(func, 0, { args: [3, 4], returned: 7 });
assertSpyCall(func, 1, { args: [5, 6], returned: 11 });