-
-
Notifications
You must be signed in to change notification settings - Fork 733
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: Improve tests for header matching with function; adopt new prom…
…ise-rejection assertion (#1481) 1. Assert the expected argument is passed. (It's the correct argument, though not the expected type!) 2. When the function returns true, assert the request matches. 3. When the function returns false, assert the request doesn't match. 4. When the function returns false, assert the mock is not consumed. 5. I added copies of these tests for `matchHeader` called on the interceptor instead of the scope. Test 4 uncovered an unexpected behavior in tap, which is that `t.rejects` causes our `afterEach` hook to fire – since it's implemented as a subtest. Not knowing how to work around this, I replaced our uses of `t.rejects` with a promise-rejection assertion that does not rely on a subtest. Ref: #1305 (comment) and tapjs/tapjs#525
- Loading branch information
1 parent
9e9e65d
commit 75cceb6
Showing
7 changed files
with
208 additions
and
45 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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
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
Oops, something went wrong.