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

std/testing/mock.ts>stub

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

Replaces an instance method with a Stub.

Type Parameters

Self
Prop extends keyof Self

Parameters

self: Self
property: Prop

Returns

Stub<Self, GetParametersFromProp<Self, Prop>, GetReturnFromProp<Self, Prop>>

Type Parameters

Self
Prop extends keyof Self

Parameters

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

Returns

Stub<Self, GetParametersFromProp<Self, Prop>, GetReturnFromProp<Self, Prop>>