File tree Expand file tree Collapse file tree 3 files changed +26
-3
lines changed Expand file tree Collapse file tree 3 files changed +26
-3
lines changed Original file line number Diff line number Diff line change 22 "name" : " framework-example" ,
33 "version" : " 1.0.0" ,
44 "devDependencies" : {
5- "egg-bin" : " ^1.0.0"
5+ "egg-bin" : " ^2.0.0" ,
6+ "egg-mock" : " ^2.0.0" ,
7+ "supertest" : " ^2.0.1"
68 },
79 "scripts" : {
8- "dev" : " egg-bin dev"
10+ "dev" : " egg-bin dev" ,
11+ "test" : " egg-bin test"
912 },
1013 "egg" : {
1114 "framework" : " yadan"
Original file line number Diff line number Diff line change 1+ 'use strict' ;
2+
3+ const mock = require ( 'egg-mock' ) ;
4+ const request = require ( 'supertest' ) ;
5+
6+ describe ( 'test/app/controller/home.test.js' , ( ) => {
7+
8+ let app ;
9+ before ( ( ) => {
10+ app = mock . app ( ) ;
11+ return app . ready ( ) ;
12+ } ) ;
13+
14+ it ( 'should GET /' , ( ) => {
15+ return request ( app . callback ( ) )
16+ . get ( '/' )
17+ . expect ( 200 )
18+ . expect ( 'hi, framework-example_123456' ) ;
19+ } ) ;
20+ } ) ;
Original file line number Diff line number Diff line change 66 "egg-view-nunjucks" : " 1.0.0"
77 },
88 "devDependencies" : {
9- "egg-bin" : " ^1.10 .0" ,
9+ "egg-bin" : " ^2.0 .0" ,
1010 "egg-mock" : " ^2.0.0" ,
1111 "supertest" : " ^2.0.1"
1212 },
You can’t perform that action at this time.
0 commit comments