Interface Stub<Self, Args, Return>

An instance method replacement that records all calls made to it.

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

Type Parameters

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

Properties

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

Information about calls made to the function or instance method.

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

The function that is used instead of the original.

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

  • Returns void