Skip to content

Commit

Permalink
Add example where withArgs of a stub is used in an assertion
Browse files Browse the repository at this point in the history
  • Loading branch information
cleancodethomas authored and mantoni committed Jun 4, 2020
1 parent c1e07a3 commit e684c1e
Showing 1 changed file with 1 addition and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ describe("stubbed callback", function() {

assert.isUndefined(callback()); // No return value, no exception
assert.equals(callback(42), 1); // Returns 1
assert.equals(callback.withArgs(42).callCount, 1);// Use withArgs in assertion
assert.exception(() => {
callback(1);
}); // Throws Error("name")
Expand Down

0 comments on commit e684c1e

Please sign in to comment.