Function assertSpyCalls

  • Asserts that a spy is called as much as expected and no more.

    Type Parameters

    • Self

      The self type of the spy function.

    • Args extends unknown[]

      The arguments type of the spy function.

    • Return

      The return type of the spy function.

    Parameters

    Returns void

    import { assertSpyCalls, spy } from "@std/testing/mock";

    const func = spy();

    func();
    func();

    assertSpyCalls(func, 2);