diff --git a/packages/bolt-connection/src/connection/connection-channel.js b/packages/bolt-connection/src/connection/connection-channel.js index 10691f5e9..00f028f4d 100644 --- a/packages/bolt-connection/src/connection/connection-channel.js +++ b/packages/bolt-connection/src/connection/connection-channel.js @@ -183,7 +183,7 @@ export default class ChannelConnection extends Connection { /** * Send initialization message. * @param {string} userAgent the user agent for this driver. - * @param {string} boltAgent the bolt agent for this driver. + * @param {Object} boltAgent the bolt agent for this driver. * @param {Object} authToken the object containing auth information. * @param {boolean} waitReAuth whether ot not the connection will wait for re-authentication to happen * @return {Promise} promise resolved with the current connection if connection is successful. Rejected promise otherwise. diff --git a/packages/bolt-connection/src/connection/connection.js b/packages/bolt-connection/src/connection/connection.js index 463c52b8f..f016d2719 100644 --- a/packages/bolt-connection/src/connection/connection.js +++ b/packages/bolt-connection/src/connection/connection.js @@ -90,7 +90,7 @@ export default class Connection { /** * Connect to the target address, negotiate Bolt protocol and send initialization message. * @param {string} userAgent the user agent for this driver. - * @param {string} boltAgent the bolt agent for this driver. + * @param {Object} boltAgent the bolt agent for this driver. * @param {Object} authToken the object containing auth information. * @param {boolean} shouldWaitReAuth whether ot not the connection will wait for re-authentication to happen * @return {Promise} promise resolved with the current connection if connection is successful. Rejected promise otherwise. diff --git a/packages/neo4j-driver-deno/lib/bolt-connection/connection/connection-channel.js b/packages/neo4j-driver-deno/lib/bolt-connection/connection/connection-channel.js index df21b3c59..755b3aeeb 100644 --- a/packages/neo4j-driver-deno/lib/bolt-connection/connection/connection-channel.js +++ b/packages/neo4j-driver-deno/lib/bolt-connection/connection/connection-channel.js @@ -183,7 +183,7 @@ export default class ChannelConnection extends Connection { /** * Send initialization message. * @param {string} userAgent the user agent for this driver. - * @param {string} boltAgent the bolt agent for this driver. + * @param {Object} boltAgent the bolt agent for this driver. * @param {Object} authToken the object containing auth information. * @param {boolean} waitReAuth whether ot not the connection will wait for re-authentication to happen * @return {Promise} promise resolved with the current connection if connection is successful. Rejected promise otherwise. diff --git a/packages/neo4j-driver-deno/lib/bolt-connection/connection/connection.js b/packages/neo4j-driver-deno/lib/bolt-connection/connection/connection.js index 0913951fa..d80357d09 100644 --- a/packages/neo4j-driver-deno/lib/bolt-connection/connection/connection.js +++ b/packages/neo4j-driver-deno/lib/bolt-connection/connection/connection.js @@ -90,7 +90,7 @@ export default class Connection { /** * Connect to the target address, negotiate Bolt protocol and send initialization message. * @param {string} userAgent the user agent for this driver. - * @param {string} boltAgent the bolt agent for this driver. + * @param {Object} boltAgent the bolt agent for this driver. * @param {Object} authToken the object containing auth information. * @param {boolean} shouldWaitReAuth whether ot not the connection will wait for re-authentication to happen * @return {Promise} promise resolved with the current connection if connection is successful. Rejected promise otherwise. diff --git a/packages/neo4j-driver/test/examples.test.js b/packages/neo4j-driver/test/examples.test.js index 273e38d27..90b56608a 100644 --- a/packages/neo4j-driver/test/examples.test.js +++ b/packages/neo4j-driver/test/examples.test.js @@ -806,7 +806,7 @@ describe('#integration examples', () => { try { await tempSession.run( "UNWIND ['Infinity Gauntlet', 'Mjölnir'] AS item " + - 'CREATE (:Product {id: 0, title: item})' + 'CREATE (:Product {id: 0, title: item})' ) } finally { await tempSession.close() @@ -827,11 +827,16 @@ describe('#integration examples', () => { // end::rx-transaction-function[] const people = await result.toPromise() - expect(people).toEqual([ - Notification.createNext('Infinity Gauntlet'), - Notification.createNext('Mjölnir'), + expect(people.length).toEqual(3) + expect(people).toContain( + Notification.createNext('Infinity Gauntlet') + ) + expect(people).toContain( + Notification.createNext('Mjölnir') + ) + expect(people).toContain( Notification.createComplete() - ]) + ) }, 60000) it('configure transaction timeout', async () => { diff --git a/packages/neo4j-driver/test/internal/connection-channel.test.js b/packages/neo4j-driver/test/internal/connection-channel.test.js index 33cb7a6db..bf6d6d32d 100644 --- a/packages/neo4j-driver/test/internal/connection-channel.test.js +++ b/packages/neo4j-driver/test/internal/connection-channel.test.js @@ -47,6 +47,13 @@ const SUCCESS_MESSAGE = { signature: 0x70, fields: [{}] } const FAILURE_MESSAGE = { signature: 0x7f, fields: [newError('Hello')] } const RECORD_MESSAGE = { signature: 0x71, fields: [{ value: 'Hello' }] } +const BOLT_AGENT = { + product: 'js-driver', + platform: 'SomePlatform', + language: 'js', + languageDetails: 'Some node or deno details' +} + describe('#integration ChannelConnection', () => { /** @type {Connection} */ let connection @@ -77,6 +84,7 @@ describe('#integration ChannelConnection', () => { .then(connection => { connection.protocol().initialize({ userAgent: 'mydriver/0.0.0', + boltAgent: BOLT_AGENT, authToken: basicAuthToken(), onComplete: metadata => { expect(metadata).not.toBeNull() @@ -104,7 +112,7 @@ describe('#integration ChannelConnection', () => { } connection - .connect('mydriver/0.0.0', 'mydriver/0.0.0 some system info', basicAuthToken()) + .connect('mydriver/0.0.0', BOLT_AGENT, basicAuthToken()) .then(() => { connection .protocol() @@ -177,7 +185,7 @@ describe('#integration ChannelConnection', () => { connection = await createConnection(`bolt://${sharedNeo4j.hostname}`) connection - .connect('mydriver/0.0.0', 'mydriver/0.0.0 some system info', basicAuthToken()) + .connect('mydriver/0.0.0', BOLT_AGENT, basicAuthToken()) .then(initializedConnection => { expect(initializedConnection).toBe(connection) done() @@ -189,7 +197,7 @@ describe('#integration ChannelConnection', () => { connection = await createConnection(`bolt://${sharedNeo4j.hostname}`) // wrong port connection - .connect('mydriver/0.0.0', 'mydriver/0.0.0 some system info', basicWrongAuthToken()) + .connect('mydriver/0.0.0', BOLT_AGENT, basicWrongAuthToken()) .then(() => done.fail('Should not initialize')) .catch(error => { expect(error).toBeDefined() @@ -200,7 +208,7 @@ describe('#integration ChannelConnection', () => { it('should have server version after connection initialization completed', async done => { connection = await createConnection(`bolt://${sharedNeo4j.hostname}`) connection - .connect('mydriver/0.0.0', 'mydriver/0.0.0 some system info', basicAuthToken()) + .connect('mydriver/0.0.0', BOLT_AGENT, basicAuthToken()) .then(initializedConnection => { expect(initializedConnection).toBe(connection) const serverVersion = ServerVersion.fromString(connection.version) @@ -214,7 +222,7 @@ describe('#integration ChannelConnection', () => { connection = await createConnection(`bolt://${sharedNeo4j.hostname}`) connection - .connect('mydriver/0.0.0', 'mydriver/0.0.0 some system info', basicWrongAuthToken()) + .connect('mydriver/0.0.0', BOLT_AGENT, basicWrongAuthToken()) .then(() => done.fail('Should not connect')) .catch(initialError => { expect(initialError).toBeDefined() @@ -244,7 +252,7 @@ describe('#integration ChannelConnection', () => { it('should not queue INIT observer when broken', done => { testQueueingOfObserversWithBrokenConnection( connection => - connection.protocol().initialize({ userAgent: 'Hello', authToken: {} }), + connection.protocol().initialize({ userAgent: 'Hello', boltAgent: BOLT_AGENT, authToken: {} }), done ) }) @@ -274,7 +282,7 @@ describe('#integration ChannelConnection', () => { connection = await createConnection(`bolt://${sharedNeo4j.hostname}`) connection - .connect('my-driver/1.2.3', 'mydriver/0.0.0 some system info', basicAuthToken()) + .connect('my-driver/1.2.3', BOLT_AGENT, basicAuthToken()) .then(() => { connection .resetAndFlush() @@ -297,7 +305,7 @@ describe('#integration ChannelConnection', () => { it('should fail to reset and flush when FAILURE received', async done => { createConnection(`bolt://${sharedNeo4j.hostname}`) .then(connection => { - connection.connect('my-driver/1.2.3', 'mydriver/0.0.0 some system info', basicAuthToken()).then(() => { + connection.connect('my-driver/1.2.3', BOLT_AGENT, basicAuthToken()).then(() => { connection .resetAndFlush() .then(() => done.fail('Should fail')) @@ -325,7 +333,7 @@ describe('#integration ChannelConnection', () => { connection = await createConnection(`bolt://${sharedNeo4j.hostname}`) connection - .connect('my-driver/1.2.3', 'mydriver/0.0.0 some system info', basicAuthToken()) + .connect('my-driver/1.2.3', BOLT_AGENT, basicAuthToken()) .then(() => { connection .resetAndFlush() @@ -353,7 +361,7 @@ describe('#integration ChannelConnection', () => { createConnection(`bolt://${sharedNeo4j.hostname}`) .then(connection => { connection - .connect('my-driver/1.2.3', 'mydriver/0.0.0 some system info', basicAuthToken()) + .connect('my-driver/1.2.3', BOLT_AGENT, basicAuthToken()) .then(() => { connection.protocol()._responseHandler._currentFailure = newError( 'Hello' @@ -419,7 +427,7 @@ describe('#integration ChannelConnection', () => { connection = await createConnection(`bolt://${sharedNeo4j.hostname}`) recordWrittenMessages(connection._protocol, messages) - await connection.connect('mydriver/0.0.0', 'mydriver/0.0.0 some system info', basicAuthToken()) + await connection.connect('mydriver/0.0.0', BOLT_AGENT, basicAuthToken()) expect(connection.isOpen()).toBeTruthy() await connection.close() @@ -436,7 +444,7 @@ describe('#integration ChannelConnection', () => { it('should not prepare broken connection to close', async () => { connection = await createConnection(`bolt://${sharedNeo4j.hostname}`) - await connection.connect('my-connection/9.9.9', 'mydriver/0.0.0 some system info', basicAuthToken()) + await connection.connect('my-connection/9.9.9', BOLT_AGENT, basicAuthToken()) expect(connection._protocol).toBeDefined() expect(connection._protocol).not.toBeNull()