import { app } from 'egg-mock/bootstrap' ; import { InstallationType } from '../../app/plugin/installation-manager/types' ; describe ( 'Installation Controller' , ( ) => { describe ( 'GET /installation/:installationName' , ( ) => { it ( 'should status 200 and get the body' , ( ) => { app . installation . getInstallationInfoByName = ( iName ) : { id : number ; type : InstallationType ; } => { return { id : 0 , type : iName as any } ; } ; app . github . getConfigType = ( ) : any => { return { foo : 'bar' } ; } ; return app . httpRequest ( ) . get ( '/installation/github' ) . expect ( 200 ) . expect ( { foo : 'bar' } ) ; } ) ; it ( 'should status 200 and get the body' , ( ) => { app . installation . getInstallationInfoByName = ( iName ) : { id : number ; type : InstallationType ; } => { return { id : 0 , type : iName as any } ; } ; app . gitlab . getConfigType = ( ) : any => { return { foo : 'bar' } ; } ; return app . httpRequest ( ) . get ( '/installation/gitlab' ) . expect ( 200 ) . expect ( { foo : 'bar' } ) ; } ) ; it ( 'should status 200 and get {}' , ( ) => { app . installation . getInstallationInfoByName = ( iName ) : { id : number ; type : InstallationType ; } => { return { id : 0 , type : iName as any } ; } ; return app . httpRequest ( ) . get ( '/installation/not_exist' ) . expect ( 200 ) . expect ( { } ) ; } ) ; } ) ; } ) ;