egg/examples/static/test/index.test.js
Haoliang Gao 350d0f5aaf feat: [BREAKING_CHANGE] use egg-core (#44)
* 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
2016-08-18 15:42:20 +08:00

36 lines
773 B
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

'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');
});
});