std/testing/mock.ts

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

Replaces an instance method with a Stub.

Type Parameters

Self[src]
Prop extends keyof Self[src]

Parameters

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

Returns

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

Type Parameters

Self[src]
Prop extends keyof Self[src]

Parameters

self: Self[src]
property: Prop[src]
func: (this: Self, ...args: GetParametersFromProp<Self, Prop>) => GetReturnFromProp<Self, Prop>[src]

Returns

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

Type Parameters

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

Parameters

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

Returns

Stub<Self, Args, Return>[src]