@@ -47,6 +47,13 @@ const SUCCESS_MESSAGE = { signature: 0x70, fields: [{}] }
4747const FAILURE_MESSAGE = { signature : 0x7f , fields : [ newError ( 'Hello' ) ] }
4848const RECORD_MESSAGE = { signature : 0x71 , fields : [ { value : 'Hello' } ] }
4949
50+ const BOLT_AGENT = {
51+ product : 'js-driver' ,
52+ platform : 'SomePlatform' ,
53+ language : 'js' ,
54+ languageDetails : 'Some node or deno details'
55+ }
56+
5057describe ( '#integration ChannelConnection' , ( ) => {
5158 /** @type {Connection } */
5259 let connection
@@ -77,6 +84,7 @@ describe('#integration ChannelConnection', () => {
7784 . then ( connection => {
7885 connection . protocol ( ) . initialize ( {
7986 userAgent : 'mydriver/0.0.0' ,
87+ boltAgent : BOLT_AGENT ,
8088 authToken : basicAuthToken ( ) ,
8189 onComplete : metadata => {
8290 expect ( metadata ) . not . toBeNull ( )
@@ -104,7 +112,7 @@ describe('#integration ChannelConnection', () => {
104112 }
105113
106114 connection
107- . connect ( 'mydriver/0.0.0' , 'mydriver/0.0.0 some system info' , basicAuthToken ( ) )
115+ . connect ( 'mydriver/0.0.0' , BOLT_AGENT , basicAuthToken ( ) )
108116 . then ( ( ) => {
109117 connection
110118 . protocol ( )
@@ -177,7 +185,7 @@ describe('#integration ChannelConnection', () => {
177185 connection = await createConnection ( `bolt://${ sharedNeo4j . hostname } ` )
178186
179187 connection
180- . connect ( 'mydriver/0.0.0' , 'mydriver/0.0.0 some system info' , basicAuthToken ( ) )
188+ . connect ( 'mydriver/0.0.0' , BOLT_AGENT , basicAuthToken ( ) )
181189 . then ( initializedConnection => {
182190 expect ( initializedConnection ) . toBe ( connection )
183191 done ( )
@@ -189,7 +197,7 @@ describe('#integration ChannelConnection', () => {
189197 connection = await createConnection ( `bolt://${ sharedNeo4j . hostname } ` ) // wrong port
190198
191199 connection
192- . connect ( 'mydriver/0.0.0' , 'mydriver/0.0.0 some system info' , basicWrongAuthToken ( ) )
200+ . connect ( 'mydriver/0.0.0' , BOLT_AGENT , basicWrongAuthToken ( ) )
193201 . then ( ( ) => done . fail ( 'Should not initialize' ) )
194202 . catch ( error => {
195203 expect ( error ) . toBeDefined ( )
@@ -200,7 +208,7 @@ describe('#integration ChannelConnection', () => {
200208 it ( 'should have server version after connection initialization completed' , async done => {
201209 connection = await createConnection ( `bolt://${ sharedNeo4j . hostname } ` )
202210 connection
203- . connect ( 'mydriver/0.0.0' , 'mydriver/0.0.0 some system info' , basicAuthToken ( ) )
211+ . connect ( 'mydriver/0.0.0' , BOLT_AGENT , basicAuthToken ( ) )
204212 . then ( initializedConnection => {
205213 expect ( initializedConnection ) . toBe ( connection )
206214 const serverVersion = ServerVersion . fromString ( connection . version )
@@ -214,7 +222,7 @@ describe('#integration ChannelConnection', () => {
214222 connection = await createConnection ( `bolt://${ sharedNeo4j . hostname } ` )
215223
216224 connection
217- . connect ( 'mydriver/0.0.0' , 'mydriver/0.0.0 some system info' , basicWrongAuthToken ( ) )
225+ . connect ( 'mydriver/0.0.0' , BOLT_AGENT , basicWrongAuthToken ( ) )
218226 . then ( ( ) => done . fail ( 'Should not connect' ) )
219227 . catch ( initialError => {
220228 expect ( initialError ) . toBeDefined ( )
@@ -244,7 +252,7 @@ describe('#integration ChannelConnection', () => {
244252 it ( 'should not queue INIT observer when broken' , done => {
245253 testQueueingOfObserversWithBrokenConnection (
246254 connection =>
247- connection . protocol ( ) . initialize ( { userAgent : 'Hello' , authToken : { } } ) ,
255+ connection . protocol ( ) . initialize ( { userAgent : 'Hello' , boltAgent : BOLT_AGENT , authToken : { } } ) ,
248256 done
249257 )
250258 } )
@@ -274,7 +282,7 @@ describe('#integration ChannelConnection', () => {
274282 connection = await createConnection ( `bolt://${ sharedNeo4j . hostname } ` )
275283
276284 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 ( ) )
278286 . then ( ( ) => {
279287 connection
280288 . resetAndFlush ( )
@@ -297,7 +305,7 @@ describe('#integration ChannelConnection', () => {
297305 it ( 'should fail to reset and flush when FAILURE received' , async done => {
298306 createConnection ( `bolt://${ sharedNeo4j . hostname } ` )
299307 . 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 ( ( ) => {
301309 connection
302310 . resetAndFlush ( )
303311 . then ( ( ) => done . fail ( 'Should fail' ) )
@@ -325,7 +333,7 @@ describe('#integration ChannelConnection', () => {
325333 connection = await createConnection ( `bolt://${ sharedNeo4j . hostname } ` )
326334
327335 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 ( ) )
329337 . then ( ( ) => {
330338 connection
331339 . resetAndFlush ( )
@@ -353,7 +361,7 @@ describe('#integration ChannelConnection', () => {
353361 createConnection ( `bolt://${ sharedNeo4j . hostname } ` )
354362 . then ( connection => {
355363 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 ( ) )
357365 . then ( ( ) => {
358366 connection . protocol ( ) . _responseHandler . _currentFailure = newError (
359367 'Hello'
@@ -419,7 +427,7 @@ describe('#integration ChannelConnection', () => {
419427 connection = await createConnection ( `bolt://${ sharedNeo4j . hostname } ` )
420428 recordWrittenMessages ( connection . _protocol , messages )
421429
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 ( ) )
423431
424432 expect ( connection . isOpen ( ) ) . toBeTruthy ( )
425433 await connection . close ( )
@@ -436,7 +444,7 @@ describe('#integration ChannelConnection', () => {
436444 it ( 'should not prepare broken connection to close' , async ( ) => {
437445 connection = await createConnection ( `bolt://${ sharedNeo4j . hostname } ` )
438446
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 ( ) )
440448 expect ( connection . _protocol ) . toBeDefined ( )
441449 expect ( connection . _protocol ) . not . toBeNull ( )
442450
0 commit comments