test/js/Mock.js:1
Creates a new mock object.
expect
mock
expectation
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.
mock
Object
The object to add the expectation to.
expectation
Object
An object defining the expectation. For properties, the keys "property" and "value" are required. For a method the "method" key defines the method's name, the optional "args" key provides an array of argument types. The "returns" key provides an optional return value. An optional "run" key provides a function to be used as the method body. The return value of a mocked method is determined first by the "returns" key, then the "run" function's return value. If neither "returns" nor "run" is provided undefined is returned. An optional 'error' key defines an error type to be thrown in all cases. The "callCount" key provides an optional number of times the method is expected to be called (the default is 1).
verify
mock
Defined in
test/js/Mock.js:136
Verifies that all expectations of a mock object have been met and throws an assertion error if not.
mock
Object
The object to verify..