@@ -476,6 +476,7 @@ describe('handleForcePasswordChangeEpic', () => {
476
476
477
477
const $$responseChannel = 'test-channel'
478
478
const action = {
479
+ host : 'bolt://localhost:7687' ,
479
480
type : connections . FORCE_CHANGE_PASSWORD ,
480
481
password : 'changeme' ,
481
482
newPassword : 'password1' ,
@@ -524,9 +525,8 @@ describe('handleForcePasswordChangeEpic', () => {
524
525
525
526
test ( 'handleForcePasswordChangeEpic resolves with an error if directConnect fails' , ( ) => {
526
527
// 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 ) )
530
530
531
531
const p = new Promise < void > ( ( resolve , reject ) => {
532
532
bus . take ( $$responseChannel , currentAction => {
@@ -541,19 +541,18 @@ describe('handleForcePasswordChangeEpic', () => {
541
541
542
542
expect ( executePasswordResetQuerySpy ) . not . toHaveBeenCalled ( )
543
543
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
+ } )
553
551
554
552
resolve ( )
555
553
556
554
expect ( mockDriver . close ) . not . toHaveBeenCalled ( )
555
+ expect ( mockSessionClose ) . not . toHaveBeenCalled ( )
557
556
} catch ( e ) {
558
557
reject ( e )
559
558
}
@@ -596,13 +595,11 @@ describe('handleForcePasswordChangeEpic', () => {
596
595
{ database : 'system' }
597
596
)
598
597
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
+ } )
606
603
607
604
resolve ( )
608
605
@@ -625,10 +622,9 @@ describe('handleForcePasswordChangeEpic', () => {
625
622
626
623
test ( 'handleForcePasswordChangeEpic resolves with an error if cypher query fails' , ( ) => {
627
624
// Given
625
+ const message = 'A password must be at least 8 characters.'
628
626
mockSessionExecuteWrite
629
- . mockRejectedValueOnce (
630
- new Error ( 'A password must be at least 8 characters.' )
631
- )
627
+ . mockRejectedValueOnce ( new Error ( message ) )
632
628
. mockResolvedValue ( true )
633
629
634
630
const p = new Promise < void > ( ( resolve , reject ) => {
@@ -644,15 +640,13 @@ describe('handleForcePasswordChangeEpic', () => {
644
640
645
641
expect ( executePasswordResetQuerySpy ) . toHaveBeenCalledTimes ( 1 )
646
642
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
+ } )
656
650
657
651
resolve ( )
658
652
@@ -702,13 +696,11 @@ describe('handleForcePasswordChangeEpic', () => {
702
696
undefined
703
697
)
704
698
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
+ } )
712
704
713
705
resolve ( )
714
706
@@ -731,9 +723,10 @@ describe('handleForcePasswordChangeEpic', () => {
731
723
732
724
test ( 'handleForcePasswordChangeEpic resolves with an error if dbms function call fails' , ( ) => {
733
725
// Given
726
+ const message = 'A password must be at least 8 characters.'
734
727
mockSessionExecuteWrite
735
728
. mockRejectedValueOnce ( new MultiDatabaseNotSupportedError ( ) )
736
- . mockRejectedValue ( new Error ( 'A password must be at least 8 characters.' ) )
729
+ . mockRejectedValue ( new Error ( message ) )
737
730
738
731
const p = new Promise < void > ( ( resolve , reject ) => {
739
732
bus . take ( $$responseChannel , currentAction => {
@@ -748,15 +741,13 @@ describe('handleForcePasswordChangeEpic', () => {
748
741
749
742
expect ( executePasswordResetQuerySpy ) . toHaveBeenCalledTimes ( 2 )
750
743
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
+ } )
760
751
761
752
resolve ( )
762
753
0 commit comments