mirror of
https://github.com/eggjs/egg.git
synced 2024-12-04 07:14:30 +00:00
* feat: [BREAKING_CHANGE] use egg-core * fix: miss app and config to publish * deps: upgrade egg-rest * deps: update using autod * test: use supertest@2 * Release 0.1.0-beta.3 * feat: enable logrotater by default * chore: add circleci * refactor: rename logrotater => logrotator * feat: remove log-reload event * test: let examples pass test * fix: remove more close event * refactor: extract Symbol as a constant * deps: upgrade egg-core * Release 0.1.0-beta.4 * fix: use egg when customEgg is not specified
36 lines
773 B
JavaScript
36 lines
773 B
JavaScript
'use strict';
|
||
|
||
const path = require('path');
|
||
const request = require('supertest');
|
||
const mm = require('egg-mock');
|
||
|
||
describe('example static test', () => {
|
||
let app;
|
||
|
||
before(() => {
|
||
const baseDir = path.dirname(__dirname);
|
||
const customEgg = path.join(baseDir, '../..');
|
||
app = mm.app({
|
||
baseDir,
|
||
customEgg,
|
||
});
|
||
return app.ready();
|
||
});
|
||
|
||
after(() => app.close());
|
||
|
||
it('should GET / 200', () => {
|
||
return request(app.callback())
|
||
.get('/')
|
||
.expect(200)
|
||
.expect(/<li>Download <a href="\/public\/hi\.txt">hi\.txt<\/a>\.<\/li>/);
|
||
});
|
||
|
||
it('should GET /public/hi.txt', () => {
|
||
return request(app.callback())
|
||
.get('/public/hi.txt')
|
||
.expect(200)
|
||
.expect('hi egg.\n你好,蛋蛋。\n');
|
||
});
|
||
});
|