@@ -20,7 +20,7 @@ describe('api.dino.spec', () => {
2020 app . registerController ( Boolean ) ;
2121 expect ( obj . controllers [ 0 ] ) . toBe ( Function ) ;
2222 expect ( obj . controllers [ 1 ] ) . toBe ( Boolean ) ;
23- // Following expects are common for most of the tests,
23+ // Following expects are common for most of the tests,
2424 // should not be deleted easily
2525 expect ( express ) . toEqual ( { expressInstance : true } ) ;
2626 expect ( obj . baseUri ) . toBe ( '/test' ) ;
@@ -137,4 +137,22 @@ describe('api.dino.spec', () => {
137137 app . bind ( ) ;
138138 expect ( invoked ) . toBeTruthy ( ) ;
139139 } ) ;
140+ it ( 'bind.throws_error_when_null_baseUri_provided' , ( ) => {
141+ let obj : IAppContainer = { } as IAppContainer ;
142+ obj . useRouter = ( ) => null ;
143+ obj . build = ( ) => null ;
144+ spyOn ( AppContainer , 'create' ) . and . callFake ( ( ) => obj ) ;
145+ let app = new Dino ( { expressInstance : true } as any , null ) ;
146+ expect ( ( ) => app . bind ( ) )
147+ . toThrow ( new Error ( Errors . baseUriInvalid ) ) ;
148+ } ) ;
149+ it ( 'bind.throws_error_when_undefined_baseUri_provided' , ( ) => {
150+ let obj : IAppContainer = { } as IAppContainer ;
151+ obj . useRouter = ( ) => null ;
152+ obj . build = ( ) => null ;
153+ spyOn ( AppContainer , 'create' ) . and . callFake ( ( ) => obj ) ;
154+ let app = new Dino ( { expressInstance : true } as any , undefined ) ;
155+ expect ( ( ) => app . bind ( ) )
156+ . toThrow ( new Error ( Errors . baseUriInvalid ) ) ;
157+ } ) ;
140158} ) ;
0 commit comments