Skip to content

Commit

Permalink
document update for (calls|resolves|returns|throws)Arg #1854
Browse files Browse the repository at this point in the history
  • Loading branch information
Tim Li authored and mroderick committed Jul 18, 2018
1 parent 0be170c commit cb6c231
Showing 1 changed file with 26 additions and 2 deletions.
28 changes: 26 additions & 2 deletions docs/release-source/release/stubs.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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();`

Expand All @@ -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`).
Expand Down Expand Up @@ -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();`
Expand Down

0 comments on commit cb6c231

Please sign in to comment.