koa-lite/test/experimental/async.js

26 lines
536 B
JavaScript
Raw Normal View History

'use strict';
/**
2015-02-16 00:47:18 +00:00
* 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 = 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);
})
})