Class: FunctionStub

Represents an object that allows stubbing function invocations.

Constructor

Gets invoked during the stub registration.

init (MockFunction mockFunction)

Methods

thenReturn

Sets the value to be returned when the function is called.

withArguments

Sets the arguments list to consider when stubbing the function call.

doNothing

Sets the function behavior to do nothing when called.

call

Sets a function to be invoked when the real function is called.

callOriginal

Sets the original function to be invoked.

thenReturn

function thenReturn(any | error returnValue)
Isolated Function

Sets the value to be returned when the function is called.

Parameters

  • returnValue any | error
  • Value or error to return

withArguments

function withArguments(anydata | error... args) returns FunctionStub
Isolated Function

Sets the arguments list to consider when stubbing the function call.

Parameters

  • args anydata | error...
  • Arguments list

Return Type

(FunctionStub)

Object that allows stubbing calls to a function

doNothing

function doNothing()
Isolated Function

Sets the function behavior to do nothing when called.

call

function call(string functionName)
Isolated Function

Sets a function to be invoked when the real function is called.

Parameters

  • functionName string
  • Mock function to call in place of the real

callOriginal

function callOriginal()
Isolated Function

Sets the original function to be invoked.