Skip to content

Commit

Permalink
test: replace request(app.listen()) with request(app.callback())
Browse files Browse the repository at this point in the history
  • Loading branch information
likegun authored and dead-horse committed Sep 26, 2017
1 parent 7f577af commit 77ca429
Show file tree
Hide file tree
Showing 8 changed files with 13 additions and 13 deletions.
4 changes: 2 additions & 2 deletions test/application/index.js
Expand Up @@ -19,7 +19,7 @@ describe('app', () => {
done();
});

request(app.listen())
request(app.callback())
.get('/')
.end(() => {});
});
Expand All @@ -41,7 +41,7 @@ describe('app', () => {
// hackish, but the response should occur in a single tick
setImmediate(done);

request(app.listen())
request(app.callback())
.get('/')
.end(() => {});
});
Expand Down
6 changes: 3 additions & 3 deletions test/application/respond.js
Expand Up @@ -639,7 +639,7 @@ describe('app.respond', () => {
done();
});

request(app.listen())
request(app.callback())
.get('/')
.end(() => {});
});
Expand All @@ -655,7 +655,7 @@ describe('app.respond', () => {
throw err;
});

return request(app.listen())
return request(app.callback())
.get('/')
.expect(403, 'sorry!');
});
Expand All @@ -671,7 +671,7 @@ describe('app.respond', () => {
throw err;
});

return request(app.listen())
return request(app.callback())
.get('/')
.expect(403, 'Forbidden');
});
Expand Down
4 changes: 2 additions & 2 deletions test/application/use.js
Expand Up @@ -80,7 +80,7 @@ describe('app.use(fn)', () => {

app.use(ctx => ctx.throw('Not Found', 404));

return request(app.listen())
return request(app.callback())
.get('/')
.expect(404);
});
Expand All @@ -92,7 +92,7 @@ describe('app.use(fn)', () => {
app.use((ctx, next) => next());
app.use(function * (next){ this.body = 'generator'; });

return request(app.listen())
return request(app.callback())
.get('/')
.expect(200)
.expect('generator');
Expand Down
2 changes: 1 addition & 1 deletion test/context/cookies.js
Expand Up @@ -37,7 +37,7 @@ describe('ctx.cookies.set()', () => {
}
});

return request(app.listen())
return request(app.callback())
.get('/')
.expect('.keys required for signed cookies');
});
Expand Down
2 changes: 1 addition & 1 deletion test/context/onerror.js
Expand Up @@ -102,7 +102,7 @@ describe('ctx.onerror(err)', () => {
ctx.body = 'response';
});

request(app.listen())
request(app.callback())
.get('/')
.expect('X-Foo', 'Bar')
.expect(200, () => {});
Expand Down
2 changes: 1 addition & 1 deletion test/response/attachment.js
Expand Up @@ -40,7 +40,7 @@ describe('ctx.attachment([filename])', () => {
ctx.body = {foo: 'bar'};
});

return request(app.listen())
return request(app.callback())
.get('/')
.expect('content-disposition', 'attachment; filename="include-no-ascii-char-???-ok.json"; filename*=UTF-8\'\'include-no-ascii-char-%E4%B8%AD%E6%96%87%E5%90%8D-ok.json')
.expect({foo: 'bar'})
Expand Down
2 changes: 1 addition & 1 deletion test/response/header.js
Expand Up @@ -29,7 +29,7 @@ describe('res.header', () => {
header = Object.assign({}, ctx.response.header);
});

await request(app.listen())
await request(app.callback())
.get('/');

assert.deepEqual(header, { 'x-foo': '42' });
Expand Down
4 changes: 2 additions & 2 deletions test/response/status.js
Expand Up @@ -67,7 +67,7 @@ describe('res.status=', () => {
assert(null == ctx.response.header['transfer-encoding']);
});

const res = await request(app.listen())
const res = await request(app.callback())
.get('/')
.expect(status);

Expand All @@ -88,7 +88,7 @@ describe('res.status=', () => {
ctx.set('Transfer-Encoding', 'chunked');
});

const res = await request(app.listen())
const res = await request(app.callback())
.get('/')
.expect(status);

Expand Down

0 comments on commit 77ca429

Please sign in to comment.