-
-
Notifications
You must be signed in to change notification settings - Fork 733
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
test: Improve tests for header matching with function; adopt new promise-rejection assertion #1481
Conversation
…nction 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. (This test is failing, which is a bug.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great!
merge at your convenience, I’m not 100% sure if you want to add to it |
Yea, thanks, let's merge it. |
🎉 This PR is included in version 11.0.0-beta.7 🎉 The release is available on: Your semantic-release bot 📦🚀 |
🎉 This PR is included in version 11.0.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
…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
…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
…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
matchHeader
called on the interceptor instead of the scope.Test 4 uncovered an unexpected behavior in tap, which is that
t.rejects
causes ourafterEach
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
This was prompted by #1480, however this isn't related to that bug (which so far I can't reproduce).