Function assertSpyCallArg
- assert
Spy <Self, Args, Return, ExpectedArg>(spy, callIndex, argIndex, expected): ExpectedArgCall Arg Type Parameters
Parameters
- spy: SpyLike<Self, Args, Return>
The spy to check.
- callIndex: number
The index of the call to check.
- argIndex: number
The index of the arguments to check.
- expected: ExpectedArg
The expected argument.
Returns ExpectedArg
The actual argument.
Example: Usage
import { assertSpyCallArg, spy } from "@std/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.
assertSpyCallArg(func, 0, 0, 3);
assertSpyCallArg(func, 0, 1, 4);
assertSpyCallArg(func, 1, 0, 5);
assertSpyCallArg(func, 1, 1, 6);- spy: SpyLike<Self, Args, Return>
Asserts that a spy is called with a specific arg as expected.