Interface ConstructorSpy<Self, Args>

A constructor wrapper that records all calls made to it.

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

Type Parameters

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

Constructors

Properties

Methods

Constructors

Properties

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

Information about calls made to the function or instance method.

original: (new (...args: Args) => Self)

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