Skip to content

Commit 4ec8176

Browse files
committed
hack
1 parent 12588b3 commit 4ec8176

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

README.md

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -497,21 +497,22 @@ module.exports = function shouldSaveThings () {
497497
The above will verify that `save` was called with the two specified arguments.
498498
If the verification fails (say it passed `'010100'` instead), testdouble.js will
499499
throw a nice long error message to explain how the test double function was
500-
actually called, so that you can spot the error.
500+
actually called, hopefully helping you spot the error.
501501

502502
Just like with `td.when()`, more complex cases can be covered with [argument
503503
matchers](/docs/6-verifying-invocations.md#relaxing-verifications-with-argument-matchers)
504504
and [configuration
505505
options](/docs/6-verifying-invocations.md#configuring-verifications).
506506

507507
A word of caution: `td.verify()` should be needed only sparingly. When you
508-
verify a function was called (as opposed to what it returns) you're asserting
509-
that your code has a desired side effect. Code with lots of side effects is bad,
510-
so mocking libraries are often abused to make side-effect heavy code easier to
511-
test. In these cases, refactoring each dependency to return values instead is
512-
almost always the better design approach. Sometimes in the interest of
513-
completeness, people will attempt to verify an invocation that already satisfies
514-
a stub, but this is almost [provably
508+
verify a function was called (as opposed to relying on what it returns) you're
509+
asserting that your subject has a side effect. Code with lots of side effects is
510+
bad, so mocking libraries are often abused to make side-effect heavy code easier
511+
to proliferate. In these cases, refactoring each dependency to return values
512+
instead is almost always the better design approach. A separate test smell with
513+
verifying calls is that sometimes—perhaps in the interest of maximal
514+
completeness—a test will verify an invocation that already satisfied a stubbing,
515+
but this is almost [provably
515516
unnecessary](/docs/B-frequently-asked-questions.md#why-shouldnt-i-call-both-tdwhen-and-tdverify-for-a-single-interaction-with-a-test-double).
516517

517518
### Other functions

0 commit comments

Comments
 (0)