@@ -436,7 +436,11 @@ describe('#integration-rx summary', () => {
436436 return
437437 }
438438
439- await verifyUpdates ( runnable , 'CREATE INDEX on :Label(prop)' , null , {
439+ const query = isNewConstraintIndexSyntax ( protocolVersion )
440+ ? 'CREATE INDEX FOR (l:Label) ON (l.prop)'
441+ : 'CREATE INDEX ON :Label(prop)'
442+
443+ await verifyUpdates ( runnable , query , null , {
440444 nodesCreated : 0 ,
441445 nodesDeleted : 0 ,
442446 relationshipsCreated : 0 ,
@@ -467,12 +471,18 @@ describe('#integration-rx summary', () => {
467471 // first create the to-be-dropped index
468472 const session = driver . session ( )
469473 try {
470- await session . run ( 'CREATE INDEX on :Label(prop)' )
474+ const query = isNewConstraintIndexSyntax ( protocolVersion )
475+ ? 'CREATE INDEX l_prop FOR (l:Label) ON (l.prop)'
476+ : 'CREATE INDEX ON :Label(prop)'
477+ await session . run ( query )
471478 } finally {
472479 await session . close ( )
473480 }
474481
475- await verifyUpdates ( runnable , 'DROP INDEX on :Label(prop)' , null , {
482+ const query = isNewConstraintIndexSyntax ( protocolVersion )
483+ ? 'DROP INDEX l_prop'
484+ : 'DROP INDEX ON :Label(prop)'
485+ await verifyUpdates ( runnable , query , null , {
476486 nodesCreated : 0 ,
477487 nodesDeleted : 0 ,
478488 relationshipsCreated : 0 ,
@@ -499,24 +509,22 @@ describe('#integration-rx summary', () => {
499509 return
500510 }
501511
502- await verifyUpdates (
503- runnable ,
504- 'CREATE CONSTRAINT ON (book:Book) ASSERT book.isbn IS UNIQUE' ,
505- null ,
506- {
507- nodesCreated : 0 ,
508- nodesDeleted : 0 ,
509- relationshipsCreated : 0 ,
510- relationshipsDeleted : 0 ,
511- propertiesSet : 0 ,
512- labelsAdded : 0 ,
513- labelsRemoved : 0 ,
514- indexesAdded : 0 ,
515- indexesRemoved : 0 ,
516- constraintsAdded : 1 ,
517- constraintsRemoved : 0
518- }
519- )
512+ const query = isNewConstraintIndexSyntax ( protocolVersion )
513+ ? 'CREATE CONSTRAINT FOR (book:Book) REQUIRE book.isbn IS UNIQUE'
514+ : 'CREATE CONSTRAINT ON (book:Book) ASSERT book.isbn IS UNIQUE'
515+ await verifyUpdates ( runnable , query , null , {
516+ nodesCreated : 0 ,
517+ nodesDeleted : 0 ,
518+ relationshipsCreated : 0 ,
519+ relationshipsDeleted : 0 ,
520+ propertiesSet : 0 ,
521+ labelsAdded : 0 ,
522+ labelsRemoved : 0 ,
523+ indexesAdded : 0 ,
524+ indexesRemoved : 0 ,
525+ constraintsAdded : 1 ,
526+ constraintsRemoved : 0
527+ } )
520528 }
521529
522530 /**
@@ -535,31 +543,30 @@ describe('#integration-rx summary', () => {
535543 // first create the to-be-dropped index
536544 const session = driver . session ( )
537545 try {
538- await session . run (
539- 'CREATE CONSTRAINT ON (book:Book) ASSERT book.isbn IS UNIQUE'
540- )
546+ const query = isNewConstraintIndexSyntax ( protocolVersion )
547+ ? 'CREATE CONSTRAINT book_isbn FOR (book:Book) REQUIRE book.isbn IS UNIQUE'
548+ : 'CREATE CONSTRAINT ON (book:Book) ASSERT book.isbn IS UNIQUE'
549+ await session . run ( query )
541550 } finally {
542551 await session . close ( )
543552 }
544553
545- await verifyUpdates (
546- runnable ,
547- 'DROP CONSTRAINT ON (book:Book) ASSERT book.isbn IS UNIQUE' ,
548- null ,
549- {
550- nodesCreated : 0 ,
551- nodesDeleted : 0 ,
552- relationshipsCreated : 0 ,
553- relationshipsDeleted : 0 ,
554- propertiesSet : 0 ,
555- labelsAdded : 0 ,
556- labelsRemoved : 0 ,
557- indexesAdded : 0 ,
558- indexesRemoved : 0 ,
559- constraintsAdded : 0 ,
560- constraintsRemoved : 1
561- }
562- )
554+ const query = isNewConstraintIndexSyntax ( protocolVersion )
555+ ? 'DROP CONSTRAINT book_isbn'
556+ : 'DROP CONSTRAINT ON (book:Book) ASSERT book.isbn IS UNIQUE'
557+ await verifyUpdates ( runnable , query , null , {
558+ nodesCreated : 0 ,
559+ nodesDeleted : 0 ,
560+ relationshipsCreated : 0 ,
561+ relationshipsDeleted : 0 ,
562+ propertiesSet : 0 ,
563+ labelsAdded : 0 ,
564+ labelsRemoved : 0 ,
565+ indexesAdded : 0 ,
566+ indexesRemoved : 0 ,
567+ constraintsAdded : 0 ,
568+ constraintsRemoved : 1
569+ } )
563570 }
564571
565572 /**
@@ -764,4 +771,8 @@ describe('#integration-rx summary', () => {
764771 await session . close ( )
765772 }
766773 }
774+
775+ function isNewConstraintIndexSyntax ( protocolVersion ) {
776+ return protocolVersion > 4.3
777+ }
767778} )
0 commit comments