Skip to content

Commit

Permalink
Document that it is allowed to assert on dedicated spy calls.
Browse files Browse the repository at this point in the history
  • Loading branch information
Flarna authored and mroderick committed Feb 24, 2018
1 parent 78b2192 commit cbc5667
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions docs/release-source/release/assertions.md
Expand Up @@ -82,6 +82,8 @@ Passes if provided spies were called in the specified order.

Passes if `spy` was ever called with `obj` as its `this` value.

It's possible to assert on a dedicated spy call: `sinon.assert.calledOn(spy.firstCall, arg1, arg2, ...);`.


#### `sinon.assert.alwaysCalledOn(spy, obj)`

Expand All @@ -92,6 +94,8 @@ Passes if `spy` was always called with `obj` as its `this` value.

Passes if `spy` was called with the provided arguments.

It's possible to assert on a dedicated spy call: `sinon.assert.calledWith(spy.firstCall, arg1, arg2, ...);`.


#### `sinon.assert.alwaysCalledWith(spy, arg1, arg2, ...);`

Expand All @@ -107,6 +111,8 @@ Passes if `spy` was never called with the provided arguments.

Passes if `spy` was called with the provided arguments and no others.

It's possible to assert on a dedicated spy call: `sinon.assert.calledWithExactly(spy.getCall(1), arg1, arg2, ...);`.


#### `sinon.assert.alwaysCalledWithExactly(spy, arg1, arg2, ...);`

Expand All @@ -119,6 +125,8 @@ Passes if `spy` was called with matching arguments.

This behaves the same way as `sinon.assert.calledWith(spy, sinon.match(arg1), sinon.match(arg2), ...)`.

It's possible to assert on a dedicated spy call: `sinon.assert.calledWithMatch(spy.secondCall, arg1, arg2, ...);`.


#### `sinon.assert.alwaysCalledWithMatch(spy, arg1, arg2, ...)`

Expand Down Expand Up @@ -147,6 +155,8 @@ The exception can be a `String` denoting its type, or an actual object.

If only one argument is provided, the assertion passes if `spy` ever threw any exception.

It's possible to assert on a dedicated spy call: `sinon.assert.threw(spy.thirdCall, exception);`.


#### `sinon.assert.alwaysThrew(spy, exception);`

Expand Down

0 comments on commit cbc5667

Please sign in to comment.