API Docs for: 3.5.1
Show:

Test.Mock Class

Defined in: test/js/Mock.js:1
Module: test

Creates a new mock object.

Item Index

Methods

Methods

expect

(
  • mock
  • expectation
)
Void static

Defined in test/js/Mock.js:45

Assigns an expectation to a mock object. This is used to create methods and properties on the mock object that are monitored for calls and changes, respectively.

Parameters:

  • mock Object

    The object to add the expectation to.

  • expectation Object

    An object defining the expectation. For a method, the keys "method" and "args" are required with an optional "returns" key available. For properties, the keys "property" and "value" are required.

Returns:

Void:

verify

(
  • mock
)
Void static

Defined in test/js/Mock.js:127

Verifies that all expectations of a mock object have been met and throws an assertion error if not.

Parameters:

  • mock Object

    The object to verify..

Returns:

Void: