std/testing/mock.ts

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

Wraps a function or instance method with a Spy.

Type Parameters

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

Returns

Spy<Self, Args, Return>[src]

Type Parameters

Self[src]
Args extends unknown[][src]
Return[src]

Parameters

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

Returns

Spy<Self, Args, Return>[src]

Type Parameters

Self[src]
Prop extends keyof Self[src]

Parameters

self: Self[src]
property: Prop[src]

Returns

Spy<Self, GetParametersFromProp<Self, Prop>, GetReturnFromProp<Self, Prop>>[src]

Type Parameters

Self[src]
Args extends unknown[][src]
Return[src]

Parameters

optional
funcOrSelf: ((this: Self, ...args: Args) => Return) | Self
[src]
optional
property: keyof Self
[src]

Returns

Spy<Self, Args, Return>[src]