@@ -133,30 +133,34 @@ describe('#integration ChannelConnection', () => {
133
133
} )
134
134
} )
135
135
136
- xit ( 'should convert failure messages to errors' , done => {
136
+ it ( 'should convert failure messages to errors' , done => {
137
137
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
-
147
138
const errorCode = 'Neo.ClientError.Schema.ConstraintValidationFailed'
148
139
const errorMessage =
149
140
'Node 0 already exists with label User and property "email"=[john@doe.com]'
150
141
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 ) )
157
162
158
163
channel . onmessage ( packedHandshakeMessage ( ) )
159
- channel . onmessage ( packedFailureMessage ( errorCode , errorMessage ) )
160
164
} )
161
165
162
166
it ( 'should notify when connection initialization completes' , async done => {
@@ -361,7 +365,7 @@ describe('#integration ChannelConnection', () => {
361
365
. catch ( done . fail . bind ( done ) )
362
366
} )
363
367
364
- xit ( 'should handle and transform fatal errors' , done => {
368
+ it ( 'should handle and transform fatal errors' , done => {
365
369
const errors = [ ]
366
370
const addresses = [ ]
367
371
const transformedError = newError ( 'Message' , 'Code' )
@@ -374,24 +378,25 @@ describe('#integration ChannelConnection', () => {
374
378
}
375
379
)
376
380
377
- connection = ChannelConnection . create (
381
+ createChannelConnection (
378
382
ServerAddress . fromUrl ( `bolt://${ sharedNeo4j . hostname } ` ) ,
379
383
{ } ,
380
384
errorHandler ,
381
385
Logger . noOp ( )
382
386
)
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 ) )
395
400
} )
396
401
397
402
it ( 'should send INIT/HELLO and GOODBYE messages' , async ( ) => {
0 commit comments