forwardemail / forwardemail/supertest
Inconsistent expect(!200)
- Dominant language
- JavaScript
- Stars
- 14.4k
- Forks
- 782
- PR merge metrics
- No merged PRs in 30d
Description
Migrating to Jest from mocha with chai-http
* Expect non-200 status with promise style callback invokes then block.
* Expect non-200 status with function(res, err) style callback populates err
javascript
```
it('should reject if showMeLaterDays is zero', done => {
request(server.app)
.put('/profile/mine')
.set('Access-Token', tokenJosh)
.set('API-Key', testConfig.apiKey)
.send(profile)
.expect(400)
.then(res => {
//WE END UP HERE
done(new Error("Should have rejected"))
})
.catch(err => {
//WE SHOULD BE HERE
err.response.body.error.message.should.equal(`'showMeLaterDays' should be more than '1' but is '0'`)
done()
})
})
```
Ideally would behave the same as chai-http, but more importantly would expect consistency between callback styles.
Contributor guide
Assessment
This issue has not been assessed yet.