@@ -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
+ languageDetails : 'Some node or deno details'
55
+ }
56
+
50
57
describe ( '#integration ChannelConnection' , ( ) => {
51
58
/** @type {Connection } */
52
59
let connection
@@ -77,6 +84,7 @@ describe('#integration ChannelConnection', () => {
77
84
. then ( connection => {
78
85
connection . protocol ( ) . initialize ( {
79
86
userAgent : 'mydriver/0.0.0' ,
87
+ boltAgent : BOLT_AGENT ,
80
88
authToken : basicAuthToken ( ) ,
81
89
onComplete : metadata => {
82
90
expect ( metadata ) . not . toBeNull ( )
@@ -104,7 +112,7 @@ describe('#integration ChannelConnection', () => {
104
112
}
105
113
106
114
connection
107
- . connect ( 'mydriver/0.0.0' , 'mydriver/0.0.0 some system info' , basicAuthToken ( ) )
115
+ . connect ( 'mydriver/0.0.0' , BOLT_AGENT , basicAuthToken ( ) )
108
116
. then ( ( ) => {
109
117
connection
110
118
. protocol ( )
@@ -177,7 +185,7 @@ describe('#integration ChannelConnection', () => {
177
185
connection = await createConnection ( `bolt://${ sharedNeo4j . hostname } ` )
178
186
179
187
connection
180
- . connect ( 'mydriver/0.0.0' , 'mydriver/0.0.0 some system info' , basicAuthToken ( ) )
188
+ . connect ( 'mydriver/0.0.0' , BOLT_AGENT , basicAuthToken ( ) )
181
189
. then ( initializedConnection => {
182
190
expect ( initializedConnection ) . toBe ( connection )
183
191
done ( )
@@ -189,7 +197,7 @@ describe('#integration ChannelConnection', () => {
189
197
connection = await createConnection ( `bolt://${ sharedNeo4j . hostname } ` ) // wrong port
190
198
191
199
connection
192
- . connect ( 'mydriver/0.0.0' , 'mydriver/0.0.0 some system info' , basicWrongAuthToken ( ) )
200
+ . connect ( 'mydriver/0.0.0' , BOLT_AGENT , basicWrongAuthToken ( ) )
193
201
. then ( ( ) => done . fail ( 'Should not initialize' ) )
194
202
. catch ( error => {
195
203
expect ( error ) . toBeDefined ( )
@@ -200,7 +208,7 @@ describe('#integration ChannelConnection', () => {
200
208
it ( 'should have server version after connection initialization completed' , async done => {
201
209
connection = await createConnection ( `bolt://${ sharedNeo4j . hostname } ` )
202
210
connection
203
- . connect ( 'mydriver/0.0.0' , 'mydriver/0.0.0 some system info' , basicAuthToken ( ) )
211
+ . connect ( 'mydriver/0.0.0' , BOLT_AGENT , basicAuthToken ( ) )
204
212
. then ( initializedConnection => {
205
213
expect ( initializedConnection ) . toBe ( connection )
206
214
const serverVersion = ServerVersion . fromString ( connection . version )
@@ -214,7 +222,7 @@ describe('#integration ChannelConnection', () => {
214
222
connection = await createConnection ( `bolt://${ sharedNeo4j . hostname } ` )
215
223
216
224
connection
217
- . connect ( 'mydriver/0.0.0' , 'mydriver/0.0.0 some system info' , basicWrongAuthToken ( ) )
225
+ . connect ( 'mydriver/0.0.0' , BOLT_AGENT , basicWrongAuthToken ( ) )
218
226
. then ( ( ) => done . fail ( 'Should not connect' ) )
219
227
. catch ( initialError => {
220
228
expect ( initialError ) . toBeDefined ( )
@@ -244,7 +252,7 @@ describe('#integration ChannelConnection', () => {
244
252
it ( 'should not queue INIT observer when broken' , done => {
245
253
testQueueingOfObserversWithBrokenConnection (
246
254
connection =>
247
- connection . protocol ( ) . initialize ( { userAgent : 'Hello' , authToken : { } } ) ,
255
+ connection . protocol ( ) . initialize ( { userAgent : 'Hello' , boltAgent : BOLT_AGENT , authToken : { } } ) ,
248
256
done
249
257
)
250
258
} )
@@ -274,7 +282,7 @@ describe('#integration ChannelConnection', () => {
274
282
connection = await createConnection ( `bolt://${ sharedNeo4j . hostname } ` )
275
283
276
284
connection
277
- . connect ( 'my-driver/1.2.3' , 'mydriver/0.0.0 some system info' , basicAuthToken ( ) )
285
+ . connect ( 'my-driver/1.2.3' , BOLT_AGENT , basicAuthToken ( ) )
278
286
. then ( ( ) => {
279
287
connection
280
288
. resetAndFlush ( )
@@ -297,7 +305,7 @@ describe('#integration ChannelConnection', () => {
297
305
it ( 'should fail to reset and flush when FAILURE received' , async done => {
298
306
createConnection ( `bolt://${ sharedNeo4j . hostname } ` )
299
307
. then ( connection => {
300
- connection . connect ( 'my-driver/1.2.3' , 'mydriver/0.0.0 some system info' , basicAuthToken ( ) ) . then ( ( ) => {
308
+ connection . connect ( 'my-driver/1.2.3' , BOLT_AGENT , basicAuthToken ( ) ) . then ( ( ) => {
301
309
connection
302
310
. resetAndFlush ( )
303
311
. then ( ( ) => done . fail ( 'Should fail' ) )
@@ -325,7 +333,7 @@ describe('#integration ChannelConnection', () => {
325
333
connection = await createConnection ( `bolt://${ sharedNeo4j . hostname } ` )
326
334
327
335
connection
328
- . connect ( 'my-driver/1.2.3' , 'mydriver/0.0.0 some system info' , basicAuthToken ( ) )
336
+ . connect ( 'my-driver/1.2.3' , BOLT_AGENT , basicAuthToken ( ) )
329
337
. then ( ( ) => {
330
338
connection
331
339
. resetAndFlush ( )
@@ -353,7 +361,7 @@ describe('#integration ChannelConnection', () => {
353
361
createConnection ( `bolt://${ sharedNeo4j . hostname } ` )
354
362
. then ( connection => {
355
363
connection
356
- . connect ( 'my-driver/1.2.3' , 'mydriver/0.0.0 some system info' , basicAuthToken ( ) )
364
+ . connect ( 'my-driver/1.2.3' , BOLT_AGENT , basicAuthToken ( ) )
357
365
. then ( ( ) => {
358
366
connection . protocol ( ) . _responseHandler . _currentFailure = newError (
359
367
'Hello'
@@ -419,7 +427,7 @@ describe('#integration ChannelConnection', () => {
419
427
connection = await createConnection ( `bolt://${ sharedNeo4j . hostname } ` )
420
428
recordWrittenMessages ( connection . _protocol , messages )
421
429
422
- await connection . connect ( 'mydriver/0.0.0' , 'mydriver/0.0.0 some system info' , basicAuthToken ( ) )
430
+ await connection . connect ( 'mydriver/0.0.0' , BOLT_AGENT , basicAuthToken ( ) )
423
431
424
432
expect ( connection . isOpen ( ) ) . toBeTruthy ( )
425
433
await connection . close ( )
@@ -436,7 +444,7 @@ describe('#integration ChannelConnection', () => {
436
444
it ( 'should not prepare broken connection to close' , async ( ) => {
437
445
connection = await createConnection ( `bolt://${ sharedNeo4j . hostname } ` )
438
446
439
- await connection . connect ( 'my-connection/9.9.9' , 'mydriver/0.0.0 some system info' , basicAuthToken ( ) )
447
+ await connection . connect ( 'my-connection/9.9.9' , BOLT_AGENT , basicAuthToken ( ) )
440
448
expect ( connection . _protocol ) . toBeDefined ( )
441
449
expect ( connection . _protocol ) . not . toBeNull ( )
442
450
0 commit comments