Class: Mock

Mock

Represents a mocked function.

Constructor

new Mock(nameopt)

Creates a new mocked function.

Parameters:
Name Type Attributes Default Description
name string <optional>
<anonymous>

Name of the function.

Source:

Members

function

Source:

handler :function

The function that gets executed when the mocked function is called

Type:
  • function
Source:

ignoreOtherCalls

Gets state of global ignore other calls flag

Source:

ignoreOtherCalls

Sets state of the global ignore other calls flag

Source:

name :string

Name of the mocked function.

Type:
  • string
Source:

tree

Sets global tree pointer value

Source:

tree

Gets global tree pointer value.

Source:

Methods

mayBeCalled() → {Expectation}

Creats a new optional Expecatation from this mock.

Source:
Returns:

Expectation created from this mock.

Type
Expectation

mayBeCalledWith(arguments) → {Expectation}

Creats a new optional Expecatation from this mock that expects the specified arguments.

Parameters:
Name Type Description
arguments Array.<object>

Expected arguments

Source:
Returns:

Expectation created from this mock.

Type
Expectation

mayBeCalledWithAnyArguments() → {Expectation}

Creats a new optional Expecatation from this mock that will accept any arguments.

Source:
Returns:

Expectation created from this mock.

Type
Expectation

shouldBeCalled() → {Expectation}

Creats a new required Expecatation from this mock.

Source:
Returns:

Expectation created from this mock.

Type
Expectation

shouldBeCalledWith(arguments) → {Expectation}

Creats a new required Expecatation from this mock that expects the specified arguments.

Parameters:
Name Type Description
arguments Array.<object>

Expected arguments

Source:
Returns:

Expectation created from this mock.

Type
Expectation

shouldBeCalledWithAnyArguments() → {Expectation}

Creats a new required Expecatation from this mock that will accept any arguments.

Source:
Returns:

Expectation created from this mock.

Type
Expectation