-
Notifications
You must be signed in to change notification settings - Fork 118
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
explain expect.fail #11
Comments
That's basically the idea of it('Should reject requests with no credentials', function () {
return chai
.request(app)
.post('/api/auth/login')
.then(() =>
expect.fail(null, null, 'Request should not succeed')
)
.catch(err => {
if (err instanceof chai.AssertionError) {
throw err;
}
const res = err.response;
expect(res).to.have.status(400);
});
}); We expect a 400 response from the server, so we should never hit the |
This behavior is not happening with newer versions of chai-http (I am using 4.2.0, not 3.0.0). All 4xx and 5xx responses are hitting the |
Aha, yeah - that was a breaking change with chai-http v4. Happy to take a PR to update, otherwise I'll leave this issue open and work on it when I get a moment. |
I'm having an issue understanding the test. When running the test expect.fail always fails the test. Can you give some insight into how expect.fail works?
The text was updated successfully, but these errors were encountered: