diff --git a/test/application/index.js b/test/application/index.js index 9fa23b291..51d76ba40 100644 --- a/test/application/index.js +++ b/test/application/index.js @@ -19,7 +19,7 @@ describe('app', () => { done(); }); - request(app.listen()) + request(app.callback()) .get('/') .end(() => {}); }); @@ -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(() => {}); }); diff --git a/test/application/respond.js b/test/application/respond.js index 66021148d..65b375182 100644 --- a/test/application/respond.js +++ b/test/application/respond.js @@ -639,7 +639,7 @@ describe('app.respond', () => { done(); }); - request(app.listen()) + request(app.callback()) .get('/') .end(() => {}); }); @@ -655,7 +655,7 @@ describe('app.respond', () => { throw err; }); - return request(app.listen()) + return request(app.callback()) .get('/') .expect(403, 'sorry!'); }); @@ -671,7 +671,7 @@ describe('app.respond', () => { throw err; }); - return request(app.listen()) + return request(app.callback()) .get('/') .expect(403, 'Forbidden'); }); diff --git a/test/application/use.js b/test/application/use.js index 0f32c7a61..4d544b7b8 100644 --- a/test/application/use.js +++ b/test/application/use.js @@ -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); }); @@ -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'); diff --git a/test/context/cookies.js b/test/context/cookies.js index 31bf0f1e8..c6daf53ff 100644 --- a/test/context/cookies.js +++ b/test/context/cookies.js @@ -37,7 +37,7 @@ describe('ctx.cookies.set()', () => { } }); - return request(app.listen()) + return request(app.callback()) .get('/') .expect('.keys required for signed cookies'); }); diff --git a/test/context/onerror.js b/test/context/onerror.js index e43331b3d..87f75565f 100644 --- a/test/context/onerror.js +++ b/test/context/onerror.js @@ -102,7 +102,7 @@ describe('ctx.onerror(err)', () => { ctx.body = 'response'; }); - request(app.listen()) + request(app.callback()) .get('/') .expect('X-Foo', 'Bar') .expect(200, () => {}); diff --git a/test/response/attachment.js b/test/response/attachment.js index 41f4eee11..5e0f732a9 100644 --- a/test/response/attachment.js +++ b/test/response/attachment.js @@ -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'}) diff --git a/test/response/header.js b/test/response/header.js index dabbd8784..b78c40520 100644 --- a/test/response/header.js +++ b/test/response/header.js @@ -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' }); diff --git a/test/response/status.js b/test/response/status.js index d2e7884c7..6b7eb0791 100644 --- a/test/response/status.js +++ b/test/response/status.js @@ -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); @@ -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);