@@ -47,6 +47,13 @@ const SUCCESS_MESSAGE = { signature: 0x70, fields: [{}] }
47
47
const FAILURE_MESSAGE = { signature : 0x7f , fields : [ newError ( 'Hello' ) ] }
48
48
const RECORD_MESSAGE = { signature : 0x71 , fields : [ { value : 'Hello' } ] }
49
49
50
+ const BOLT_AGENT = {
51
+ product : 'js-driver' ,
52
+ platform : 'SomePlatform' ,
53
+ language : 'js' ,
54
+ language_details : 'Some node or deno details'
55
+ }
56
+
50
57
describe ( '#integration ChannelConnection' , ( ) => {
51
58
/** @type {Connection } */
52
59
let connection
@@ -104,7 +111,7 @@ describe('#integration ChannelConnection', () => {
104
111
}
105
112
106
113
connection
107
- . connect ( 'mydriver/0.0.0' , 'mydriver/0.0.0 some system info' , basicAuthToken ( ) )
114
+ . connect ( 'mydriver/0.0.0' , BOLT_AGENT , basicAuthToken ( ) )
108
115
. then ( ( ) => {
109
116
connection
110
117
. protocol ( )
@@ -177,7 +184,7 @@ describe('#integration ChannelConnection', () => {
177
184
connection = await createConnection ( `bolt://${ sharedNeo4j . hostname } ` )
178
185
179
186
connection
180
- . connect ( 'mydriver/0.0.0' , 'mydriver/0.0.0 some system info' , basicAuthToken ( ) )
187
+ . connect ( 'mydriver/0.0.0' , BOLT_AGENT , basicAuthToken ( ) )
181
188
. then ( initializedConnection => {
182
189
expect ( initializedConnection ) . toBe ( connection )
183
190
done ( )
@@ -189,7 +196,7 @@ describe('#integration ChannelConnection', () => {
189
196
connection = await createConnection ( `bolt://${ sharedNeo4j . hostname } ` ) // wrong port
190
197
191
198
connection
192
- . connect ( 'mydriver/0.0.0' , 'mydriver/0.0.0 some system info' , basicWrongAuthToken ( ) )
199
+ . connect ( 'mydriver/0.0.0' , BOLT_AGENT , basicWrongAuthToken ( ) )
193
200
. then ( ( ) => done . fail ( 'Should not initialize' ) )
194
201
. catch ( error => {
195
202
expect ( error ) . toBeDefined ( )
@@ -200,7 +207,7 @@ describe('#integration ChannelConnection', () => {
200
207
it ( 'should have server version after connection initialization completed' , async done => {
201
208
connection = await createConnection ( `bolt://${ sharedNeo4j . hostname } ` )
202
209
connection
203
- . connect ( 'mydriver/0.0.0' , 'mydriver/0.0.0 some system info' , basicAuthToken ( ) )
210
+ . connect ( 'mydriver/0.0.0' , BOLT_AGENT , basicAuthToken ( ) )
204
211
. then ( initializedConnection => {
205
212
expect ( initializedConnection ) . toBe ( connection )
206
213
const serverVersion = ServerVersion . fromString ( connection . version )
@@ -214,7 +221,7 @@ describe('#integration ChannelConnection', () => {
214
221
connection = await createConnection ( `bolt://${ sharedNeo4j . hostname } ` )
215
222
216
223
connection
217
- . connect ( 'mydriver/0.0.0' , 'mydriver/0.0.0 some system info' , basicWrongAuthToken ( ) )
224
+ . connect ( 'mydriver/0.0.0' , BOLT_AGENT , basicWrongAuthToken ( ) )
218
225
. then ( ( ) => done . fail ( 'Should not connect' ) )
219
226
. catch ( initialError => {
220
227
expect ( initialError ) . toBeDefined ( )
@@ -274,7 +281,7 @@ describe('#integration ChannelConnection', () => {
274
281
connection = await createConnection ( `bolt://${ sharedNeo4j . hostname } ` )
275
282
276
283
connection
277
- . connect ( 'my-driver/1.2.3' , 'mydriver/0.0.0 some system info' , basicAuthToken ( ) )
284
+ . connect ( 'my-driver/1.2.3' , BOLT_AGENT , basicAuthToken ( ) )
278
285
. then ( ( ) => {
279
286
connection
280
287
. resetAndFlush ( )
@@ -297,7 +304,7 @@ describe('#integration ChannelConnection', () => {
297
304
it ( 'should fail to reset and flush when FAILURE received' , async done => {
298
305
createConnection ( `bolt://${ sharedNeo4j . hostname } ` )
299
306
. then ( connection => {
300
- connection . connect ( 'my-driver/1.2.3' , 'mydriver/0.0.0 some system info' , basicAuthToken ( ) ) . then ( ( ) => {
307
+ connection . connect ( 'my-driver/1.2.3' , BOLT_AGENT , basicAuthToken ( ) ) . then ( ( ) => {
301
308
connection
302
309
. resetAndFlush ( )
303
310
. then ( ( ) => done . fail ( 'Should fail' ) )
@@ -325,7 +332,7 @@ describe('#integration ChannelConnection', () => {
325
332
connection = await createConnection ( `bolt://${ sharedNeo4j . hostname } ` )
326
333
327
334
connection
328
- . connect ( 'my-driver/1.2.3' , 'mydriver/0.0.0 some system info' , basicAuthToken ( ) )
335
+ . connect ( 'my-driver/1.2.3' , BOLT_AGENT , basicAuthToken ( ) )
329
336
. then ( ( ) => {
330
337
connection
331
338
. resetAndFlush ( )
@@ -353,7 +360,7 @@ describe('#integration ChannelConnection', () => {
353
360
createConnection ( `bolt://${ sharedNeo4j . hostname } ` )
354
361
. then ( connection => {
355
362
connection
356
- . connect ( 'my-driver/1.2.3' , 'mydriver/0.0.0 some system info' , basicAuthToken ( ) )
363
+ . connect ( 'my-driver/1.2.3' , BOLT_AGENT , basicAuthToken ( ) )
357
364
. then ( ( ) => {
358
365
connection . protocol ( ) . _responseHandler . _currentFailure = newError (
359
366
'Hello'
@@ -419,7 +426,7 @@ describe('#integration ChannelConnection', () => {
419
426
connection = await createConnection ( `bolt://${ sharedNeo4j . hostname } ` )
420
427
recordWrittenMessages ( connection . _protocol , messages )
421
428
422
- await connection . connect ( 'mydriver/0.0.0' , 'mydriver/0.0.0 some system info' , basicAuthToken ( ) )
429
+ await connection . connect ( 'mydriver/0.0.0' , BOLT_AGENT , basicAuthToken ( ) )
423
430
424
431
expect ( connection . isOpen ( ) ) . toBeTruthy ( )
425
432
await connection . close ( )
@@ -436,7 +443,7 @@ describe('#integration ChannelConnection', () => {
436
443
it ( 'should not prepare broken connection to close' , async ( ) => {
437
444
connection = await createConnection ( `bolt://${ sharedNeo4j . hostname } ` )
438
445
439
- await connection . connect ( 'my-connection/9.9.9' , 'mydriver/0.0.0 some system info' , basicAuthToken ( ) )
446
+ await connection . connect ( 'my-connection/9.9.9' , BOLT_AGENT , basicAuthToken ( ) )
440
447
expect ( connection . _protocol ) . toBeDefined ( )
441
448
expect ( connection . _protocol ) . not . toBeNull ( )
442
449
0 commit comments