Skip to main content
Module

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

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

The extra information added to spied functions.

Methods

getter
nrCalls(): number

Returns the number of calls this spy function has received.

getter
isCalled(): boolean

Returns true if the spy function has received at least one call.

getter
calls(): Parameters<F>[]

Returns an array containing, for each received spy call, the given parameters.

setStub(stub: Spy.FnStub<F> | undefined): void

Sets a stub implementation for this spy function, which will be used instead of the current function implementation upon the next received call.

resetStub(): void

Resets the implementation used for the next spy function call to the original one used at construction time.

clearCalls(): void

Clears the spy functions' calls and nrCalls history.