Interface Spy<Self, Args, Return>

A function or instance method wrapper that records all calls made to it.

interface Spy<Self, Args, Return> {
    calls: SpyCall<Self, Args, Return>[];
    original: ((this: Self, ...args: Args) => Return);
    restored: boolean;
    restore(): void;
    (this: Self, ...args: Args): Return;
}

Type Parameters

  • Self = any
  • Args extends unknown[] = any[]
  • Return = any
Hierarchy

Properties

Methods

Properties

calls: SpyCall<Self, Args, Return>[]

Information about calls made to the function or instance method.

original: ((this: Self, ...args: Args) => Return)

The function that is being spied on.

restored: boolean

Whether or not the original instance method has been restored.

Methods

  • If spying on an instance method, this restores the original instance method.

    Returns void