Skip to main content
Using Deno in production at your company? Earn free Deno merch.
Give us feedback
Go to Latest
class PreProgrammedMethod
import { PreProgrammedMethod } from "https://deno.land/x/rhum@v2.1.0-rc.1/src/pre_programmed_method.ts";

Class that allows to be a "stand-in" for a method. For example, when used in a mock object, the mock object can replace methods with pre-programmed methods (using this class), and have a system under test use the pre-programmed methods.

Constructors

new
PreProgrammedMethod(methodName: MethodOf<OriginalObject>)

Type Parameters

OriginalObject
ReturnValue

Properties

readonly
error: void
readonly
return: ReturnValue
readonly
will_return: boolean
readonly
will_throw: boolean

Methods

willReturn(returnValue: ReturnValue): void

Pre-program this method to return the given value.

willThrow(error: IError): void

Pre-program this method to throw the given error.