Skip to main content
Using Deno in production at your company? Earn free Deno merch.
Give us feedback
Module

std/testing/mock.ts>ConstructorSpy

The Deno Standard Library
Latest
interface ConstructorSpy
import { type ConstructorSpy } from "https://deno.land/std@0.224.0/testing/mock.ts";

A constructor wrapper that records all calls made to it.

Type Parameters

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

Properties

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

The function that is being spied on.

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

Information about calls made to the function or instance method.

restored: boolean

Whether or not the original instance method has been restored.

Methods

new(...args: Args): Self
restore(): void

If spying on an instance method, this restores the original instance method.