Constructor
new Mock(nameopt)
Creates a new mocked function.
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
name |
string |
<optional> |
<anonymous> | Name of the function. |
Members
function
handler :function
The function that gets executed when the mocked function is called
Type:
- function
ignoreOtherCalls
Gets state of global ignore other calls flag
ignoreOtherCalls
Sets state of the global ignore other calls flag
name :string
Name of the mocked function.
Type:
- string
tree
Sets global tree pointer value
tree
Gets global tree pointer value.
Methods
mayBeCalled() → {Expectation}
Creats a new optional Expecatation from this mock.
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 |
Returns:
Expectation created from this mock.
- Type
- Expectation
mayBeCalledWithAnyArguments() → {Expectation}
Creats a new optional Expecatation from this mock that will accept any arguments.
Returns:
Expectation created from this mock.
- Type
- Expectation
shouldBeCalled() → {Expectation}
Creats a new required Expecatation from this mock.
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 |
Returns:
Expectation created from this mock.
- Type
- Expectation
shouldBeCalledWithAnyArguments() → {Expectation}
Creats a new required Expecatation from this mock that will accept any arguments.
Returns:
Expectation created from this mock.
- Type
- Expectation