@@ -133,30 +133,34 @@ describe('#integration ChannelConnection', () => {
133133 } )
134134 } )
135135
136- xit ( 'should convert failure messages to errors' , done => {
136+ it ( 'should convert failure messages to errors' , done => {
137137 const channel = new DummyChannel ( )
138- connection = new ChannelConnection (
139- channel ,
140- new ConnectionErrorHandler ( SERVICE_UNAVAILABLE ) ,
141- ServerAddress . fromUrl ( 'localhost:7687' ) ,
142- Logger . noOp ( )
143- )
144-
145- connection . _negotiateProtocol ( )
146-
147138 const errorCode = 'Neo.ClientError.Schema.ConstraintValidationFailed'
148139 const errorMessage =
149140 'Node 0 already exists with label User and property "email"=[[email protected] ]' 150141
151- connection . _queueObserver ( {
152- onError : error => {
153- expectNeo4jError ( error , errorCode , errorMessage )
154- done ( )
155- }
156- } )
142+ createChannelConnection (
143+ ServerAddress . fromUrl ( 'localhost:7687' ) ,
144+ { } ,
145+ new ConnectionErrorHandler ( SERVICE_UNAVAILABLE ) ,
146+ Logger . noOp ( ) ,
147+ null ,
148+ ( ) => channel
149+ )
150+ . then ( connection => {
151+ connection . _queueObserver ( {
152+ onCompleted : done . fail . bind ( done ) ,
153+ onComplete : done . fail . bind ( done ) ,
154+ onError : error => {
155+ expectNeo4jError ( error , errorCode , errorMessage )
156+ done ( )
157+ }
158+ } )
159+ channel . onmessage ( packedFailureMessage ( errorCode , errorMessage ) )
160+ } )
161+ . catch ( done . fail . bind ( done ) )
157162
158163 channel . onmessage ( packedHandshakeMessage ( ) )
159- channel . onmessage ( packedFailureMessage ( errorCode , errorMessage ) )
160164 } )
161165
162166 it ( 'should notify when connection initialization completes' , async done => {
@@ -361,7 +365,7 @@ describe('#integration ChannelConnection', () => {
361365 . catch ( done . fail . bind ( done ) )
362366 } )
363367
364- xit ( 'should handle and transform fatal errors' , done => {
368+ it ( 'should handle and transform fatal errors' , done => {
365369 const errors = [ ]
366370 const addresses = [ ]
367371 const transformedError = newError ( 'Message' , 'Code' )
@@ -374,24 +378,25 @@ describe('#integration ChannelConnection', () => {
374378 }
375379 )
376380
377- connection = ChannelConnection . create (
381+ createChannelConnection (
378382 ServerAddress . fromUrl ( `bolt://${ sharedNeo4j . hostname } ` ) ,
379383 { } ,
380384 errorHandler ,
381385 Logger . noOp ( )
382386 )
383-
384- connection . _queueObserver ( {
385- onError : error => {
386- expect ( error ) . toEqual ( transformedError )
387- expect ( errors . length ) . toEqual ( 1 )
388- expect ( errors [ 0 ] . code ) . toEqual ( SERVICE_UNAVAILABLE )
389- expect ( addresses ) . toEqual ( [ connection . address ] )
390- done ( )
391- }
392- } )
393-
394- connection . _handleFatalError ( newError ( 'Hello' , SERVICE_UNAVAILABLE ) )
387+ . then ( connection => {
388+ connection . _queueObserver ( {
389+ onError : error => {
390+ expect ( error ) . toEqual ( transformedError )
391+ expect ( errors . length ) . toEqual ( 1 )
392+ expect ( errors [ 0 ] . code ) . toEqual ( SERVICE_UNAVAILABLE )
393+ expect ( addresses ) . toEqual ( [ connection . address ] )
394+ done ( )
395+ }
396+ } )
397+ connection . _handleFatalError ( newError ( 'Hello' , SERVICE_UNAVAILABLE ) )
398+ } )
399+ . catch ( done . fail . bind ( done ) )
395400 } )
396401
397402 it ( 'should send INIT/HELLO and GOODBYE messages' , async ( ) => {
0 commit comments