forwardemail / forwardemail/supertest
Which methods trigger the execution of the request?
- Dominant language
- JavaScript
- Stars
- 14.4k
- Forks
- 782
- PR merge metrics
- No merged PRs in 30d
Description
Hey everyone. I'm trying to understand which methods trigger the execution of the request based on the examples:
Calling `.end()` makes sense:
```js
describe('POST /users', function() {
it('responds with json', function(done) {
request(app)
.post('/users')
.send({name: 'john'})
.set('Accept', 'application/json')
.expect('Content-Type', /json/)
.expect(200)
.end(function(err, res) {
if (err) return done(err);
done();
});
});
});
```
In the example below, is execution triggered by passing a function to the last `expect`?
```js
describe('GET /user', function() {
it('responds with json', function(done) {
request(app)
.get('/user')
.set('Accept', 'application/json')
.expect('Content-Type', /json/)
.expect(200, done);
});
});
```
Which method triggers the execution when using promises?
```js
describe('GET /users', function() {
it('responds with json', function() {
return request(app)
.get('/users')
.set('Accept', 'application/json')
.expect('Content-Type', /json/)
.expect(200)
.then(response => {
assert(response.body.email, 'foo@bar.com')
})
});
});
```
Contributor guide
Assessment
This issue has not been assessed yet.