koa-lite/test/experimental/async.js
2015-10-13 09:23:57 +02:00

25 lines
537 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);
});
});