-
Notifications
You must be signed in to change notification settings - Fork 14
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
Added expectBodyLength function for all content types #116
base: master
Are you sure you want to change the base?
Conversation
Thanks for the contribution @gwcgm1! |
I've been looking at some similar missing coverage in Coveralls, and I'm starting to believe that the npm request package used under the hood guarantees body to never be null once you're running expects on the response. The only way I can see to exercise that null check / error throwing line would be to set a mock in the params, and have that mock function return a null body - a faff too far for the scope of this. |
I've removed the need for this check in the |
I've removed that check (included in PR #124, merging soon), and had a punt at some unit tests. |
frisby.create('Ensure this is *actually* a real teapot, not some imposter coffee pot') | ||
.get('http://httpbin.org/status/418') | ||
.expectStatus(418) | ||
.expectBodyLength(418,'>') |
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.
If the operator is required, would it be a little clearer to put it before the number? Then this reads like an expression: "expect body length greater than 418".
Had a go at adding this function - found a use for it ourselves but might not be so useful to others.