@@ -39,7 +39,7 @@ describe('#integration-rx summary', () => {
3939 session = driver . rxSession ( )
4040
4141 protocolVersion = await sharedNeo4j . cleanupAndGetProtocolVersion ( driver )
42- await dropConstraintsAndIndices ( driver )
42+ await dropConstraintsAndIndices ( driver , protocolVersion )
4343 } )
4444
4545 afterEach ( async ( ) => {
@@ -140,7 +140,7 @@ describe('#integration-rx summary', () => {
140140 await normalSession . close ( )
141141 }
142142
143- await dropConstraintsAndIndices ( driver )
143+ await dropConstraintsAndIndices ( driver , protocolVersion )
144144 } )
145145
146146 afterEach ( async ( ) => {
@@ -240,7 +240,7 @@ describe('#integration-rx summary', () => {
240240 await normalSession . close ( )
241241 }
242242
243- await dropConstraintsAndIndices ( driver )
243+ await dropConstraintsAndIndices ( driver , protocolVersion )
244244 } )
245245
246246 afterEach ( async ( ) => {
@@ -755,16 +755,22 @@ describe('#integration-rx summary', () => {
755755 expect ( summary . counters . containsUpdates ( ) ) . toBeFalsy ( )
756756 }
757757
758- async function dropConstraintsAndIndices ( driver ) {
758+ async function dropConstraintsAndIndices ( driver , protocolVersion ) {
759759 const session = driver . session ( )
760760 try {
761- const constraints = await session . run ( 'CALL db.constraints()' )
761+ const showConstraints = shouldUseShowConstraints ( protocolVersion )
762+ ? 'SHOW CONSTRAINTS'
763+ : 'CALL db.constraints()'
764+ const constraints = await session . run ( showConstraints )
762765 for ( let i = 0 ; i < constraints . records . length ; i ++ ) {
763766 const name = constraints . records [ i ] . toObject ( ) . name
764767 await session . run ( 'DROP CONSTRAINT ' + name ) // ${getName(constraints.records[i])}`)
765768 }
766769
767- const indices = await session . run ( 'CALL db.indexes()' )
770+ const showIndexes = shouldUseShowIndexes ( protocolVersion )
771+ ? 'SHOW INDEXES'
772+ : 'CALL db.indexes()'
773+ const indices = await session . run ( showIndexes )
768774 for ( let i = 0 ; i < indices . records . length ; i ++ ) {
769775 const name = indices . records [ i ] . toObject ( ) . name
770776 await session . run ( 'DROP INDEX ' + name ) // ${getName(constraints.records[i])}`)
@@ -777,4 +783,12 @@ describe('#integration-rx summary', () => {
777783 function isNewConstraintIndexSyntax ( protocolVersion ) {
778784 return protocolVersion > 4.3
779785 }
786+
787+ function shouldUseShowConstraints ( protocolVersion ) {
788+ return protocolVersion > 4.2
789+ }
790+
791+ function shouldUseShowIndexes ( protocolVersion ) {
792+ return protocolVersion > 4.2
793+ }
780794} )
0 commit comments