-
-
Notifications
You must be signed in to change notification settings - Fork 772
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
document update for (calls|resolves|returns|throws)Arg #1854
- Loading branch information
Showing
1 changed file
with
26 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -252,6 +252,10 @@ Causes the stub to return the argument at the provided index. | |
|
||
`stub.returnsArg(0);` causes the stub to return the first argument. | ||
|
||
If the argument at the provided index is not available, prior to `[email protected]`, | ||
an `undefined` value will be returned; starting from `[email protected]`, a `TypeError` | ||
will be thrown. | ||
|
||
|
||
#### `stub.returnsThis();` | ||
Causes the stub to return its <code>this</code> value. | ||
|
@@ -276,7 +280,10 @@ provided index. | |
`stub.resolvesArg(0);` causes the stub to return a Promise which resolves to the | ||
first argument. | ||
|
||
*Since `[email protected]`* | ||
If the argument at the provided index is not available, a `TypeError` will be | ||
thrown. | ||
|
||
*Since `[email protected]`* | ||
|
||
#### `stub.throws();` | ||
|
||
|
@@ -298,6 +305,18 @@ Causes the stub to throw the provided exception object. | |
Causes the stub to throw the exception returned by the function. | ||
|
||
|
||
### `stub.throwsArg(index);` | ||
|
||
Causes the stub to throw the argument at the provided index. | ||
|
||
`stub.throwsArg(0);` causes the stub to throw the first argument as the | ||
exception. | ||
|
||
If the argument at the provided index is not available, a `TypeError` will be | ||
thrown. | ||
|
||
*Since `[email protected]`* | ||
|
||
#### `stub.rejects();` | ||
|
||
Causes the stub to return a Promise which rejects with an exception (`Error`). | ||
|
@@ -325,7 +344,12 @@ Causes the stub to return a Promise which rejects with the provided exception ob | |
|
||
#### `stub.callsArg(index);` | ||
|
||
Causes the stub to call the argument at the provided index as a callback function. `stub.callsArg(0);` causes the stub to call the first argument as a callback. | ||
Causes the stub to call the argument at the provided index as a callback function. | ||
|
||
`stub.callsArg(0);` causes the stub to call the first argument as a callback. | ||
|
||
If the argument at the provided index is not available or is not a function, | ||
a `TypeError` will be thrown. | ||
|
||
|
||
#### `stub.callThrough();` | ||
|