24 lines
512 B
JavaScript
24 lines
512 B
JavaScript
|
|
||
|
/**
|
||
|
* Separate file primarily because we use `require('6to5/register')`.
|
||
|
*/
|
||
|
|
||
|
var request = require('supertest');
|
||
|
var koa = require('../..');
|
||
|
|
||
|
describe('.experimental=true', function () {
|
||
|
it('should support async functions', function (done) {
|
||
|
var app = koa();
|
||
|
app.experimental = true;
|
||
|
app.use(async function (next) {
|
||
|
var string = await Promise.resolve('asdf');
|
||
|
this.body = string;
|
||
|
});
|
||
|
|
||
|
request(app.callback())
|
||
|
.get('/')
|
||
|
.expect('asdf')
|
||
|
.expect(200, done);
|
||
|
})
|
||
|
})
|