From cbc5667d1b1cc2d2afc49d23334288cd63f304bb Mon Sep 17 00:00:00 2001 From: Flarna Date: Tue, 13 Feb 2018 04:06:00 +0100 Subject: [PATCH] Document that it is allowed to assert on dedicated spy calls. --- docs/release-source/release/assertions.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/docs/release-source/release/assertions.md b/docs/release-source/release/assertions.md index 67d4796c9..a16b2d5b0 100644 --- a/docs/release-source/release/assertions.md +++ b/docs/release-source/release/assertions.md @@ -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)` @@ -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, ...);` @@ -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, ...);` @@ -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, ...)` @@ -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);`