Skip to main content

interface Spy.ClsMeta<C,A>

The metadata object type for a spied class.

Type parameters

NameConstraintsDescription
Cthe class type
Aany[]the class constructor parameter array type

Properties

constructorCalls

Returns an array of received constructor call parameters.

Definition

get constructorCalls(): A[];

instances

Returns an array of class instance metadata objects containing all instances created from the spy class.

Definition

get instances(): Spy.ClsObj<C, A>[];

nrInstances

Returns the number of class instances created from the spy.

Definition

get nrInstances(): number;

Methods

clearInstances

Empties the history of created spy class instances.

Definition

clearInstances(): void;

resetAllStubs

Resets the current spy class constructor stub and all the instances method stubs.

Definition

resetAllStubs(): void;

resetConstructorStub

Resets the used constructor to the originally given constructor.

Definition

resetConstructorStub(): void;

resetInstanceStubs

Resets all the current instance method stubs.

Definition

resetInstanceStubs(): void;

setConstructorStub

Sets the used constructor stub function for new instances of the spy class.

Definition

setConstructorStub(constructor: Func<A, C> | undefined): void;

Parameters

NameTypeDescription
constructorFunc<A, C> | undefinedthe function to use as constructor of the class