@@ -476,6 +476,7 @@ describe('handleForcePasswordChangeEpic', () => {
476476
477477 const $$responseChannel = 'test-channel'
478478 const action = {
479+ host : 'bolt://localhost:7687' ,
479480 type : connections . FORCE_CHANGE_PASSWORD ,
480481 password : 'changeme' ,
481482 newPassword : 'password1' ,
@@ -524,9 +525,8 @@ describe('handleForcePasswordChangeEpic', () => {
524525
525526 test ( 'handleForcePasswordChangeEpic resolves with an error if directConnect fails' , ( ) => {
526527 // Given
527- ; ( bolt . directConnect as jest . Mock ) . mockRejectedValue (
528- new Error ( 'An error occurred.' )
529- )
528+ const message = 'An error occurred.'
529+ ; ( bolt . directConnect as jest . Mock ) . mockRejectedValue ( new Error ( message ) )
530530
531531 const p = new Promise < void > ( ( resolve , reject ) => {
532532 bus . take ( $$responseChannel , currentAction => {
@@ -541,19 +541,18 @@ describe('handleForcePasswordChangeEpic', () => {
541541
542542 expect ( executePasswordResetQuerySpy ) . not . toHaveBeenCalled ( )
543543
544- expect ( currentAction ) . toEqual (
545- expect . objectContaining ( {
546- error : expect . objectContaining ( {
547- message : 'An error occurred.'
548- } ) ,
549- success : false ,
550- type : $$responseChannel
551- } )
552- )
544+ expect ( currentAction ) . toEqual ( {
545+ error : expect . objectContaining ( {
546+ message
547+ } ) ,
548+ success : false ,
549+ type : $$responseChannel
550+ } )
553551
554552 resolve ( )
555553
556554 expect ( mockDriver . close ) . not . toHaveBeenCalled ( )
555+ expect ( mockSessionClose ) . not . toHaveBeenCalled ( )
557556 } catch ( e ) {
558557 reject ( e )
559558 }
@@ -596,13 +595,11 @@ describe('handleForcePasswordChangeEpic', () => {
596595 { database : 'system' }
597596 )
598597
599- expect ( currentAction ) . toEqual (
600- expect . objectContaining ( {
601- result : expect . anything ( ) ,
602- success : true ,
603- type : $$responseChannel
604- } )
605- )
598+ expect ( currentAction ) . toEqual ( {
599+ result : { meta : 'bolt://localhost:7687' } ,
600+ success : true ,
601+ type : $$responseChannel
602+ } )
606603
607604 resolve ( )
608605
@@ -625,10 +622,9 @@ describe('handleForcePasswordChangeEpic', () => {
625622
626623 test ( 'handleForcePasswordChangeEpic resolves with an error if cypher query fails' , ( ) => {
627624 // Given
625+ const message = 'A password must be at least 8 characters.'
628626 mockSessionExecuteWrite
629- . mockRejectedValueOnce (
630- new Error ( 'A password must be at least 8 characters.' )
631- )
627+ . mockRejectedValueOnce ( new Error ( message ) )
632628 . mockResolvedValue ( true )
633629
634630 const p = new Promise < void > ( ( resolve , reject ) => {
@@ -644,15 +640,13 @@ describe('handleForcePasswordChangeEpic', () => {
644640
645641 expect ( executePasswordResetQuerySpy ) . toHaveBeenCalledTimes ( 1 )
646642
647- expect ( currentAction ) . toEqual (
648- expect . objectContaining ( {
649- error : expect . objectContaining ( {
650- message : 'A password must be at least 8 characters.'
651- } ) ,
652- success : false ,
653- type : $$responseChannel
654- } )
655- )
643+ expect ( currentAction ) . toEqual ( {
644+ error : expect . objectContaining ( {
645+ message
646+ } ) ,
647+ success : false ,
648+ type : $$responseChannel
649+ } )
656650
657651 resolve ( )
658652
@@ -702,13 +696,11 @@ describe('handleForcePasswordChangeEpic', () => {
702696 undefined
703697 )
704698
705- expect ( currentAction ) . toEqual (
706- expect . objectContaining ( {
707- result : expect . anything ( ) ,
708- success : true ,
709- type : $$responseChannel
710- } )
711- )
699+ expect ( currentAction ) . toEqual ( {
700+ result : { meta : 'bolt://localhost:7687' } ,
701+ success : true ,
702+ type : $$responseChannel
703+ } )
712704
713705 resolve ( )
714706
@@ -731,9 +723,10 @@ describe('handleForcePasswordChangeEpic', () => {
731723
732724 test ( 'handleForcePasswordChangeEpic resolves with an error if dbms function call fails' , ( ) => {
733725 // Given
726+ const message = 'A password must be at least 8 characters.'
734727 mockSessionExecuteWrite
735728 . mockRejectedValueOnce ( new MultiDatabaseNotSupportedError ( ) )
736- . mockRejectedValue ( new Error ( 'A password must be at least 8 characters.' ) )
729+ . mockRejectedValue ( new Error ( message ) )
737730
738731 const p = new Promise < void > ( ( resolve , reject ) => {
739732 bus . take ( $$responseChannel , currentAction => {
@@ -748,15 +741,13 @@ describe('handleForcePasswordChangeEpic', () => {
748741
749742 expect ( executePasswordResetQuerySpy ) . toHaveBeenCalledTimes ( 2 )
750743
751- expect ( currentAction ) . toEqual (
752- expect . objectContaining ( {
753- error : expect . objectContaining ( {
754- message : 'A password must be at least 8 characters.'
755- } ) ,
756- success : false ,
757- type : $$responseChannel
758- } )
759- )
744+ expect ( currentAction ) . toEqual ( {
745+ error : expect . objectContaining ( {
746+ message
747+ } ) ,
748+ success : false ,
749+ type : $$responseChannel
750+ } )
760751
761752 resolve ( )
762753
0 commit comments