Namespace: calls

Spy#calls

Since:
  • 2.0.0

Methods

all() → {Array.<Spy.callData>}

Get the raw calls array for this spy.

Since:
  • 2.0.0
Returns:
Type
Array.<Spy.callData>

allArgs() → {Array}

Get all of the arguments for each invocation of this spy in the order they were received.

Since:
  • 2.0.0
Returns:
Type
Array

any() → {Boolean}

Check whether this spy has been invoked.

Since:
  • 2.0.0
Returns:
Type
Boolean

argsFor(index) → {Array}

Get the arguments that were passed to a specific invocation of this spy.

Parameters:
Name Type Description
index Integer

The 0-based invocation index.

Since:
  • 2.0.0
Returns:
Type
Array

count() → {Integer}

Get the number of invocations of this spy.

Since:
  • 2.0.0
Returns:
Type
Integer

first() → {ObjecSpy.callData}

Get the first invocation of this spy.

Since:
  • 2.0.0
Returns:
Type
ObjecSpy.callData

mostRecent() → {ObjecSpy.callData}

Get the most recent invocation of this spy.

Since:
  • 2.0.0
Returns:
Type
ObjecSpy.callData

reset()

Reset this spy as if it has never been called.

Since:
  • 2.0.0

saveArgumentsByValue()

Set this spy to do a shallow clone of arguments passed to each invocation.

Since:
  • 2.5.0

thisFor(index) → (nullable) {Object}

Get the "this" object that was passed to a specific invocation of this spy.

Parameters:
Name Type Description
index Integer

The 0-based invocation index.

Since:
  • 3.8.0
Returns:
Type
Object