@@ -2339,7 +2339,7 @@ describe('#stub-routing routing driver with stub server', () => {
23392339 }
23402340
23412341 const server = await boltStub . start (
2342- `./test/resources/boltstub/${ version } /supports_multi_db .script` ,
2342+ `./test/resources/boltstub/${ version } /supports_protocol_version .script` ,
23432343 9001
23442344 )
23452345
@@ -2357,7 +2357,7 @@ describe('#stub-routing routing driver with stub server', () => {
23572357 }
23582358
23592359 const server = await boltStub . start (
2360- `./test/resources/boltstub/${ version } /supports_multi_db .script` ,
2360+ `./test/resources/boltstub/${ version } /supports_protocol_version .script` ,
23612361 9001
23622362 )
23632363
@@ -2396,6 +2396,81 @@ describe('#stub-routing routing driver with stub server', () => {
23962396 } )
23972397 } )
23982398
2399+ describe ( 'should report whether transaction config is supported' , ( ) => {
2400+ async function verifySupportsTransactionConfig ( version , expected ) {
2401+ if ( ! boltStub . supported ) {
2402+ return
2403+ }
2404+
2405+ const server = await boltStub . start (
2406+ `./test/resources/boltstub/${ version } /supports_protocol_version.script` ,
2407+ 9001
2408+ )
2409+
2410+ const driver = boltStub . newDriver ( 'neo4j://127.0.0.1:9001' )
2411+
2412+ await expectAsync ( driver . supportsTransactionConfig ( ) ) . toBeResolvedTo (
2413+ expected
2414+ )
2415+
2416+ await driver . close ( )
2417+ await server . exit ( )
2418+ }
2419+
2420+ async function verifySupportsTransactionConfigWithResolver (
2421+ version ,
2422+ expected
2423+ ) {
2424+ if ( ! boltStub . supported ) {
2425+ return
2426+ }
2427+
2428+ const server = await boltStub . start (
2429+ `./test/resources/boltstub/${ version } /supports_protocol_version.script` ,
2430+ 9001
2431+ )
2432+
2433+ const driver = boltStub . newDriver ( 'neo4j://127.0.0.1:8000' , {
2434+ resolver : address => [
2435+ 'neo4j://127.0.0.1:9010' ,
2436+ 'neo4j://127.0.0.1:9005' ,
2437+ 'neo4j://127.0.0.1:9001'
2438+ ]
2439+ } )
2440+
2441+ await expectAsync ( driver . supportsTransactionConfig ( ) ) . toBeResolvedTo (
2442+ expected
2443+ )
2444+
2445+ await driver . close ( )
2446+ await server . exit ( )
2447+ }
2448+
2449+ it ( 'v1' , ( ) => verifySupportsTransactionConfig ( 'v1' , false ) )
2450+ it ( 'v2' , ( ) => verifySupportsTransactionConfig ( 'v2' , false ) )
2451+ it ( 'v3' , ( ) => verifySupportsTransactionConfig ( 'v3' , true ) )
2452+ it ( 'v4' , ( ) => verifySupportsTransactionConfig ( 'v4' , true ) )
2453+ it ( 'v1 with resolver' , ( ) =>
2454+ verifySupportsTransactionConfigWithResolver ( 'v1' , false ) )
2455+ it ( 'v2 with resolver' , ( ) =>
2456+ verifySupportsTransactionConfigWithResolver ( 'v2' , false ) )
2457+ it ( 'v3 with resolver' , ( ) =>
2458+ verifySupportsTransactionConfigWithResolver ( 'v3' , true ) )
2459+ it ( 'v4 with resolver' , ( ) =>
2460+ verifySupportsTransactionConfigWithResolver ( 'v4' , true ) )
2461+ it ( 'on error' , async ( ) => {
2462+ const driver = boltStub . newDriver ( 'neo4j://127.0.0.1:9001' )
2463+
2464+ await expectAsync ( driver . supportsTransactionConfig ( ) ) . toBeRejectedWith (
2465+ jasmine . objectContaining ( {
2466+ code : SESSION_EXPIRED
2467+ } )
2468+ )
2469+
2470+ await driver . close ( )
2471+ } )
2472+ } )
2473+
23992474 async function testAddressPurgeOnDatabaseError ( script , query , accessMode ) {
24002475 if ( ! boltStub . supported ) {
24012476 return
0 commit comments