File tree Expand file tree Collapse file tree 1 file changed +20
-0
lines changed
Expand file tree Collapse file tree 1 file changed +20
-0
lines changed Original file line number Diff line number Diff line change @@ -139,6 +139,26 @@ describe("ORM.connect()", function () {
139139 } ) ;
140140 } ) ;
141141
142+ it ( "should emit valid error if exception being thrown during connection try" , function ( done ) {
143+ var testConfig = {
144+ protocol : 'mongodb' ,
145+ href : 'unknownhost' ,
146+ database : 'unknowndb' ,
147+ user : '' ,
148+ password : ''
149+ } ,
150+ db = ORM . connect ( testConfig ) ;
151+
152+ db . on ( "connect" , function ( err ) {
153+ should . exist ( err ) ;
154+ should . equal ( err . message . indexOf ( "Connection protocol not supported" ) , - 1 ) ;
155+ err . message . should . not . equal ( "CONNECTION_URL_NO_PROTOCOL" ) ;
156+ err . message . should . not . equal ( "CONNECTION_URL_EMPTY" ) ;
157+
158+ return done ( ) ;
159+ } ) ;
160+ } ) ;
161+
142162 it ( "should not modify connection opts" , function ( done ) {
143163 var opts = {
144164 protocol : 'mysql' ,
You can’t perform that action at this time.
0 commit comments