-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Document 'when called with'. See #217.
- Loading branch information
1 parent
52bbf0e
commit e1f4b5f
Showing
2 changed files
with
44 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,20 @@ | ||
Apply the subject function to an array of parameters, then delegate the return value to another assertion. | ||
|
||
```js | ||
function add(a, b) { | ||
return a + b; | ||
} | ||
|
||
expect(add, 'when called with', [1, 2], 'to equal', 3); | ||
``` | ||
|
||
In case of a failing expectation you get the following output: | ||
|
||
```js | ||
expect(add, 'when called with', [1, 2], 'to equal', 9); | ||
``` | ||
|
||
```output | ||
expected function add(a, b) { return a + b; } when called with [ 1, 2 ] to equal 9 | ||
expected 3 to equal 9 | ||
``` |
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