koa-lite/test/experimental/async.js
2015-10-13 01:19:42 -05:00

25 lines
540 B
JavaScript

'use strict';
/**
* Separate file primarily because we use `require('babel/register')`.
*/
const request = require('supertest');
const Koa = require('../..');
describe('.experimental=true', function () {
it('should support async functions', function (done) {
const app = new Koa();
app.experimental = true;
app.use(async function (next) {
const string = await Promise.resolve('asdf');
this.body = string;
});
request(app.callback())
.get('/')
.expect('asdf')
.expect(200, done);
})
})