@@ -583,7 +583,9 @@ describe('session', () => {
583
583
return ;
584
584
}
585
585
586
- const bookmarkBefore = session . lastBookmark ( ) ;
586
+ // new session without initial bookmark
587
+ session = driver . session ( ) ;
588
+ expect ( session . lastBookmark ( ) ) . toBeNull ( ) ;
587
589
588
590
const tx = session . beginTransaction ( ) ;
589
591
tx . run ( 'RETURN 42 as answer' ) . then ( result => {
@@ -592,11 +594,7 @@ describe('session', () => {
592
594
expect ( records [ 0 ] . get ( 'answer' ) . toNumber ( ) ) . toEqual ( 42 ) ;
593
595
594
596
tx . commit ( ) . then ( ( ) => {
595
- const bookmarkAfter = session . lastBookmark ( ) ;
596
- expect ( bookmarkAfter ) . toBeDefined ( ) ;
597
- expect ( bookmarkAfter ) . not . toBeNull ( ) ;
598
- expect ( bookmarkAfter ) . not . toEqual ( bookmarkBefore ) ;
599
-
597
+ verifyBookmark ( session . lastBookmark ( ) ) ;
600
598
done ( ) ;
601
599
} ) ;
602
600
} ) ;
@@ -631,12 +629,10 @@ describe('session', () => {
631
629
tx . run ( 'CREATE ()' ) . then ( ( ) => {
632
630
tx . commit ( ) . then ( ( ) => {
633
631
const bookmarkBefore = session . lastBookmark ( ) ;
634
- expect ( bookmarkBefore ) . toBeDefined ( ) ;
635
- expect ( bookmarkBefore ) . not . toBeNull ( ) ;
632
+ verifyBookmark ( bookmarkBefore ) ;
636
633
637
634
session . run ( 'CREATE ()' ) . then ( ( ) => {
638
- const bookmarkAfter = session . lastBookmark ( ) ;
639
- expect ( bookmarkAfter ) . toEqual ( bookmarkBefore ) ;
635
+ verifyBookmark ( session . lastBookmark ( ) ) ;
640
636
done ( ) ;
641
637
} ) ;
642
638
} ) ;
@@ -648,17 +644,16 @@ describe('session', () => {
648
644
return ;
649
645
}
650
646
651
- const bookmarkBefore = session . lastBookmark ( ) ;
647
+ // new session without initial bookmark
648
+ session = driver . session ( ) ;
649
+ expect ( session . lastBookmark ( ) ) . toBeNull ( ) ;
650
+
652
651
const resultPromise = session . readTransaction ( tx => tx . run ( 'RETURN 42 AS answer' ) ) ;
653
652
654
653
resultPromise . then ( result => {
655
654
expect ( result . records . length ) . toEqual ( 1 ) ;
656
655
expect ( result . records [ 0 ] . get ( 'answer' ) . toNumber ( ) ) . toEqual ( 42 ) ;
657
-
658
- const bookmarkAfter = session . lastBookmark ( ) ;
659
- verifyBookmark ( bookmarkAfter ) ;
660
- expect ( bookmarkAfter ) . not . toEqual ( bookmarkBefore ) ;
661
-
656
+ verifyBookmark ( session . lastBookmark ( ) ) ;
662
657
done ( ) ;
663
658
} ) ;
664
659
} ) ;
0 commit comments