Skip to content

Commit 3d7de3f

Browse files
committed
Fix how underlying connection is fetched in the test
1 parent 8f5810f commit 3d7de3f

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

test/internal/node/direct.driver.boltkit.test.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
* limitations under the License.
1818
*/
1919

20-
import neo4j, { Neo4jError } from '../../../src/v1'
20+
import neo4j from '../../../src/v1'
2121
import { READ, WRITE } from '../../../src/v1/driver'
2222
import boltStub from '../bolt-stub'
2323
import { newError, SERVICE_UNAVAILABLE } from '../../../src/v1/error'
@@ -447,7 +447,10 @@ describe('direct driver with stub server', () => {
447447
expect(records[1].get(0)).toBe('Alice')
448448
expect(records[2].get(0)).toBe('Tina')
449449

450-
const connection = driver._openConnections[0]
450+
const connectionKey = Object.keys(driver._openConnections)[0]
451+
expect(connectionKey).toBeTruthy()
452+
453+
const connection = driver._openConnections[connectionKey]
451454
session.close(() => {
452455
// generate a fake fatal error
453456
connection._handleFatalError(
@@ -460,7 +463,7 @@ describe('direct driver with stub server', () => {
460463
driver._pool._activeResourceCounts['127.0.0.1:9001']
461464
).toBeFalsy()
462465
// expect that the connection to be unregistered from the open connections registry
463-
expect(driver._openConnections[0]).toBeFalsy()
466+
expect(driver._openConnections[connectionKey]).toBeFalsy()
464467
driver.close()
465468
server.exit(code => {
466469
expect(code).toEqual(0)

0 commit comments

Comments
 (0)