std/testing/mock.ts

Deno standard library
Go to Latest
interface Spy
import { type Spy } from "https://deno.land/std@0.146.0/testing/mock.ts?s=Spy";

A function or instance method wrapper that records all calls made to it.

Type Parameters

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

Call Signatures

(this: Self, ...args: Args): Return[src]

Properties

original: (this: Self, ...args: Args) => Return[src]

The function that is being spied on.

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

Information about calls made to the function or instance method.

restored: boolean[src]

Whether or not the original instance method has been restored.

Methods

restore(): void[src]

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