Class: AndNode

Tree.AndNode

Represent a result of 'and'ing two Expectations. Execution order of the ExpectedCalls in a AndNode is unrestricted.

IE: AND(1, 2, 3) can execute in any of the following orders:

  • 1, 2, 3
  • 1, 3, 2
  • 2, 1, 3
  • 2, 3, 1
  • 3, 1, 2
  • 3, 2, 1

Constructor

new AndNode(expectedCall)

Creates a new Tree.AndNode

Parameters:
Name Type Description
expectedCall ExpectedCall

Initial expected call for this node.

Source:

Members

expectedCalls :Array.<ExpectedCall>

ExpectedCalls for this node.

Type:
Source:

name

Gets the human readable name for this node.

Source:

Methods

match(mock, args) → {ExpectedCall|undefined}

Determines the the Mock and args match any ExpectedCalls in this node.

Parameters:
Name Type Description
mock Mock

Mock that was called.

args Array.<object>

Arguments for the call.

Source:
Returns:

The matching ExpectedCall if found; otherwise undefined.

Type
ExpectedCall | undefined

merge(node)

Merges this node and another Tree.AndNode or Tree.ExpectedCallNode

Parameters:
Name Type Description
node Tree.AndNode | Tree.ExpectedCallNode

Node to merge with this node.

Source:

onlyOptionalRemain() → {boolean}

Checks to see if only optional ExpectedCalls remain in this node.

Source:
Returns:

True if all incomplete calls are optional; otherwise false.

Type
boolean

partialMatch(mock) → {boolean}

Determines the the Mock partially matches any ExpectedCalls in this node.

Parameters:
Name Type Description
mock Mock

Mock that was called.

Source:
Returns:

True if the mock partially matches; otherwise false.

Type
boolean