Asserts that a spy is called as expected.
The self type of the spy function.
The arguments type of the spy function.
The return type of the spy function.
The spy to check
The index of the call to check
Optional
The expected spy call.
import { assertSpyCall, 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.assertSpyCall(func, 0, { args: [3, 4], returned: 7 });assertSpyCall(func, 1, { args: [5, 6], returned: 11 }); Copy
import { assertSpyCall, 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.assertSpyCall(func, 0, { args: [3, 4], returned: 7 });assertSpyCall(func, 1, { args: [5, 6], returned: 11 });
Asserts that a spy is called as expected.