Skip to main content
Module

std/testing/mock.ts>ConstructorSpy

The Deno Standard Library
Go to Latest
interface ConstructorSpy
import { type ConstructorSpy } from "https://deno.land/std@0.223.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.