diff --git a/framework/app/package.json b/framework/app/package.json index 567ed60..f9f9d68 100644 --- a/framework/app/package.json +++ b/framework/app/package.json @@ -2,10 +2,13 @@ "name": "framework-example", "version": "1.0.0", "devDependencies": { - "egg-bin": "^1.0.0" + "egg-bin": "^2.0.0", + "egg-mock": "^2.0.0", + "supertest": "^2.0.1" }, "scripts": { - "dev": "egg-bin dev" + "dev": "egg-bin dev", + "test": "egg-bin test" }, "egg": { "framework": "yadan" diff --git a/framework/app/test/app/controller/home.test.js b/framework/app/test/app/controller/home.test.js new file mode 100644 index 0000000..28d830a --- /dev/null +++ b/framework/app/test/app/controller/home.test.js @@ -0,0 +1,20 @@ +'use strict'; + +const mock = require('egg-mock'); +const request = require('supertest'); + +describe('test/app/controller/home.test.js', () => { + + let app; + before(() => { + app = mock.app(); + return app.ready(); + }); + + it('should GET /', () => { + return request(app.callback()) + .get('/') + .expect(200) + .expect('hi, framework-example_123456'); + }); +}); diff --git a/framework/yadan/package.json b/framework/yadan/package.json index ddfdc99..7b99672 100644 --- a/framework/yadan/package.json +++ b/framework/yadan/package.json @@ -6,7 +6,7 @@ "egg-view-nunjucks": "1.0.0" }, "devDependencies": { - "egg-bin": "^1.10.0", + "egg-bin": "^2.0.0", "egg-mock": "^2.0.0", "supertest": "^2.0.1" },