@@ -583,7 +583,9 @@ describe('session', () => {
583583 return ;
584584 }
585585
586- const bookmarkBefore = session . lastBookmark ( ) ;
586+ // new session without initial bookmark
587+ session = driver . session ( ) ;
588+ expect ( session . lastBookmark ( ) ) . toBeNull ( ) ;
587589
588590 const tx = session . beginTransaction ( ) ;
589591 tx . run ( 'RETURN 42 as answer' ) . then ( result => {
@@ -592,11 +594,7 @@ describe('session', () => {
592594 expect ( records [ 0 ] . get ( 'answer' ) . toNumber ( ) ) . toEqual ( 42 ) ;
593595
594596 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 ( ) ) ;
600598 done ( ) ;
601599 } ) ;
602600 } ) ;
@@ -631,12 +629,10 @@ describe('session', () => {
631629 tx . run ( 'CREATE ()' ) . then ( ( ) => {
632630 tx . commit ( ) . then ( ( ) => {
633631 const bookmarkBefore = session . lastBookmark ( ) ;
634- expect ( bookmarkBefore ) . toBeDefined ( ) ;
635- expect ( bookmarkBefore ) . not . toBeNull ( ) ;
632+ verifyBookmark ( bookmarkBefore ) ;
636633
637634 session . run ( 'CREATE ()' ) . then ( ( ) => {
638- const bookmarkAfter = session . lastBookmark ( ) ;
639- expect ( bookmarkAfter ) . toEqual ( bookmarkBefore ) ;
635+ verifyBookmark ( session . lastBookmark ( ) ) ;
640636 done ( ) ;
641637 } ) ;
642638 } ) ;
@@ -648,17 +644,16 @@ describe('session', () => {
648644 return ;
649645 }
650646
651- const bookmarkBefore = session . lastBookmark ( ) ;
647+ // new session without initial bookmark
648+ session = driver . session ( ) ;
649+ expect ( session . lastBookmark ( ) ) . toBeNull ( ) ;
650+
652651 const resultPromise = session . readTransaction ( tx => tx . run ( 'RETURN 42 AS answer' ) ) ;
653652
654653 resultPromise . then ( result => {
655654 expect ( result . records . length ) . toEqual ( 1 ) ;
656655 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 ( ) ) ;
662657 done ( ) ;
663658 } ) ;
664659 } ) ;
0 commit comments