@alphapoint/apex-web 5.5.6 → 5.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (51) hide show
  1. package/lib/components/2FA/TwoFactorAuthContainer.js +58 -24
  2. package/lib/components/2FA/TwoFactorAuthContainer.test.js +215 -0
  3. package/lib/components/AccountsDropdown/AccountsDropdownComponent.css +6 -0
  4. package/lib/components/AccountsDropdown/AccountsDropdownComponent.js +6 -2
  5. package/lib/components/AccountsDropdown/AccountsDropdownComponent.test.js +43 -0
  6. package/lib/components/AccountsDropdown/AccountsDropdownContainer.js +3 -1
  7. package/lib/components/BalancesList/BalancesListContainer.js +4 -1
  8. package/lib/components/DigitalAssets/digitalAssetsPriceLabel.test.js +238 -0
  9. package/lib/components/EnableTwoFactorAuth/EnableTwoFactorAuthComponent.js +7 -0
  10. package/lib/components/EnableTwoFactorAuth/EnableTwoFactorAuthComponent.test.js +105 -0
  11. package/lib/components/EnableTwoFactorAuth/EnableTwoFactorAuthContainerFactory.js +12 -1
  12. package/lib/components/InstrumentPositions/InstrumentPositionsContainer.js +4 -1
  13. package/lib/components/MarginBalances/MarginDepositWithdraw/MarginDepositModal/MarginDepositFormContainer.js +2 -1
  14. package/lib/components/NoAccountBanner/NoAccountBanner.css +9 -0
  15. package/lib/components/NoAccountBanner/NoAccountBanner.js +58 -0
  16. package/lib/components/NoAccountBanner/index.js +16 -0
  17. package/lib/components/NoAccountPlaceholder/NoAccountPlaceholder.css +31 -0
  18. package/lib/components/NoAccountPlaceholder/NoAccountPlaceholder.js +33 -0
  19. package/lib/components/NoAccountPlaceholder/index.js +9 -0
  20. package/lib/components/Settings/ProfileAndSecurity/TwoFactorAuthSettingsCard/EnableTwoFactorAuth/EnableTwoFactorAuthComponent.js +12 -4
  21. package/lib/components/Settings/ProfileAndSecurity/TwoFactorAuthSettingsCard/EnableTwoFactorAuth/EnableTwoFactorAuthComponent.test.js +246 -0
  22. package/lib/components/common/ErrorBoundary/ErrorBoundary.css +35 -0
  23. package/lib/components/common/ErrorBoundary/ErrorBoundary.js +87 -0
  24. package/lib/helpers/errorTextFormatter.js +13 -4
  25. package/lib/helpers/errorTextFormatter.test.js +26 -0
  26. package/lib/helpers/twoFactorAuthCancellation.js +38 -0
  27. package/lib/hocs/forAccount.js +33 -0
  28. package/lib/hocs/forAccount.test.js +50 -0
  29. package/lib/hocs/forVerified.js +16 -2
  30. package/lib/hocs/withAuthentication.js +3 -1
  31. package/lib/index.js +3 -2
  32. package/lib/layouts/HeaderLayout/HeaderLayout.js +2 -1
  33. package/lib/layouts/WalletsLayout/WalletsLayoutContainer.js +3 -1
  34. package/lib/layouts/WalletsLayout/WalletsLayoutContainer.test.js +84 -0
  35. package/lib/redux/actions/apiActions.js +25 -8
  36. package/lib/redux/actions/apiActions.test.js +98 -0
  37. package/lib/redux/actions/interestAccountActions.js +12 -3
  38. package/lib/redux/actions/interestAccountActions.test.js +73 -0
  39. package/lib/redux/actions/orderHistoryActions.js +11 -4
  40. package/lib/redux/actions/userActions.js +97 -34
  41. package/lib/redux/actions/userActions.test.js +303 -188
  42. package/lib/redux/actions/withdrawActions.js +62 -29
  43. package/lib/redux/actions/withdrawActions.test.js +246 -73
  44. package/lib/redux/actions/withdrawActions.travelRule.test.js +17 -3
  45. package/lib/redux/reducers/userReducer.js +10 -0
  46. package/lib/redux/reducers/userReducer.test.js +29 -0
  47. package/lib/redux/selectors/recentActivitySelector.js +8 -2
  48. package/lib/redux/selectors/recentActivitySelector.v2.test.js +33 -0
  49. package/lib/redux/selectors/userSelectors.js +6 -1
  50. package/lib/redux/selectors/userSelectors.test.js +28 -0
  51. package/package.json +4 -4
@@ -565,15 +565,17 @@ describe('userActions', function () {
565
565
  }
566
566
  };
567
567
  });
568
- it('should log an error when GetUserInfo fails', /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee() {
568
+ it('should log an error and mark accounts as loaded when GetUserInfo fails', /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee() {
569
569
  return _regenerator().w(function (_context) {
570
570
  while (1) switch (_context.n) {
571
571
  case 0:
572
572
  _apex["default"].connection.setRPCPromiseReturnValueForEndpoint('GetUserInfo', Promise.reject(new Error('fail')));
573
573
  _context.n = 1;
574
- return expect(actions.getUserInfo(99)(dispatchStub, getState)).rejects.toThrow();
574
+ return actions.getUserInfo(99)(dispatchStub, getState);
575
575
  case 1:
576
576
  expect(console.error).toHaveBeenCalledWith('getUserInfo action error', expect.anything());
577
+ expect(dispatchStub).toHaveBeenCalledWith(actions.accountsLoaded());
578
+ expect(_apex["default"].connection.RPCPromise).not.toHaveBeenCalledWith('GetOMSs', expect.anything());
577
579
  case 2:
578
580
  return _context.a(2);
579
581
  }
@@ -787,15 +789,81 @@ describe('userActions', function () {
787
789
  }
788
790
  }, _callee9);
789
791
  })));
792
+ it('should mark accounts as loaded after receiving them', /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee0() {
793
+ var types;
794
+ return _regenerator().w(function (_context0) {
795
+ while (1) switch (_context0.n) {
796
+ case 0:
797
+ _apex["default"].connection.setRPCPromiseReturnValueForEndpoint('GetUserAccounts', {
798
+ o: JSON.stringify([1])
799
+ });
800
+ _context0.n = 1;
801
+ return store.dispatch(actions.getUserAccounts(99));
802
+ case 1:
803
+ types = store.getActions().map(function (_ref11) {
804
+ var type = _ref11.type;
805
+ return type;
806
+ });
807
+ expect(types[types.length - 1]).toBe(actions.ACCOUNTS_LOADED);
808
+ expect(types.indexOf(actions.RECEIVE_ACCOUNT)).toBeLessThan(types.indexOf(actions.ACCOUNTS_LOADED));
809
+ case 2:
810
+ return _context0.a(2);
811
+ }
812
+ }, _callee0);
813
+ })));
814
+ it('should resolve with no accounts and mark them as loaded when GetUserAccounts returns an error payload', /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee1() {
815
+ var errorPayload, accounts;
816
+ return _regenerator().w(function (_context1) {
817
+ while (1) switch (_context1.n) {
818
+ case 0:
819
+ errorPayload = {
820
+ result: false,
821
+ errormsg: 'Not Authorized',
822
+ errorcode: 20
823
+ };
824
+ _apex["default"].connection.setRPCPromiseReturnValueForEndpoint('GetUserAccounts', {
825
+ o: JSON.stringify(errorPayload)
826
+ });
827
+ _context1.n = 1;
828
+ return store.dispatch(actions.getUserAccounts(99));
829
+ case 1:
830
+ accounts = _context1.v;
831
+ expect(accounts).toEqual([]);
832
+ expect(console.error).toHaveBeenCalledWith('GetUserAccounts did not return an array', errorPayload);
833
+ expect(_apex["default"].connection.RPCPromise).not.toHaveBeenCalledWith('GetAccountInfo', expect.anything());
834
+ expect(store.getActions()).toEqual([actions.accountsLoaded()]);
835
+ case 2:
836
+ return _context1.a(2);
837
+ }
838
+ }, _callee1);
839
+ })));
840
+ it('should resolve with no accounts and mark them as loaded when GetUserAccounts rejects', /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee10() {
841
+ var accounts;
842
+ return _regenerator().w(function (_context10) {
843
+ while (1) switch (_context10.n) {
844
+ case 0:
845
+ _apex["default"].connection.setRPCPromiseReturnValueForEndpoint('GetUserAccounts', Promise.reject(new Error('fail')));
846
+ _context10.n = 1;
847
+ return store.dispatch(actions.getUserAccounts(99));
848
+ case 1:
849
+ accounts = _context10.v;
850
+ expect(accounts).toEqual([]);
851
+ expect(console.error).toHaveBeenCalledWith('getUserAccounts action error', expect.anything());
852
+ expect(store.getActions()).toEqual([actions.accountsLoaded()]);
853
+ case 2:
854
+ return _context10.a(2);
855
+ }
856
+ }, _callee10);
857
+ })));
790
858
  });
791
859
  describe('selectAccount', function () {
792
- it('should dispatch expected thunks after select account if privateMarketData = false', /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee0() {
860
+ it('should dispatch expected thunks after select account if privateMarketData = false', /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee11() {
793
861
  var accountId, expectedActions;
794
- return _regenerator().w(function (_context0) {
795
- while (1) switch (_context0.n) {
862
+ return _regenerator().w(function (_context11) {
863
+ while (1) switch (_context11.n) {
796
864
  case 0:
797
865
  accountId = 1;
798
- _context0.n = 1;
866
+ _context11.n = 1;
799
867
  return store.dispatch(actions.selectAccount(1, 1));
800
868
  case 1:
801
869
  expectedActions = [{
@@ -811,18 +879,18 @@ describe('userActions', function () {
811
879
  expect(positionActions.getAccountPositions).toHaveBeenCalled();
812
880
  expect(positionActions.subscribeToAccountPositionEvents).toHaveBeenCalled();
813
881
  case 2:
814
- return _context0.a(2);
882
+ return _context11.a(2);
815
883
  }
816
- }, _callee0);
884
+ }, _callee11);
817
885
  })));
818
- it('should dispatch expected thunks after select account if privateMarketData = true', /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee1() {
886
+ it('should dispatch expected thunks after select account if privateMarketData = true', /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee12() {
819
887
  var accountId, expectedActions;
820
- return _regenerator().w(function (_context1) {
821
- while (1) switch (_context1.n) {
888
+ return _regenerator().w(function (_context12) {
889
+ while (1) switch (_context12.n) {
822
890
  case 0:
823
891
  _config["default"].setPrivateMarketData(true);
824
892
  accountId = 1;
825
- _context1.n = 1;
893
+ _context12.n = 1;
826
894
  return store.dispatch(actions.selectAccount(1, 1));
827
895
  case 1:
828
896
  expectedActions = [{
@@ -838,9 +906,9 @@ describe('userActions', function () {
838
906
  expect(positionActions.getAccountPositions).toHaveBeenCalled();
839
907
  expect(positionActions.subscribeToAccountPositionEvents).toHaveBeenCalled();
840
908
  case 2:
841
- return _context1.a(2);
909
+ return _context12.a(2);
842
910
  }
843
- }, _callee1);
911
+ }, _callee12);
844
912
  })));
845
913
  });
846
914
  describe('updateAccount', function () {
@@ -863,16 +931,16 @@ describe('userActions', function () {
863
931
  }
864
932
  });
865
933
  });
866
- it('should call UpdateAccount from apex', /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee10() {
867
- return _regenerator().w(function (_context10) {
868
- while (1) switch (_context10.n) {
934
+ it('should call UpdateAccount from apex', /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee13() {
935
+ return _regenerator().w(function (_context13) {
936
+ while (1) switch (_context13.n) {
869
937
  case 0:
870
938
  _apex["default"].connection.setRPCPromiseReturnValueForEndpoint('UpdateAccount', {
871
939
  o: JSON.stringify({
872
940
  result: false
873
941
  })
874
942
  });
875
- _context10.n = 1;
943
+ _context13.n = 1;
876
944
  return store.dispatch(actions.updateAccount());
877
945
  case 1:
878
946
  expect(_apex["default"].connection.RPCPromise).toHaveBeenCalledWith('UpdateAccount', {
@@ -881,14 +949,14 @@ describe('userActions', function () {
881
949
  LoyaltyProductId: 0
882
950
  });
883
951
  case 2:
884
- return _context10.a(2);
952
+ return _context13.a(2);
885
953
  }
886
- }, _callee10);
954
+ }, _callee13);
887
955
  })));
888
- it('should call UpdateAccount from apex with params if loyaltyProduct is passed', /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee11() {
956
+ it('should call UpdateAccount from apex with params if loyaltyProduct is passed', /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee14() {
889
957
  var loyaltyProduct;
890
- return _regenerator().w(function (_context11) {
891
- while (1) switch (_context11.n) {
958
+ return _regenerator().w(function (_context14) {
959
+ while (1) switch (_context14.n) {
892
960
  case 0:
893
961
  _apex["default"].connection.setRPCPromiseReturnValueForEndpoint('UpdateAccount', {
894
962
  o: JSON.stringify({
@@ -899,7 +967,7 @@ describe('userActions', function () {
899
967
  ProductId: 2,
900
968
  Amount: 1
901
969
  };
902
- _context11.n = 1;
970
+ _context14.n = 1;
903
971
  return store.dispatch(actions.updateAccount(loyaltyProduct));
904
972
  case 1:
905
973
  expect(_apex["default"].connection.RPCPromise).toHaveBeenCalledWith('UpdateAccount', {
@@ -908,14 +976,14 @@ describe('userActions', function () {
908
976
  LoyaltyProductId: 2
909
977
  });
910
978
  case 2:
911
- return _context11.a(2);
979
+ return _context14.a(2);
912
980
  }
913
- }, _callee11);
981
+ }, _callee14);
914
982
  })));
915
- it('should call UpdateAccount from apex with params if loyaltyProduct is passed and Amount === 0', /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee12() {
983
+ it('should call UpdateAccount from apex with params if loyaltyProduct is passed and Amount === 0', /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee15() {
916
984
  var loyaltyProduct;
917
- return _regenerator().w(function (_context12) {
918
- while (1) switch (_context12.n) {
985
+ return _regenerator().w(function (_context15) {
986
+ while (1) switch (_context15.n) {
919
987
  case 0:
920
988
  _apex["default"].connection.setRPCPromiseReturnValueForEndpoint('UpdateAccount', {
921
989
  o: JSON.stringify({
@@ -926,7 +994,7 @@ describe('userActions', function () {
926
994
  ProductId: 2,
927
995
  Amount: 0
928
996
  };
929
- _context12.n = 1;
997
+ _context15.n = 1;
930
998
  return store.dispatch(actions.updateAccount(loyaltyProduct));
931
999
  case 1:
932
1000
  expect(_apex["default"].connection.RPCPromise).toHaveBeenCalledWith('UpdateAccount', {
@@ -935,13 +1003,13 @@ describe('userActions', function () {
935
1003
  LoyaltyProductId: 2
936
1004
  });
937
1005
  case 2:
938
- return _context12.a(2);
1006
+ return _context15.a(2);
939
1007
  }
940
- }, _callee12);
1008
+ }, _callee15);
941
1009
  })));
942
- it('should dispatch expected action if response result is true', /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee13() {
943
- return _regenerator().w(function (_context13) {
944
- while (1) switch (_context13.n) {
1010
+ it('should dispatch expected action if response result is true', /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee16() {
1011
+ return _regenerator().w(function (_context16) {
1012
+ while (1) switch (_context16.n) {
945
1013
  case 0:
946
1014
  _apex["default"].connection.setRPCPromiseReturnValueForEndpoint('UpdateAccount', {
947
1015
  o: JSON.stringify({
@@ -951,20 +1019,20 @@ describe('userActions', function () {
951
1019
  _apex["default"].connection.setRPCPromiseReturnValueForEndpoint('GetUserAccounts', {
952
1020
  o: JSON.stringify([])
953
1021
  });
954
- _context13.n = 1;
1022
+ _context16.n = 1;
955
1023
  return store.dispatch(actions.updateAccount());
956
1024
  case 1:
957
1025
  expect(_apex["default"].connection.RPCPromise).toHaveBeenCalledWith('GetUserAccounts', {
958
1026
  OMSId: 1
959
1027
  });
960
1028
  case 2:
961
- return _context13.a(2);
1029
+ return _context16.a(2);
962
1030
  }
963
- }, _callee13);
1031
+ }, _callee16);
964
1032
  })));
965
- it('should dispatch showSnack if response result is true', /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee14() {
966
- return _regenerator().w(function (_context14) {
967
- while (1) switch (_context14.n) {
1033
+ it('should dispatch showSnack if response result is true', /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee17() {
1034
+ return _regenerator().w(function (_context17) {
1035
+ while (1) switch (_context17.n) {
968
1036
  case 0:
969
1037
  _apex["default"].connection.setRPCPromiseReturnValueForEndpoint('UpdateAccount', {
970
1038
  o: JSON.stringify({
@@ -974,7 +1042,7 @@ describe('userActions', function () {
974
1042
  _apex["default"].connection.setRPCPromiseReturnValueForEndpoint('GetUserAccounts', {
975
1043
  o: JSON.stringify([])
976
1044
  });
977
- _context14.n = 1;
1045
+ _context17.n = 1;
978
1046
  return store.dispatch(actions.updateAccount());
979
1047
  case 1:
980
1048
  expect(snackbarActions.showSnack).toHaveBeenCalledWith({
@@ -983,14 +1051,14 @@ describe('userActions', function () {
983
1051
  type: 'success'
984
1052
  });
985
1053
  case 2:
986
- return _context14.a(2);
1054
+ return _context17.a(2);
987
1055
  }
988
- }, _callee14);
1056
+ }, _callee17);
989
1057
  })));
990
- it('should dispatch showSnack if response result is true and loyaltyProduct is passed', /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee15() {
1058
+ it('should dispatch showSnack if response result is true and loyaltyProduct is passed', /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee18() {
991
1059
  var loyaltyProduct;
992
- return _regenerator().w(function (_context15) {
993
- while (1) switch (_context15.n) {
1060
+ return _regenerator().w(function (_context18) {
1061
+ while (1) switch (_context18.n) {
994
1062
  case 0:
995
1063
  _apex["default"].connection.setRPCPromiseReturnValueForEndpoint('UpdateAccount', {
996
1064
  o: JSON.stringify({
@@ -1004,7 +1072,7 @@ describe('userActions', function () {
1004
1072
  ProductId: 2,
1005
1073
  Amount: 0
1006
1074
  };
1007
- _context15.n = 1;
1075
+ _context18.n = 1;
1008
1076
  return store.dispatch(actions.updateAccount(loyaltyProduct));
1009
1077
  case 1:
1010
1078
  expect(snackbarActions.showSnack).toHaveBeenCalledWith({
@@ -1013,37 +1081,37 @@ describe('userActions', function () {
1013
1081
  type: 'success'
1014
1082
  });
1015
1083
  case 2:
1016
- return _context15.a(2);
1084
+ return _context18.a(2);
1017
1085
  }
1018
- }, _callee15);
1086
+ }, _callee18);
1019
1087
  })));
1020
- it('should dispatch showSnack if response result is false', /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee16() {
1021
- return _regenerator().w(function (_context16) {
1022
- while (1) switch (_context16.n) {
1088
+ it('should dispatch showSnack if response result is false', /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee19() {
1089
+ return _regenerator().w(function (_context19) {
1090
+ while (1) switch (_context19.n) {
1023
1091
  case 0:
1024
1092
  _apex["default"].connection.setRPCPromiseReturnValueForEndpoint('UpdateAccount', {
1025
1093
  o: JSON.stringify({
1026
1094
  result: false
1027
1095
  })
1028
1096
  });
1029
- _context16.n = 1;
1097
+ _context19.n = 1;
1030
1098
  return store.dispatch(actions.updateAccount());
1031
1099
  case 1:
1032
1100
  expect(snackbarActions.showSnack).toHaveBeenCalled();
1033
1101
  case 2:
1034
- return _context16.a(2);
1102
+ return _context19.a(2);
1035
1103
  }
1036
- }, _callee16);
1104
+ }, _callee19);
1037
1105
  })));
1038
1106
  });
1039
1107
  describe('setUserInfo', function () {
1040
1108
  beforeEach(function () {
1041
1109
  _apex["default"].connection.resetRPCPromiseResponses();
1042
1110
  });
1043
- it('should call apex.connection.RPCPromise with SetUserInfo', /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee17() {
1111
+ it('should call apex.connection.RPCPromise with SetUserInfo', /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee20() {
1044
1112
  var user;
1045
- return _regenerator().w(function (_context17) {
1046
- while (1) switch (_context17.n) {
1113
+ return _regenerator().w(function (_context20) {
1114
+ while (1) switch (_context20.n) {
1047
1115
  case 0:
1048
1116
  user = {
1049
1117
  UserName: 'UserName',
@@ -1052,7 +1120,7 @@ describe('userActions', function () {
1052
1120
  _apex["default"].connection.setRPCPromiseReturnValueForEndpoint('SetUserInfo', {
1053
1121
  o: JSON.stringify({})
1054
1122
  });
1055
- _context17.n = 1;
1123
+ _context20.n = 1;
1056
1124
  return actions.setUserInfo(user)(dispatchStub);
1057
1125
  case 1:
1058
1126
  expect(_apex["default"].connection.RPCPromise).toHaveBeenCalledWith('SetUserInfo', {
@@ -1060,14 +1128,14 @@ describe('userActions', function () {
1060
1128
  Email: undefined
1061
1129
  });
1062
1130
  case 2:
1063
- return _context17.a(2);
1131
+ return _context20.a(2);
1064
1132
  }
1065
- }, _callee17);
1133
+ }, _callee20);
1066
1134
  })));
1067
- it('should dispatch expected actions after set user info', /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee18() {
1135
+ it('should dispatch expected actions after set user info', /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee21() {
1068
1136
  var userInfo, user, expectedActions;
1069
- return _regenerator().w(function (_context18) {
1070
- while (1) switch (_context18.n) {
1137
+ return _regenerator().w(function (_context21) {
1138
+ while (1) switch (_context21.n) {
1071
1139
  case 0:
1072
1140
  userInfo = {
1073
1141
  result: true
@@ -1083,19 +1151,19 @@ describe('userActions', function () {
1083
1151
  _apex["default"].connection.setRPCPromiseReturnValueForEndpoint('SetUserInfo', {
1084
1152
  o: JSON.stringify(userInfo)
1085
1153
  });
1086
- _context18.n = 1;
1154
+ _context21.n = 1;
1087
1155
  return store.dispatch(actions.setUserInfo(user));
1088
1156
  case 1:
1089
1157
  expect(store.getActions()).toEqual(expect.arrayContaining(expectedActions));
1090
1158
  case 2:
1091
- return _context18.a(2);
1159
+ return _context21.a(2);
1092
1160
  }
1093
- }, _callee18);
1161
+ }, _callee21);
1094
1162
  })));
1095
- it('should dispatch expected actions after failed set user info', /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee19() {
1163
+ it('should dispatch expected actions after failed set user info', /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee22() {
1096
1164
  var userInfo, user;
1097
- return _regenerator().w(function (_context19) {
1098
- while (1) switch (_context19.n) {
1165
+ return _regenerator().w(function (_context22) {
1166
+ while (1) switch (_context22.n) {
1099
1167
  case 0:
1100
1168
  userInfo = {
1101
1169
  result: false
@@ -1107,14 +1175,14 @@ describe('userActions', function () {
1107
1175
  _apex["default"].connection.setRPCPromiseReturnValueForEndpoint('SetUserInfo', {
1108
1176
  o: JSON.stringify(userInfo)
1109
1177
  });
1110
- _context19.n = 1;
1178
+ _context22.n = 1;
1111
1179
  return store.dispatch(actions.setUserInfo(user));
1112
1180
  case 1:
1113
1181
  expect(snackbarActions.showSnack).toHaveBeenCalled();
1114
1182
  case 2:
1115
- return _context19.a(2);
1183
+ return _context22.a(2);
1116
1184
  }
1117
- }, _callee19);
1185
+ }, _callee22);
1118
1186
  })));
1119
1187
  });
1120
1188
  describe('setUserConfig', function () {
@@ -1127,16 +1195,16 @@ describe('userActions', function () {
1127
1195
  })
1128
1196
  });
1129
1197
  });
1130
- it('should call apex.connection.RPCPromise with SetUserConfig', /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee20() {
1131
- return _regenerator().w(function (_context20) {
1132
- while (1) switch (_context20.n) {
1198
+ it('should call apex.connection.RPCPromise with SetUserConfig', /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee23() {
1199
+ return _regenerator().w(function (_context23) {
1200
+ while (1) switch (_context23.n) {
1133
1201
  case 0:
1134
1202
  _apex["default"].connection.setRPCPromiseReturnValueForEndpoint('SetUserConfig', {
1135
1203
  o: JSON.stringify({
1136
1204
  result: false
1137
1205
  })
1138
1206
  });
1139
- _context20.n = 1;
1207
+ _context23.n = 1;
1140
1208
  return store.dispatch(actions.setUserConfig());
1141
1209
  case 1:
1142
1210
  expect(_apex["default"].connection.RPCPromise).toHaveBeenCalledWith('SetUserConfig', {
@@ -1145,23 +1213,23 @@ describe('userActions', function () {
1145
1213
  Config: undefined
1146
1214
  });
1147
1215
  case 2:
1148
- return _context20.a(2);
1216
+ return _context23.a(2);
1149
1217
  }
1150
- }, _callee20);
1218
+ }, _callee23);
1151
1219
  })));
1152
- it('should dispatch expected actions after set user config', /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee21() {
1153
- return _regenerator().w(function (_context21) {
1154
- while (1) switch (_context21.n) {
1220
+ it('should dispatch expected actions after set user config', /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee24() {
1221
+ return _regenerator().w(function (_context24) {
1222
+ while (1) switch (_context24.n) {
1155
1223
  case 0:
1156
1224
  _apex["default"].connection.setRPCPromiseReturnValueForEndpoint('SetUserConfig', {
1157
1225
  o: JSON.stringify({
1158
1226
  result: true
1159
1227
  })
1160
1228
  });
1161
- _context21.n = 1;
1229
+ _context24.n = 1;
1162
1230
  return store.dispatch(actions.setUserConfig());
1163
1231
  case 1:
1164
- return _context21.a(2, new Promise(function (resolve, reject) {
1232
+ return _context24.a(2, new Promise(function (resolve, reject) {
1165
1233
  setTimeout(function () {
1166
1234
  try {
1167
1235
  expect(store.getActions()).toEqual([{
@@ -1177,32 +1245,32 @@ describe('userActions', function () {
1177
1245
  }, 0);
1178
1246
  }));
1179
1247
  }
1180
- }, _callee21);
1248
+ }, _callee24);
1181
1249
  })));
1182
- it('should dispatch expected actions after failed set user config', /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee22() {
1183
- return _regenerator().w(function (_context22) {
1184
- while (1) switch (_context22.n) {
1250
+ it('should dispatch expected actions after failed set user config', /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee25() {
1251
+ return _regenerator().w(function (_context25) {
1252
+ while (1) switch (_context25.n) {
1185
1253
  case 0:
1186
1254
  _apex["default"].connection.setRPCPromiseReturnValueForEndpoint('SetUserConfig', {
1187
1255
  o: JSON.stringify({
1188
1256
  result: false
1189
1257
  })
1190
1258
  });
1191
- _context22.n = 1;
1259
+ _context25.n = 1;
1192
1260
  return store.dispatch(actions.setUserConfig());
1193
1261
  case 1:
1194
1262
  expect(snackbarActions.showSnack).toHaveBeenCalled();
1195
1263
  case 2:
1196
- return _context22.a(2);
1264
+ return _context25.a(2);
1197
1265
  }
1198
- }, _callee22);
1266
+ }, _callee25);
1199
1267
  })));
1200
1268
  });
1201
1269
  describe('enable2FA', function () {
1202
- it('should call apex.connection.Authenticate2FA', /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee23() {
1270
+ it('should call apex.connection.Authenticate2FA', /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee26() {
1203
1271
  var getState;
1204
- return _regenerator().w(function (_context23) {
1205
- while (1) switch (_context23.n) {
1272
+ return _regenerator().w(function (_context26) {
1273
+ while (1) switch (_context26.n) {
1206
1274
  case 0:
1207
1275
  _apex["default"].connection.setResponse({
1208
1276
  Authenticated: true
@@ -1216,23 +1284,23 @@ describe('userActions', function () {
1216
1284
  }
1217
1285
  };
1218
1286
  });
1219
- _context23.n = 1;
1287
+ _context26.n = 1;
1220
1288
  return actions.enable2FA()(dispatchStub, getState);
1221
1289
  case 1:
1222
1290
  expect(_apex["default"].connection.Authenticate2FA).toHaveBeenCalled();
1223
1291
  case 2:
1224
- return _context23.a(2);
1292
+ return _context26.a(2);
1225
1293
  }
1226
- }, _callee23);
1294
+ }, _callee26);
1227
1295
  })));
1228
- it('should dispatch expected actions after enable2FA', /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee24() {
1229
- return _regenerator().w(function (_context24) {
1230
- while (1) switch (_context24.n) {
1296
+ it('should dispatch expected actions after enable2FA', /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee27() {
1297
+ return _regenerator().w(function (_context27) {
1298
+ while (1) switch (_context27.n) {
1231
1299
  case 0:
1232
1300
  _apex["default"].connection.setResponse({
1233
1301
  Authenticated: true
1234
1302
  });
1235
- _context24.n = 1;
1303
+ _context27.n = 1;
1236
1304
  return store.dispatch(actions.enable2FA());
1237
1305
  case 1:
1238
1306
  expect(store.getActions()).toContainEqual({
@@ -1247,32 +1315,32 @@ describe('userActions', function () {
1247
1315
  });
1248
1316
  expect(snackbarActions.showSnack).toHaveBeenCalled();
1249
1317
  case 2:
1250
- return _context24.a(2);
1318
+ return _context27.a(2);
1251
1319
  }
1252
- }, _callee24);
1320
+ }, _callee27);
1253
1321
  })));
1254
- it('should dispatch expected actions after failed enable2FA', /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee25() {
1255
- return _regenerator().w(function (_context25) {
1256
- while (1) switch (_context25.n) {
1322
+ it('should dispatch expected actions after failed enable2FA', /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee28() {
1323
+ return _regenerator().w(function (_context28) {
1324
+ while (1) switch (_context28.n) {
1257
1325
  case 0:
1258
1326
  _apex["default"].connection.setResponse({
1259
1327
  Authenticated: false
1260
1328
  });
1261
- _context25.n = 1;
1329
+ _context28.n = 1;
1262
1330
  return store.dispatch(actions.enable2FA());
1263
1331
  case 1:
1264
1332
  expect(snackbarActions.showSnack).toHaveBeenCalled();
1265
1333
  case 2:
1266
- return _context25.a(2);
1334
+ return _context28.a(2);
1267
1335
  }
1268
- }, _callee25);
1336
+ }, _callee28);
1269
1337
  })));
1270
1338
  });
1271
1339
  describe('disable2FA', function () {
1272
- it('should call apex.connection.Disable2FA andapex.connection.Authenticate2FA', /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee26() {
1340
+ it('should call apex.connection.Disable2FA andapex.connection.Authenticate2FA', /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee29() {
1273
1341
  var getState;
1274
- return _regenerator().w(function (_context26) {
1275
- while (1) switch (_context26.n) {
1342
+ return _regenerator().w(function (_context29) {
1343
+ while (1) switch (_context29.n) {
1276
1344
  case 0:
1277
1345
  getState = jest.fn(function () {
1278
1346
  return {
@@ -1289,7 +1357,7 @@ describe('userActions', function () {
1289
1357
  Authenticated: true
1290
1358
  })
1291
1359
  }));
1292
- _context26.n = 1;
1360
+ _context29.n = 1;
1293
1361
  return actions.disable2FA()(dispatchStub, getState);
1294
1362
  case 1:
1295
1363
  expect(_apex["default"].connection.Disable2FA).toHaveBeenCalled();
@@ -1297,20 +1365,20 @@ describe('userActions', function () {
1297
1365
  Code: undefined
1298
1366
  });
1299
1367
  case 2:
1300
- return _context26.a(2);
1368
+ return _context29.a(2);
1301
1369
  }
1302
- }, _callee26);
1370
+ }, _callee29);
1303
1371
  })));
1304
- it('should dispatch expected actions after disable2FA', /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee27() {
1305
- return _regenerator().w(function (_context27) {
1306
- while (1) switch (_context27.n) {
1372
+ it('should dispatch expected actions after disable2FA', /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee30() {
1373
+ return _regenerator().w(function (_context30) {
1374
+ while (1) switch (_context30.n) {
1307
1375
  case 0:
1308
1376
  _apex["default"].connection.setRPCPromiseReturnValue(Promise.resolve({
1309
1377
  o: JSON.stringify({
1310
1378
  Authenticated: true
1311
1379
  })
1312
1380
  }));
1313
- _context27.n = 1;
1381
+ _context30.n = 1;
1314
1382
  return store.dispatch(actions.disable2FA());
1315
1383
  case 1:
1316
1384
  expect(store.getActions()).toContainEqual({
@@ -1322,51 +1390,51 @@ describe('userActions', function () {
1322
1390
  expect(_modalActions.closeModal).toHaveBeenCalledWith(_modalActions.MODAL_TYPES.DISABLE_2FA);
1323
1391
  expect(snackbarActions.showSnack).toHaveBeenCalled();
1324
1392
  case 2:
1325
- return _context27.a(2);
1393
+ return _context30.a(2);
1326
1394
  }
1327
- }, _callee27);
1395
+ }, _callee30);
1328
1396
  })));
1329
- it('should dispatch expected actions after failed disable2FA', /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee28() {
1330
- return _regenerator().w(function (_context28) {
1331
- while (1) switch (_context28.n) {
1397
+ it('should dispatch expected actions after failed disable2FA', /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee31() {
1398
+ return _regenerator().w(function (_context31) {
1399
+ while (1) switch (_context31.n) {
1332
1400
  case 0:
1333
1401
  _apex["default"].connection.setRPCPromiseReturnValue(Promise.resolve({
1334
1402
  o: JSON.stringify({
1335
1403
  Authenticated: false
1336
1404
  })
1337
1405
  }));
1338
- _context28.n = 1;
1406
+ _context31.n = 1;
1339
1407
  return store.dispatch(actions.disable2FA());
1340
1408
  case 1:
1341
1409
  expect(snackbarActions.showSnack).toHaveBeenCalled();
1342
1410
  case 2:
1343
- return _context28.a(2);
1411
+ return _context31.a(2);
1344
1412
  }
1345
- }, _callee28);
1413
+ }, _callee31);
1346
1414
  })));
1347
1415
  });
1348
1416
  describe('getGoogleQrCode', function () {
1349
- it('should call apex.connection.EnableGoogle2FA', /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee29() {
1350
- return _regenerator().w(function (_context29) {
1351
- while (1) switch (_context29.n) {
1417
+ it('should call apex.connection.EnableGoogle2FA', /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee32() {
1418
+ return _regenerator().w(function (_context32) {
1419
+ while (1) switch (_context32.n) {
1352
1420
  case 0:
1353
- _context29.n = 1;
1421
+ _context32.n = 1;
1354
1422
  return actions.getGoogleQrCode()(dispatchStub);
1355
1423
  case 1:
1356
1424
  expect(_apex["default"].connection.EnableGoogle2FA).toHaveBeenCalled();
1357
1425
  case 2:
1358
- return _context29.a(2);
1426
+ return _context32.a(2);
1359
1427
  }
1360
- }, _callee29);
1428
+ }, _callee32);
1361
1429
  })));
1362
- it('should dispatch expected actions after getGoogleQrCode', /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee30() {
1363
- return _regenerator().w(function (_context30) {
1364
- while (1) switch (_context30.n) {
1430
+ it('should dispatch expected actions after getGoogleQrCode', /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee33() {
1431
+ return _regenerator().w(function (_context33) {
1432
+ while (1) switch (_context33.n) {
1365
1433
  case 0:
1366
1434
  _apex["default"].connection.setResponse({
1367
1435
  qrCode: 1234
1368
1436
  });
1369
- _context30.n = 1;
1437
+ _context33.n = 1;
1370
1438
  return store.dispatch(actions.getGoogleQrCode());
1371
1439
  case 1:
1372
1440
  expect(store.getActions()).toEqual([{
@@ -1376,16 +1444,63 @@ describe('userActions', function () {
1376
1444
  }
1377
1445
  }]);
1378
1446
  case 2:
1379
- return _context30.a(2);
1447
+ return _context33.a(2);
1380
1448
  }
1381
- }, _callee30);
1449
+ }, _callee33);
1450
+ })));
1451
+ it('resolves true when the gateway issues a QR code', /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee34() {
1452
+ var enrolled;
1453
+ return _regenerator().w(function (_context34) {
1454
+ while (1) switch (_context34.n) {
1455
+ case 0:
1456
+ _apex["default"].connection.setResponse({
1457
+ GoogleQRCode: 'otpauth://totp/x'
1458
+ });
1459
+ _context34.n = 1;
1460
+ return store.dispatch(actions.getGoogleQrCode());
1461
+ case 1:
1462
+ enrolled = _context34.v;
1463
+ expect(enrolled).toBe(true);
1464
+ case 2:
1465
+ return _context34.a(2);
1466
+ }
1467
+ }, _callee34);
1468
+ })));
1469
+ it('shows the gateway refusal, stores no QR code and resolves false', /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee35() {
1470
+ var errormsg, enrolled;
1471
+ return _regenerator().w(function (_context35) {
1472
+ while (1) switch (_context35.n) {
1473
+ case 0:
1474
+ errormsg = 'Two-factor authentication for this account is managed by your single sign-on provider.';
1475
+ _apex["default"].connection.setResponse({
1476
+ result: false,
1477
+ errormsg: errormsg,
1478
+ errorcode: 104
1479
+ });
1480
+ _context35.n = 1;
1481
+ return store.dispatch(actions.getGoogleQrCode());
1482
+ case 1:
1483
+ enrolled = _context35.v;
1484
+ expect(enrolled).toBe(false);
1485
+ expect(snackbarActions.showSnack).toHaveBeenCalledWith({
1486
+ id: 'ENABLE_2FA_ERROR',
1487
+ text: "104: ".concat(errormsg),
1488
+ type: 'warning'
1489
+ });
1490
+ expect(store.getActions()).not.toContainEqual(expect.objectContaining({
1491
+ type: actions.SET_GOOGLE_QRCODE
1492
+ }));
1493
+ case 2:
1494
+ return _context35.a(2);
1495
+ }
1496
+ }, _callee35);
1382
1497
  })));
1383
1498
  });
1384
1499
  describe('getGoogle2FARecoveryCode', function () {
1385
- it('should return recovery code', /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee31() {
1500
+ it('should return recovery code', /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee36() {
1386
1501
  var code;
1387
- return _regenerator().w(function (_context31) {
1388
- while (1) switch (_context31.n) {
1502
+ return _regenerator().w(function (_context36) {
1503
+ while (1) switch (_context36.n) {
1389
1504
  case 0:
1390
1505
  code = 123212;
1391
1506
  _apex["default"].connection.setRPCPromiseReturnValue(Promise.resolve({
@@ -1393,21 +1508,21 @@ describe('userActions', function () {
1393
1508
  Authenticated: true
1394
1509
  })
1395
1510
  }));
1396
- _context31.n = 1;
1511
+ _context36.n = 1;
1397
1512
  return actions.getGoogle2FARecoveryCode(code)(dispatchStub);
1398
1513
  case 1:
1399
1514
  expect(_apex["default"].connection.RPCPromise).toHaveBeenCalledWith('GetGoogle2FARecoveryKey', {
1400
1515
  Code: code
1401
1516
  });
1402
1517
  case 2:
1403
- return _context31.a(2);
1518
+ return _context36.a(2);
1404
1519
  }
1405
- }, _callee31);
1520
+ }, _callee36);
1406
1521
  })));
1407
- it('should dispatch `showSnack` with warning if `Authenticated` = false', /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee32() {
1522
+ it('should dispatch `showSnack` with warning if `Authenticated` = false', /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee37() {
1408
1523
  var code, errormsg;
1409
- return _regenerator().w(function (_context32) {
1410
- while (1) switch (_context32.n) {
1524
+ return _regenerator().w(function (_context37) {
1525
+ while (1) switch (_context37.n) {
1411
1526
  case 0:
1412
1527
  code = 123212;
1413
1528
  errormsg = 'False';
@@ -1417,7 +1532,7 @@ describe('userActions', function () {
1417
1532
  errormsg: errormsg
1418
1533
  })
1419
1534
  }));
1420
- _context32.n = 1;
1535
+ _context37.n = 1;
1421
1536
  return actions.getGoogle2FARecoveryCode(code)(dispatchStub);
1422
1537
  case 1:
1423
1538
  expect(snackbarActions.showSnack).toHaveBeenCalledWith({
@@ -1426,14 +1541,14 @@ describe('userActions', function () {
1426
1541
  type: 'warning'
1427
1542
  });
1428
1543
  case 2:
1429
- return _context32.a(2);
1544
+ return _context37.a(2);
1430
1545
  }
1431
- }, _callee32);
1546
+ }, _callee37);
1432
1547
  })));
1433
- it('should dispatch `change` with code if `Authenticated` = true', /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee33() {
1548
+ it('should dispatch `change` with code if `Authenticated` = true', /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee38() {
1434
1549
  var code, RecoveryKey;
1435
- return _regenerator().w(function (_context33) {
1436
- while (1) switch (_context33.n) {
1550
+ return _regenerator().w(function (_context38) {
1551
+ while (1) switch (_context38.n) {
1437
1552
  case 0:
1438
1553
  code = 123212;
1439
1554
  RecoveryKey = 123123;
@@ -1443,14 +1558,14 @@ describe('userActions', function () {
1443
1558
  RecoveryKey: RecoveryKey
1444
1559
  })
1445
1560
  }));
1446
- _context33.n = 1;
1561
+ _context38.n = 1;
1447
1562
  return actions.getGoogle2FARecoveryCode(code)(dispatchStub);
1448
1563
  case 1:
1449
1564
  expect(_reduxForm.change).toHaveBeenCalledWith('google2FARecoveryKeyModal', 'recoveryKey', RecoveryKey);
1450
1565
  case 2:
1451
- return _context33.a(2);
1566
+ return _context38.a(2);
1452
1567
  }
1453
- }, _callee33);
1568
+ }, _callee38);
1454
1569
  })));
1455
1570
  });
1456
1571
  describe('updateUserConfig', function () {
@@ -1547,41 +1662,41 @@ describe('userActions', function () {
1547
1662
  beforeEach(function () {
1548
1663
  jest.clearAllMocks();
1549
1664
  });
1550
- it('should dispatch `sendResetPasswordEmail` and showSnack if response result is true', /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee34() {
1551
- return _regenerator().w(function (_context34) {
1552
- while (1) switch (_context34.n) {
1665
+ it('should dispatch `sendResetPasswordEmail` and showSnack if response result is true', /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee39() {
1666
+ return _regenerator().w(function (_context39) {
1667
+ while (1) switch (_context39.n) {
1553
1668
  case 0:
1554
1669
  _apex["default"].connection.setRPCPromiseReturnValueForEndpoint('ResetPassword', {
1555
1670
  o: JSON.stringify({
1556
1671
  result: true
1557
1672
  })
1558
1673
  });
1559
- _context34.n = 1;
1674
+ _context39.n = 1;
1560
1675
  return store.dispatch(actions.sendResetPasswordEmail());
1561
1676
  case 1:
1562
1677
  expect(snackbarActions.showSnack).toHaveBeenCalled();
1563
1678
  case 2:
1564
- return _context34.a(2);
1679
+ return _context39.a(2);
1565
1680
  }
1566
- }, _callee34);
1681
+ }, _callee39);
1567
1682
  })));
1568
- it('should dispatch `sendResetPasswordEmail` and showSnack if response result is false', /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee35() {
1569
- return _regenerator().w(function (_context35) {
1570
- while (1) switch (_context35.n) {
1683
+ it('should dispatch `sendResetPasswordEmail` and showSnack if response result is false', /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee40() {
1684
+ return _regenerator().w(function (_context40) {
1685
+ while (1) switch (_context40.n) {
1571
1686
  case 0:
1572
1687
  _apex["default"].connection.setRPCPromiseReturnValueForEndpoint('ResetPassword', {
1573
1688
  o: JSON.stringify({
1574
1689
  result: false
1575
1690
  })
1576
1691
  });
1577
- _context35.n = 1;
1692
+ _context40.n = 1;
1578
1693
  return store.dispatch(actions.sendResetPasswordEmail());
1579
1694
  case 1:
1580
1695
  expect(snackbarActions.showSnack).toHaveBeenCalled();
1581
1696
  case 2:
1582
- return _context35.a(2);
1697
+ return _context40.a(2);
1583
1698
  }
1584
- }, _callee35);
1699
+ }, _callee40);
1585
1700
  })));
1586
1701
  });
1587
1702
  describe('resendVerificationEmail', function () {
@@ -1590,46 +1705,46 @@ describe('userActions', function () {
1590
1705
  jest.clearAllMocks();
1591
1706
  store = mockStore({});
1592
1707
  });
1593
- it('should dispatch showSnack if response result is true', /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee36() {
1594
- return _regenerator().w(function (_context36) {
1595
- while (1) switch (_context36.n) {
1708
+ it('should dispatch showSnack if response result is true', /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee41() {
1709
+ return _regenerator().w(function (_context41) {
1710
+ while (1) switch (_context41.n) {
1596
1711
  case 0:
1597
1712
  _apex["default"].connection.setResponse({
1598
1713
  result: true
1599
1714
  });
1600
- _context36.n = 1;
1715
+ _context41.n = 1;
1601
1716
  return store.dispatch(actions.resendVerificationEmail());
1602
1717
  case 1:
1603
1718
  expect(snackbarActions.showSnack).toHaveBeenCalled();
1604
1719
  case 2:
1605
- return _context36.a(2);
1720
+ return _context41.a(2);
1606
1721
  }
1607
- }, _callee36);
1722
+ }, _callee41);
1608
1723
  })));
1609
- it('should dispatch showSnack if response result is false', /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee37() {
1610
- return _regenerator().w(function (_context37) {
1611
- while (1) switch (_context37.n) {
1724
+ it('should dispatch showSnack if response result is false', /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee42() {
1725
+ return _regenerator().w(function (_context42) {
1726
+ while (1) switch (_context42.n) {
1612
1727
  case 0:
1613
1728
  _apex["default"].connection.setResponse({
1614
1729
  result: false
1615
1730
  });
1616
- _context37.n = 1;
1731
+ _context42.n = 1;
1617
1732
  return store.dispatch(actions.resendVerificationEmail());
1618
1733
  case 1:
1619
1734
  expect(snackbarActions.showSnack).toHaveBeenCalled();
1620
1735
  case 2:
1621
- return _context37.a(2);
1736
+ return _context42.a(2);
1622
1737
  }
1623
- }, _callee37);
1738
+ }, _callee42);
1624
1739
  })));
1625
- it('should dispatch showSnack if apex.connection is not include ResendVerificationEmail', /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee38() {
1740
+ it('should dispatch showSnack if apex.connection is not include ResendVerificationEmail', /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee43() {
1626
1741
  var _apex$connection, ResendVerificationEmail, connectionWithoutResendVerificationEmail;
1627
- return _regenerator().w(function (_context38) {
1628
- while (1) switch (_context38.n) {
1742
+ return _regenerator().w(function (_context43) {
1743
+ while (1) switch (_context43.n) {
1629
1744
  case 0:
1630
1745
  _apex$connection = _apex["default"].connection, ResendVerificationEmail = _apex$connection.ResendVerificationEmail, connectionWithoutResendVerificationEmail = _objectWithoutProperties(_apex$connection, _excluded);
1631
1746
  _apex["default"].connection = connectionWithoutResendVerificationEmail;
1632
- _context38.n = 1;
1747
+ _context43.n = 1;
1633
1748
  return store.dispatch(actions.resendVerificationEmail());
1634
1749
  case 1:
1635
1750
  expect(snackbarActions.showSnack).toHaveBeenCalled();
@@ -1637,9 +1752,9 @@ describe('userActions', function () {
1637
1752
  ResendVerificationEmail: ResendVerificationEmail
1638
1753
  });
1639
1754
  case 2:
1640
- return _context38.a(2);
1755
+ return _context43.a(2);
1641
1756
  }
1642
- }, _callee38);
1757
+ }, _callee43);
1643
1758
  })));
1644
1759
  });
1645
1760
  describe('goToResetPasswordFormStep', function () {