Skip to main content
Module

x/rimbu/spy/index.ts>Spy.ClsMeta

Rimbu is a TypeScript library focused on immutable, performant, and type-safe collections and other tools.
Go to Latest
interface Spy.ClsMeta
import { type Spy } from "https://deno.land/x/rimbu@0.14.0/spy/index.ts";
const { ClsMeta } = Spy;

The metadata object type for a spied class.

Type Parameters

C
A extends any[]

Methods

getter
nrInstances(): number

Returns the number of class instances created from the spy.

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

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

getter
constructorCalls(): A[]

Returns an array of received constructor call parameters.

clearInstances(): void

Empties the history of created spy class instances.

resetAllStubs(): void

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

resetInstanceStubs(): void

Resets all the current instance method stubs.

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

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

resetConstructorStub(): void

Resets the used constructor to the originally given constructor.