egg/test/async/_async.js
Haoliang Gao 74c8a547cc feat: dump run/${type}_config_meta.json (#1155)
Show who define the property of the config

Closes https://github.com/eggjs/egg/issues/1132
2017-07-05 09:16:10 +08:00

28 lines
669 B
JavaScript

'use strict';
const assert = require('assert');
const mm = require('egg-mock');
const utils = require('../utils');
describe('test/async.test.js', () => {
afterEach(mm.restore);
let app;
before(async () => {
app = utils.app('apps/async-app');
await app.ready();
assert(app.beforeStartExectuted);
assert(app.scheduleExecuted);
});
after(async () => {
await app.close();
assert(app.beforeCloseExecuted);
});
it('middleware, controller and service support async functions', async () => {
await app.httpRequest()
.get('/api')
.expect(200)
.expect([ 'service', 'controller', 'router', 'middleware' ]);
});
});