@alphapoint/apex-web 5.5.5 → 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.
- package/lib/App.js +30 -18
- package/lib/components/2FA/TwoFactorAuthContainer.js +58 -24
- package/lib/components/2FA/TwoFactorAuthContainer.test.js +215 -0
- package/lib/components/AccountsDropdown/AccountsDropdownComponent.css +6 -0
- package/lib/components/AccountsDropdown/AccountsDropdownComponent.js +6 -2
- package/lib/components/AccountsDropdown/AccountsDropdownComponent.test.js +43 -0
- package/lib/components/AccountsDropdown/AccountsDropdownContainer.js +3 -1
- package/lib/components/BalancesList/BalancesListContainer.js +4 -1
- package/lib/components/DepositSidePaneComponents/DepositFormComponent.js +2 -7
- package/lib/components/DigitalAssets/DigitalAssetsOfferingProfilePage.css +6 -3
- package/lib/components/DigitalAssets/DigitalAssetsOfferingProfilePage.js +2 -2
- package/lib/components/DigitalAssets/DigitalAssetsPage.js +1 -1
- package/lib/components/DigitalAssets/digitalAssetsPriceLabel.test.js +238 -0
- package/lib/components/EnableTwoFactorAuth/EnableTwoFactorAuthComponent.js +7 -0
- package/lib/components/EnableTwoFactorAuth/EnableTwoFactorAuthComponent.test.js +105 -0
- package/lib/components/EnableTwoFactorAuth/EnableTwoFactorAuthContainerFactory.js +12 -1
- package/lib/components/FusionAuth/ConfirmPendingWithdrawModal.js +60 -0
- package/lib/components/FusionAuth/FusionAuthCallbackComponent.js +66 -0
- package/lib/components/FusionAuth/FusionAuthCallbackContainer.js +24 -0
- package/lib/components/FusionAuth/FusionStepUpModal.js +63 -0
- package/lib/components/FusionAuth/LinkOAuthIdentityModal.css +6 -0
- package/lib/components/FusionAuth/LinkOAuthIdentityModal.js +65 -0
- package/lib/components/FuturesOrderBook/FuturesOrderBookContainer.js +6 -0
- package/lib/components/InstrumentPositions/InstrumentPositionsContainer.js +4 -1
- package/lib/components/KYC/kycLevelsVerificationPropsHelper.test.js +7 -8
- package/lib/components/Login/LoginFormComponent.js +15 -4
- package/lib/components/Login/LoginFormContainer.js +21 -26
- package/lib/components/MarginBalances/MarginDepositWithdraw/MarginDepositModal/MarginDepositFormContainer.js +2 -1
- package/lib/components/NoAccountBanner/NoAccountBanner.css +9 -0
- package/lib/components/NoAccountBanner/NoAccountBanner.js +58 -0
- package/lib/components/NoAccountBanner/index.js +16 -0
- package/lib/components/NoAccountPlaceholder/NoAccountPlaceholder.css +31 -0
- package/lib/components/NoAccountPlaceholder/NoAccountPlaceholder.js +33 -0
- package/lib/components/NoAccountPlaceholder/index.js +9 -0
- package/lib/components/OrderBookComponents/Level2DataTableComponent.js +4 -0
- package/lib/components/OrderBookComponents/OrderBookComponent.css +1 -0
- package/lib/components/OrderBookComponents/OrderBookComponent.js +7 -2
- package/lib/components/OrderBookComponents/OrderBookContainer.js +3 -1
- package/lib/components/OrderEntryComponents/defaultForm/BuySellTabs.js +11 -5
- package/lib/components/OrderEntryComponents/defaultForm/OrderEntryAnchoring.js +19 -3
- package/lib/components/OrderHistoryComponents/OpenOrders/OpenOrdersComponent.js +1 -1
- package/lib/components/OrderHistoryComponents/OpenOrders/OpenOrdersComponent.test.js +97 -73
- package/lib/components/PriceChart/TVChartComponent.js +47 -2
- package/lib/components/PriceChart/TVChartContainer.js +2 -1
- package/lib/components/Retail/RetailSidePanes/FiatDeposit/FiatDepositFormComponent.js +2 -6
- package/lib/components/Retail/RetailSidePanes/FiatWithdraw/FiatWithdrawFormComponent.js +2 -6
- package/lib/components/SendReceiveSidePane/ReceiveAddress/ReceiveAddressComponent.js +2 -6
- package/lib/components/SendReceiveSidePane/SendAddress/SendAddressComponent.js +2 -7
- package/lib/components/Settings/ProfileAndSecurity/ProfileSettingsCard/ProfileForm/ProfileFormComponent.js +3 -1
- package/lib/components/Settings/ProfileAndSecurity/ProfileSettingsCard/ProfileForm/SsoLinkRowComponent.css +10 -0
- package/lib/components/Settings/ProfileAndSecurity/ProfileSettingsCard/ProfileForm/SsoLinkRowComponent.js +77 -0
- package/lib/components/Settings/ProfileAndSecurity/TwoFactorAuthSettingsCard/EnableTwoFactorAuth/EnableTwoFactorAuthComponent.js +12 -4
- package/lib/components/Settings/ProfileAndSecurity/TwoFactorAuthSettingsCard/EnableTwoFactorAuth/EnableTwoFactorAuthComponent.test.js +246 -0
- package/lib/components/Signup/SignupFormComponent.js +10 -1
- package/lib/components/Theme/ThemeToggler/ThemeToggler.js +4 -1
- package/lib/components/WithdrawSidePaneComponents/WithdrawForm/WithdrawFormComponent.js +3 -8
- package/lib/components/common/APRecaptcha/APRecaptcha.css +33 -0
- package/lib/components/common/APRecaptcha/APRecaptcha.js +252 -0
- package/lib/components/common/APRecaptcha/index.js +22 -0
- package/lib/components/common/ErrorBoundary/ErrorBoundary.css +35 -0
- package/lib/components/common/ErrorBoundary/ErrorBoundary.js +87 -0
- package/lib/config/configDefault.json +9 -2
- package/lib/helpers/accountProviderHelper.js +28 -0
- package/lib/helpers/accountProviderHelper.test.js +67 -0
- package/lib/helpers/dateHelper.test.js +11 -5
- package/lib/helpers/destinationTagHelper.test.js +14 -5
- package/lib/helpers/errorTextFormatter.js +13 -4
- package/lib/helpers/errorTextFormatter.test.js +26 -0
- package/lib/helpers/formValidations.test.js +19 -3
- package/lib/helpers/fusionStepUp.js +79 -0
- package/lib/helpers/fusionStepUp.test.js +136 -0
- package/lib/helpers/homePageLayoutHelper.test.js +16 -2
- package/lib/helpers/numberFormatter/numberFormatter.js +3 -1
- package/lib/helpers/numberFormatter/numberFormatter.test.js +9 -2
- package/lib/helpers/orderHelper.test.js +59 -38
- package/lib/helpers/placeOrderHelper.js +9 -2
- package/lib/helpers/placeOrderHelper.test.js +43 -16
- package/lib/helpers/recalculateOrderHelper.test.js +49 -12
- package/lib/helpers/safeSessionStorage.js +36 -0
- package/lib/helpers/twoFactorAuthCancellation.js +38 -0
- package/lib/helpers/wsHelper.test.js +16 -7
- package/lib/hocs/forAccount.js +33 -0
- package/lib/hocs/forAccount.test.js +50 -0
- package/lib/hocs/forVerified.js +16 -2
- package/lib/hocs/withAuthentication.js +3 -1
- package/lib/index.js +3 -2
- package/lib/layouts/HeaderLayout/HeaderLayout.js +2 -1
- package/lib/layouts/WalletsLayout/WalletsLayoutContainer.js +3 -1
- package/lib/layouts/WalletsLayout/WalletsLayoutContainer.test.js +84 -0
- package/lib/redux/actions/affiliateActions.test.js +22 -27
- package/lib/redux/actions/apiActions.js +25 -8
- package/lib/redux/actions/apiActions.test.js +98 -0
- package/lib/redux/actions/apiKeyActions.test.js +29 -34
- package/lib/redux/actions/authActions.js +581 -48
- package/lib/redux/actions/authActions.test.js +140 -164
- package/lib/redux/actions/confirmWithdrawActions.js +7 -2
- package/lib/redux/actions/confirmWithdrawActions.test.js +83 -29
- package/lib/redux/actions/depositActions.test.js +267 -249
- package/lib/redux/actions/eotcActions.test.js +3 -0
- package/lib/redux/actions/eotcSettlementActions.test.js +3 -0
- package/lib/redux/actions/eotcWithdrawActions.test.js +3 -0
- package/lib/redux/actions/fusionAuthActions.test.js +717 -0
- package/lib/redux/actions/instrumentActions.test.js +560 -160
- package/lib/redux/actions/interestAccountActions.js +12 -3
- package/lib/{components/MarginBalances/MarginDepositWithdraw/MarginDepositWithdrawContainer.notest.js → redux/actions/interestAccountActions.test.js} +41 -51
- package/lib/redux/actions/kycIdentityMindActions.js +4 -4
- package/lib/redux/actions/kycIdentityMindActions.test.js +31 -13
- package/lib/redux/actions/kycJumioActions.test.js +16 -6
- package/lib/redux/actions/kycManualActions.test.js +16 -9
- package/lib/redux/actions/level1Actions.test.js +2 -2
- package/lib/redux/actions/level2Actions.test.js +51 -120
- package/lib/redux/actions/loyaltyFeeActions.test.js +19 -16
- package/lib/redux/actions/marketStateUpdateActions.test.js +2 -2
- package/lib/redux/actions/modalActions.js +3 -0
- package/lib/redux/actions/orderEntryActions.js +32 -5
- package/lib/redux/actions/orderEntryActions.test.js +104 -37
- package/lib/redux/actions/orderHistoryActions.js +11 -4
- package/lib/redux/actions/orderHistoryActions.test.js +94 -79
- package/lib/redux/actions/positionActions.test.js +19 -4
- package/lib/redux/actions/productActions.test.js +38 -21
- package/lib/redux/actions/recentTradesActions.test.js +2 -2
- package/lib/redux/actions/regionFormActions.test.js +25 -33
- package/lib/redux/actions/reportActions.test.js +16 -35
- package/lib/redux/actions/signupActions.js +18 -4
- package/lib/redux/actions/signupActions.test.js +146 -142
- package/lib/redux/actions/snackbarActions.test.js +4 -4
- package/lib/redux/actions/tickersActions.test.js +10 -4
- package/lib/redux/actions/transferActions.test.js +111 -93
- package/lib/redux/actions/transferRequestActions.test.js +42 -42
- package/lib/redux/actions/userActions.js +97 -34
- package/lib/redux/actions/userActions.test.js +663 -314
- package/lib/redux/actions/verifyEmailActions.test.js +13 -2
- package/lib/redux/actions/withdrawActions.js +143 -76
- package/lib/redux/actions/withdrawActions.test.js +369 -187
- package/lib/redux/actions/withdrawActions.travelRule.test.js +17 -3
- package/lib/redux/actions/wsConnectionActions.js +96 -1
- package/lib/redux/actions/wsConnectionActions.test.js +9 -8
- package/lib/redux/actions/wsConnectionLifecycle.test.js +207 -0
- package/lib/redux/futures/actions/futuresOrderFormActions.js +26 -2
- package/lib/redux/margin/actions/marginActions.test.js +163 -75
- package/lib/redux/margin/actions/marginHistoryActions.test.js +190 -151
- package/lib/redux/margin/reducers/marginHistoryReducer.test.js +146 -135
- package/lib/redux/margin/selectors/marginHistorySelectors.test.js +101 -102
- package/lib/redux/margin/selectors/marginOrderSelectors.test.js +2 -2
- package/lib/redux/middlewares/authMiddleware.test.js +142 -23
- package/lib/redux/middlewares/placeOrderMiddleware.test.js +18 -1
- package/lib/redux/middlewares/startupMiddleware.test.js +10 -34
- package/lib/redux/middlewares/wsConnectionMiddleware.test.js +6 -1
- package/lib/redux/reducers/apiProcessingReducer.test.js +4 -2
- package/lib/redux/reducers/authReducer.test.js +3 -3
- package/lib/redux/reducers/depositReducer.test.js +2 -1
- package/lib/redux/reducers/level2Reducer.test.js +2 -2
- package/lib/redux/reducers/orderHistoryReducer.js +1 -1
- package/lib/redux/reducers/orderHistoryReducer.test.js +63 -75
- package/lib/redux/reducers/positionReducer.test.js +1 -2
- package/lib/redux/reducers/resetPasswordReducer.test.js +1 -0
- package/lib/redux/reducers/snackbarReducer.test.js +12 -39
- package/lib/redux/reducers/tickersReducer.test.js +2 -2
- package/lib/redux/reducers/userReducer.js +10 -0
- package/lib/redux/reducers/userReducer.test.js +36 -1
- package/lib/redux/reducers/withdrawReducer.test.js +11 -5
- package/lib/redux/selectors/buySellSelectors.test.js +10 -6
- package/lib/redux/selectors/depositWithdrawalSelectors.js +6 -12
- package/lib/redux/selectors/instrumentPositionSelectors.test.js +58 -18
- package/lib/redux/selectors/level2Selectors.test.js +60 -33
- package/lib/redux/selectors/loyaltyTokenSelectors.test.js +15 -13
- package/lib/redux/selectors/marginHistorySelectors.test.js +11 -5
- package/lib/redux/selectors/openOrdersActivitySelector.test.js +4 -4
- package/lib/redux/selectors/orderHistorySelectors.test.js +141 -22
- package/lib/redux/selectors/orderTotalSelector.test.js +76 -30
- package/lib/redux/selectors/productPositionSelectors.test.js +2 -1
- package/lib/redux/selectors/recentActivitySelector.js +8 -2
- package/lib/redux/selectors/recentActivitySelector.v2.test.js +33 -0
- package/lib/redux/selectors/recentTradesSelectors.test.js +17 -0
- package/lib/redux/selectors/transfersTableSelectors.test.js +7 -1
- package/lib/redux/selectors/userSelectors.js +6 -1
- package/lib/redux/selectors/userSelectors.test.js +28 -0
- package/lib/services/subscriptions/accountPositionSubscriptionService.test.js +0 -14
- package/lib/services/subscriptions/orderStateSubscriptionService.test.js +0 -14
- package/lib/services/subscriptions/orderTradesSuscriptionService.test.js +0 -14
- package/lib/services/tradingView/ChartAPI.js +17 -2
- package/lib/setupTests.js +1 -10
- package/package.json +21 -5
- package/lib/components/APSnackbar/APSnackbarContainer.notest.js +0 -58
- package/lib/components/ActivityReportingComponents/ActivityReportingButtons/ActivityReportingButtonsComponent.notest.js +0 -27
- package/lib/components/ActivityReportingComponents/ActivityReportingButtons/ActivityReportingButtonsContainer.notest.js +0 -42
- package/lib/components/AffiliateComponents/AffiliateActiveTagComponent.notest.js +0 -36
- package/lib/components/AffiliateComponents/AffiliateActiveTagContainer.notest.js +0 -81
- package/lib/components/AffiliateComponents/AffiliateCountContainer.notest.js +0 -37
- package/lib/components/AffiliateComponents/AffiliateModal.notest.js +0 -41
- package/lib/components/AffiliateComponents/AffiliateModalContainer.notest.js +0 -79
- package/lib/components/ApiKeysSidePaneComponents/ApiKeyList/ApiKeyListContainer.notest.js +0 -40
- package/lib/components/ApiKeysSidePaneComponents/ApiKeysComponent/ApiKeysComponent.notest.js +0 -32
- package/lib/components/ApiKeysSidePaneComponents/ApiKeysForm/ApiKeysFormComponent.notest.js +0 -32
- package/lib/components/ApiKeysSidePaneComponents/ApiKeysForm/ApiKeysFormContainer.notest.js +0 -29
- package/lib/components/ApiKeysSidePaneComponents/ApiKeysSidePane/ApiKeySidePaneComponent.notest.js +0 -46
- package/lib/components/ApiKeysSidePaneComponents/CreateApiKey/CreateApiKeyComponent.notest.js +0 -50
- package/lib/components/ApiKeysSidePaneComponents/CreateApiKey/CreateApiKeyContainer.notest.js +0 -70
- package/lib/components/ApiKeysSidePaneComponents/NewApiKey/NewApiKeyModalContainer.notest.js +0 -102
- package/lib/components/ApiKeysSidePaneComponents/RemoveApiKeyModal/RemoveApiKeyModalContainer.notest.js +0 -53
- package/lib/components/BalancesList/BalancesListContainer.notest.js +0 -91
- package/lib/components/BalancesMenu/BalanceMenuContainer.notest.js +0 -49
- package/lib/components/BalancesMenu/BalancesMenuComponent.notest.js +0 -68
- package/lib/components/BalancesMenu/BalancesMenuItemComponent.notest.js +0 -28
- package/lib/components/ConfirmBlockTradeModal/ConfirmBlockTradeModalContainer.notest.js +0 -171
- package/lib/components/ConfirmLimitOrderModal/ConfirmLimitOrderModalContainer.notest.js +0 -179
- package/lib/components/ConfirmWithdraw/ConfirmWithdrawContainer.notest.js +0 -58
- package/lib/components/DepositConfirmation/DepositConfirmationModalContainer.notest.js +0 -59
- package/lib/components/DepositSidePaneComponents/DepositFormComponent.notest.js +0 -123
- package/lib/components/DepositSidePaneComponents/DepositFormContainer.notest.js +0 -174
- package/lib/components/DepositSidePaneComponents/DepositTemplateFormComponent.notest.js +0 -79
- package/lib/components/DepositSidePaneComponents/DepositTemplateFormContainer.notest.js +0 -66
- package/lib/components/DepositSidePaneComponents/DepositWorkflows/CryptoWalletDepositWorkflow/CryptoWalletDepositWorkflowComponent.notest.js +0 -42
- package/lib/components/DepositSidePaneComponents/DepositWorkflows/CryptoWalletDepositWorkflow/CryptoWalletDepositWorkflowContainer.notest.js +0 -52
- package/lib/components/DepositSidePaneComponents/DepositWorkflows/DepositWorkflowsComponent.notest.js +0 -52
- package/lib/components/DepositSidePaneComponents/DepositWorkflows/DepositWorkflowsContainer.notest.js +0 -49
- package/lib/components/DepositSidePaneComponents/DepositWorkflows/GenericPaymentWorkflow/GenericPaymentWorkflowComponent.notest.js +0 -96
- package/lib/components/DepositSidePaneComponents/DepositWorkflows/GenericPaymentWorkflow/GenericPaymentWorkflowContainer.notest.js +0 -49
- package/lib/components/DepositSidePaneComponents/DepositWorkflows/ManualDepositWorkflow/ManualDepositWorkflowComponent.notest.js +0 -68
- package/lib/components/DepositSidePaneComponents/DepositWorkflows/ManualDepositWorkflow/ManualDepositWorkflowContainer.notest.js +0 -60
- package/lib/components/DepositSidePaneComponents/DepositWorkflows/PaymentProcessors/Hyphen/HyphenDepositWorkflowContainer.notest.js +0 -66
- package/lib/components/DepthChart/DepthChartContainer.notest.js +0 -82
- package/lib/components/EnableTwoFactorAuth/Disable2FAModalContainer.notest.js +0 -73
- package/lib/components/EnableTwoFactorAuth/Enable2FAModalContainer.notest.js +0 -82
- package/lib/components/EnableTwoFactorAuth/EnableTwoFactorAuthContainerFactory.notest.js +0 -50
- package/lib/components/EotcBalancesList/EotcBalancesListContainer.notest.js +0 -53
- package/lib/components/EotcProductCard/EotcProductCardContainer.notest.js +0 -87
- package/lib/components/EotcProductCard/EotcProductCardListContainer.notest.js +0 -55
- package/lib/components/EotcProductCardSimple/EotcProductCardSimpleContainer.notest.js +0 -136
- package/lib/components/EotcProductCardSimple/EotcProductCardSimpleListContainer.notest.js +0 -66
- package/lib/components/EotcWalletCard/EotcWalletCardContainer.notest.js +0 -148
- package/lib/components/EotcWalletCard/EotcWalletCardGridContainer.notest.js +0 -57
- package/lib/components/InstrumentPositions/InstrumentPositionsContainer.notest.js +0 -54
- package/lib/components/InstrumentPositionsWrapper/InstrumentPositionsWrapperContainer.notest.js +0 -46
- package/lib/components/InstrumentSelector/InstrumentSelectorContainer.notest.js +0 -112
- package/lib/components/InstrumentTable/InstrumentTableContainer.notest.js +0 -51
- package/lib/components/KYC/KYCBaseContainer.notest.js +0 -103
- package/lib/components/KYC/KYCLevel/KYCLevelComponent.notest.js +0 -94
- package/lib/components/KYCSettings/KYCSettingsContainer.notest.js +0 -49
- package/lib/components/KYCStatus/KYCStatusContainer.notest.js +0 -66
- package/lib/components/KYC_IM/KYC_IMForm/KYC_IMFormContainer.notest.js +0 -89
- package/lib/components/KYC_IM/KYC_IMForm/KYC_IMFormStepContainer.notest.js +0 -37
- package/lib/components/KYC_IM/KYC_IMLevelsContainer.notest.js +0 -47
- package/lib/components/KYC_IMLegacy/KYC_IMLegacyForm/KYC_IMLegacyFormContainer.notest.js +0 -152
- package/lib/components/KYC_IMLegacy/KYC_IMLegacyLevelsContainer.notest.js +0 -47
- package/lib/components/KYC_Jumio/KYC_JumioIframe/KYC_JumioIframeComponent.notest.js +0 -63
- package/lib/components/KYC_Jumio/KYC_JumioIframe/KYC_JumioIframeContainer.notest.js +0 -70
- package/lib/components/KYC_Jumio/KYC_JumioLevelsContainer.notest.js +0 -47
- package/lib/components/KYC_Manual/KYC_ManualForm/KYC_ManualFormContainer.notest.js +0 -102
- package/lib/components/KYC_Manual/KYC_ManualIframe/KYC_ManualIframeContainer.notest.js +0 -150
- package/lib/components/KYC_Manual/KYC_ManualLevelsContainer.notest.js +0 -47
- package/lib/components/Login/LoginFormComponent.notest.js +0 -84
- package/lib/components/Login/LoginFormContainer.notest.js +0 -111
- package/lib/components/LoyaltyToken/LoyaltyTokenContainer.notest.js +0 -57
- package/lib/components/MarginBalances/MarginDepositWithdraw/MarginDepositModal/MarginDepositFormContainer.notest.js +0 -87
- package/lib/components/MarginBalances/MarginOverview/MarginOverviewContainer.notest.js +0 -45
- package/lib/components/MarginTransferAssetModal/MarginTransferAssetsFormContainer.notest.js +0 -194
- package/lib/components/MarketDataCardsComponent/MarketDataCardsContainer.notest.js +0 -63
- package/lib/components/MenuItem/MenuItemComponent.notest.js +0 -39
- package/lib/components/OrderBookComponents/BulkCancelButtonsComponent/BulkCancelButtonsComponent.notest.js +0 -54
- package/lib/components/OrderBookComponents/Level2DataTableComponent.notest.js +0 -38
- package/lib/components/OrderBookComponents/OrderBookComponent.notest.js +0 -38
- package/lib/components/OrderBookComponents/OrderBookContainer.notest.js +0 -121
- package/lib/components/OrderHistoryComponents/DepositsStatus/DepositsStatusComponent.notest.js +0 -68
- package/lib/components/OrderHistoryComponents/FilledOrders/FilledOrdersComponent.notest.js +0 -156
- package/lib/components/OrderHistoryComponents/HeaderWithFilter/HeaderWithFilterContainer.notest.js +0 -58
- package/lib/components/OrderHistoryComponents/InactiveOrders/InactiveOrdersComponent.notest.js +0 -97
- package/lib/components/OrderHistoryComponents/MarginOpenPositions/MarginOpenPositionsComponent.notest.js +0 -93
- package/lib/components/OrderHistoryComponents/MarginOrderHistory/MarginOrderHistoryComponent.notest.js +0 -107
- package/lib/components/OrderHistoryComponents/MarginOrderHistoryExtended/MarginOrderHistoryExtendedComponent.notest.js +0 -118
- package/lib/components/OrderHistoryComponents/OpenOrders/OpenOrdersComponent.notest.js +0 -123
- package/lib/components/OrderHistoryComponents/OrderHistoryComponent.notest.js +0 -107
- package/lib/components/OrderHistoryComponents/PositionPayments/PositionPaymentsComponent.notest.js +0 -82
- package/lib/components/OrderHistoryComponents/TradeReports/TradeReportsComponent.notest.js +0 -124
- package/lib/components/OrderHistoryComponents/WithdrawStatus/WithdrawStatusComponent.notest.js +0 -69
- package/lib/components/PriceChart/ApexChartComponent.notest.js +0 -48
- package/lib/components/PriceChart/ApexChartContainer.notest.js +0 -75
- package/lib/components/PriceChart/PriceChartContainer.notest.js +0 -37
- package/lib/components/PriceChart/TVChartContainer.notest.js +0 -106
- package/lib/components/ProblemLoggingIn/ProblemLoggingInFormContainer.notest.js +0 -81
- package/lib/components/ProductPositionDetails/ProductPositionDetailsComponent.notest.js +0 -37
- package/lib/components/ProductPositionDetails/ProductPositionDetailsContainer.notest.js +0 -47
- package/lib/components/ProfileForm/ProfileFormComponent.notest.js +0 -51
- package/lib/components/ProfileForm/ProfileFormContainer.notest.js +0 -68
- package/lib/components/RecentActivity/RecentActivityContainer.notest.js +0 -41
- package/lib/components/RecentActivity/RecentActivityTable/RecentActivityTableContainer.notest.js +0 -43
- package/lib/components/RecentActivityWithFilter/RecentActivityHeaderWithFilter/RecentActivityHeaderForm/RecentActivityHeaderFormContainer.notest.js +0 -128
- package/lib/components/RecentActivityWithFilter/RecentActivityTableWithFilter/RecentActivityTableWithFilterContainer.notest.js +0 -64
- package/lib/components/RecentActivityWithFilter/RecentActivityWithFilterContainer.notest.js +0 -41
- package/lib/components/RecentTrades/RecentTradesComponent.notest.js +0 -78
- package/lib/components/RecentTrades/RecentTradesContainer.notest.js +0 -59
- package/lib/components/ReportBlockTradeSidePaneComponents/ReportBlockTradeContainer.notest.js +0 -169
- package/lib/components/ReportBlockTradeSidePaneComponents/ReportBlockTradeSidePaneContainer.notest.js +0 -107
- package/lib/components/ReportSidePaneComponents/ConfirmCyclicalReport/ConfirmCyclicalReportModalContainer.notest.js +0 -39
- package/lib/components/ReportSidePaneComponents/ConfirmSingleReport/ConfirmSingleReportModalContainer.notest.js +0 -39
- package/lib/components/ReportSidePaneComponents/CreateReportForm/CreateReportFormComponent.notest.js +0 -42
- package/lib/components/ReportSidePaneComponents/CreateReportForm/CreateReportFormContainer.notest.js +0 -85
- package/lib/components/ReportSidePaneComponents/DownloadReportForm/DownloadReportContainer.notest.js +0 -37
- package/lib/components/ReportSidePaneComponents/ReportSidePaneComponent.notest.js +0 -72
- package/lib/components/ReportSidePaneComponents/ScheduleReportForm/ScheduleReportFormComponent.notest.js +0 -43
- package/lib/components/ReportSidePaneComponents/ScheduleReportForm/ScheduleReportFormContainer.notest.js +0 -80
- package/lib/components/ReportSidePaneComponents/ScheduledReportsTable/ScheduledReportsTableComponent.notest.js +0 -34
- package/lib/components/ReportSidePaneComponents/ScheduledReportsTable/ScheduledReportsTableContainer.notest.js +0 -48
- package/lib/components/ResetPasswordForm/ResetPasswordFormContainer.notest.js +0 -105
- package/lib/components/ResetPasswordRequestForm/ResetPasswordRequestFormComponent.notest.js +0 -39
- package/lib/components/ResetPasswordRequestForm/ResetPasswordRequestFormContainerFactory.notest.js +0 -47
- package/lib/components/Retail/RetailBuySell/BuySell/BuySellContainer.notest.js +0 -105
- package/lib/components/Retail/RetailBuySell/BuySell/BuySellCustomRow/BuySellCustomRowContainer.notest.js +0 -145
- package/lib/components/Retail/RetailBuySell/BuySell/BuySellInstrumentSelector/BuySellInstrumentSelectorContainer.notest.js +0 -113
- package/lib/components/Retail/RetailBuySell/BuySell/BuySellOrderButton/BuySellOrderButtonContainer.notest.js +0 -66
- package/lib/components/Retail/RetailBuySell/BuySell/BuySellPresetValuesRows/BuySellPresetValuesRowsContainer.notest.js +0 -125
- package/lib/components/Retail/RetailBuySell/BuySell/BuySellTabs/BuySellTabsContainer.notest.js +0 -115
- package/lib/components/Retail/RetailBuySell/BuySellBalances/BuySellBalancesContainer.notest.js +0 -126
- package/lib/components/Retail/RetailBuySell/BuySellChartIntervalSelector/BuySellChartIntervalSelectorContainer.notest.js +0 -36
- package/lib/components/Retail/RetailBuySell/BuySellChartOverview/BuySellChartOverviewContainer.notest.js +0 -43
- package/lib/components/Retail/RetailBuySell/BuySellInstrumentSelect/BuySellInstrumentSelectContainer.notest.js +0 -153
- package/lib/components/Retail/RetailBuySell/BuySellOrderConfirmationModal/BuySellConfirmationModalContainer.notest.js +0 -262
- package/lib/components/Retail/RetailBuySell/BuySellOrderOverview/BuySellOrderOverviewContainer.notest.js +0 -124
- package/lib/components/Retail/RetailBuySell/EotcBuySell/EotcBuySellContainer.notest.js +0 -125
- package/lib/components/Retail/RetailBuySell/EotcBuySell/EotcBuySellCustomRow/EotcBuySellCustomRowContainer.notest.js +0 -143
- package/lib/components/Retail/RetailBuySell/EotcBuySell/EotcBuySellPresetValuesRows/EotcBuySellPresetValuesRowsContainer.notest.js +0 -125
- package/lib/components/Retail/RetailBuySell/EotcBuySellChartOverviewContainer/BuySellChartOverviewContainer.notest.js +0 -43
- package/lib/components/Retail/RetailBuySell/EotcBuySellOrderConfirmationModal/EotcBuySellConfirmationModalContainer.notest.js +0 -262
- package/lib/components/Retail/RetailSidePanes/FiatDeposit/DepositReferenceIdModalContainer.notest.js +0 -45
- package/lib/components/Retail/RetailSidePanes/FiatDeposit/FiatDepositFormContainer.notest.js +0 -137
- package/lib/components/Retail/RetailSidePanes/FiatDeposit/FiatDepositModalContainer.notest.js +0 -82
- package/lib/components/Retail/RetailSidePanes/FiatFormTabsComponent.notest.js +0 -49
- package/lib/components/Retail/RetailSidePanes/FiatSidePaneContainer.notest.js +0 -62
- package/lib/components/Retail/RetailSidePanes/FiatWithdraw/BankSelect/BankSelectContainer.notest.js +0 -80
- package/lib/components/Retail/RetailSidePanes/FiatWithdraw/FiatWithdrawFormContainer.notest.js +0 -124
- package/lib/components/Retail/RetailSidePanes/FiatWithdraw/FiatWithdrawModalContainer.notest.js +0 -46
- package/lib/components/SendReceiveSidePane/Receive/ReceiveContainer.notest.js +0 -69
- package/lib/components/SendReceiveSidePane/ReceiveAddress/ReceiveAddressContainer.notest.js +0 -73
- package/lib/components/SendReceiveSidePane/ReceiveForm/ReceiveFormContainer.notest.js +0 -54
- package/lib/components/SendReceiveSidePane/SendAddress/SendAddressContainer.notest.js +0 -71
- package/lib/components/SendReceiveSidePane/SendForm/SendFormContainer.notest.js +0 -72
- package/lib/components/SendReceiveSidePane/SendReceiveSidePaneContainer.notest.js +0 -139
- package/lib/components/SendReceiveSidePane/SendReceiveTwoFactorAuth/SendReceiveTwoFactorAuthContainer.notest.js +0 -102
- package/lib/components/Settings/ApiKeys/ApiKeysSidePaneButton/ApiKeysSidePaneButtonContainer.notest.js +0 -31
- package/lib/components/Settings/DemoSettings/DemoSettingsContainer.notest.js +0 -46
- package/lib/components/Settings/ProfileAndSecurity/ProfileSettingsCard/ProfileForm/ProfileFormContainer.notest.js +0 -69
- package/lib/components/Settings/ProfileAndSecurity/RegionSettingsCard/RegionSettings/RegionSettingsContainer.notest.js +0 -86
- package/lib/components/Settings/ProfileAndSecurity/ThemeSettingsCard/ThemeForm/ThemeSettingsContainer.notest.js +0 -45
- package/lib/components/Settings/TradeSettings/MarginTrading/EnableMarginModal/EnableMarginConfirmationModalComponent.notest.js +0 -47
- package/lib/components/Settings/TradeSettings/MarginTrading/EnableMarginModal/EnableMarginConfirmationModalContainer.notest.js +0 -112
- package/lib/components/Settings/TradeSettings/MarginTrading/MarginTradingComponent.notest.js +0 -33
- package/lib/components/Settings/TradeSettings/MarginTrading/MarginTradingContainer.notest.js +0 -54
- package/lib/components/Settings/TransferHistory/TransferHistoryContainer.notest.js +0 -42
- package/lib/components/Signup/SignupFormComponent.notest.js +0 -92
- package/lib/components/Signup/SignupFormContainer.notest.js +0 -124
- package/lib/components/StandaloneKYC/StandaloneKYCContainer.notest.js +0 -75
- package/lib/components/StandaloneModal/StandaloneModalComponent.notest.js +0 -69
- package/lib/components/Ticker/TickerContainer.notest.js +0 -57
- package/lib/components/Transfers/TransfersContainer.notest.js +0 -99
- package/lib/components/Transfers/TransfersFilters/TransfersFiltersContainer.notest.js +0 -81
- package/lib/components/TwoFactorAuthForm/TwoFactorAuthFormContainer.notest.js +0 -60
- package/lib/components/UserBalance/UserBalanceContainer.notest.js +0 -47
- package/lib/components/UserSettings/UserSettingsComponent.notest.js +0 -55
- package/lib/components/UserSummary/UserSummaryContainer.notest.js +0 -65
- package/lib/components/VerificationRequired/VerificationRequiredContainer.notest.js +0 -47
- package/lib/components/VerifyEmail/VerifyEmailContainer.notest.js +0 -46
- package/lib/components/WalletCards/WalletCardContainer.notest.js +0 -77
- package/lib/components/WalletCards/WalletCardGridContainer.notest.js +0 -42
- package/lib/components/WalletDetails/WalletDetailsContainer.notest.js +0 -61
- package/lib/components/WalletNavItems/CryptoNavItemsContainer.notest.js +0 -46
- package/lib/components/WalletNavItems/EotcCryptoNavItemsContainer.notest.js +0 -64
- package/lib/components/WalletNavItems/FiatNavItemsComponent.notest.js +0 -59
- package/lib/components/WalletNavItems/FiatNavItemsContainer.notest.js +0 -66
- package/lib/components/WalletRows/WalletRowContainer.notest.js +0 -76
- package/lib/components/WalletRows/WalletRowListContainer.notest.js +0 -43
- package/lib/components/WithdrawSidePaneComponents/PaymentProcessors/HyphenWithdrawWorkflowContainer.notest.js +0 -51
- package/lib/components/WithdrawSidePaneComponents/PaymentProcessors/TrustpayWithdrawWorkflowContainer.notest.js +0 -36
- package/lib/components/WithdrawSidePaneComponents/WithdrawForm/WithdrawFormComponent.notest.js +0 -131
- package/lib/components/WithdrawSidePaneComponents/WithdrawForm/WithdrawFormContainer.notest.js +0 -140
- package/lib/components/WithdrawSidePaneComponents/WithdrawTemplateForm/WithdrawTemplateFormComponent.notest.js +0 -38
- package/lib/components/WithdrawSidePaneComponents/WithdrawTemplateForm/WithdrawTemplateFormContainer.notest.js +0 -95
- package/lib/components/WithdrawSidePaneComponents/WithdrawWorkflows/WithdrawWorkflowsContainer.notest.js +0 -42
- package/lib/components/common/APDatePicker/APDatePicker.notest.js +0 -194
- package/lib/components/common/APLabelWithText/APLabelWithText.notest.js +0 -25
- package/lib/components/common/APNumberInput.notest.js +0 -173
- package/lib/components/common/APRadioTab/APRadioTab.notest.js +0 -69
- package/lib/components/common/APSegmentedButton/APSegmentedButton.notest.js +0 -55
- package/lib/components/common/APSnackbar/APSnackbar.notest.js +0 -107
- package/lib/components/common/APVerticalScroller/APVerticalScroller.notest.js +0 -172
- package/lib/components/common/Modal/Modal.notest.js +0 -55
- package/lib/components/common/Pagination/PaginationComponent.notest.js +0 -137
- package/lib/components/common/Pagination/PaginationContainer.notest.js +0 -47
- package/lib/components/common/Popover/Popover.notest.js +0 -137
- package/lib/components/common/ProductIcon/ProductIcon.notest.js +0 -76
- package/lib/components/common/ProductIcon/ProductIconContainer.notest.js +0 -38
- package/lib/components/common/SidePane/SidePaneComponent.notest.js +0 -48
- package/lib/components/common/SidePane/SidePaneContainer.notest.js +0 -54
- package/lib/components/common/Snackbar/Snackbar.notest.js +0 -51
- package/lib/components/common/Tab/Tab.notest.js +0 -68
- package/lib/helpers/formGeneratorHelper.notest.js +0 -203
- package/lib/helpers/formTemplateHelper.notest.js +0 -170
- package/lib/hocs/modalDecorator.notest.js +0 -74
- package/lib/hocs/redirectIfAuthorized.notest.js +0 -80
- package/lib/hocs/resize.notest.js +0 -37
- package/lib/layouts/HomePageLayout.notest.js +0 -65
- package/lib/redux/actions/languageActions.test.js +0 -105
- package/lib/redux/selectors/recentActivitySelector.test.js +0 -725
|
@@ -8,15 +8,23 @@ var _apex = _interopRequireDefault(require("../../apex"));
|
|
|
8
8
|
var orderHistoryActions = _interopRequireWildcard(require("./orderHistoryActions"));
|
|
9
9
|
var snackbarActions = _interopRequireWildcard(require("./snackbarActions"));
|
|
10
10
|
var positionActions = _interopRequireWildcard(require("./positionActions"));
|
|
11
|
-
var depositActions = _interopRequireWildcard(require("./depositActions"));
|
|
12
11
|
var withdrawActions = _interopRequireWildcard(require("./withdrawActions"));
|
|
13
12
|
var transferActions = _interopRequireWildcard(require("./transferActions"));
|
|
14
13
|
var _modalActions = require("./modalActions");
|
|
15
14
|
var _verificationLevelUpdateService = _interopRequireDefault(require("../../services/subscriptions/verificationLevelUpdateService"));
|
|
16
15
|
var _config = _interopRequireDefault(require("../../config"));
|
|
16
|
+
var _excluded = ["ResendVerificationEmail"];
|
|
17
17
|
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, "default": e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
|
|
18
18
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
|
|
19
19
|
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
20
|
+
function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
|
|
21
|
+
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
|
|
22
|
+
function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
|
|
23
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
24
|
+
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
25
|
+
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
26
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
27
|
+
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
20
28
|
function _regenerator() { /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */ var e, t, r = "function" == typeof Symbol ? Symbol : {}, n = r.iterator || "@@iterator", o = r.toStringTag || "@@toStringTag"; function i(r, n, o, i) { var c = n && n.prototype instanceof Generator ? n : Generator, u = Object.create(c.prototype); return _regeneratorDefine2(u, "_invoke", function (r, n, o) { var i, c, u, f = 0, p = o || [], y = !1, G = { p: 0, n: 0, v: e, a: d, f: d.bind(e, 4), d: function d(t, r) { return i = t, c = 0, u = e, G.n = r, a; } }; function d(r, n) { for (c = r, u = n, t = 0; !y && f && !o && t < p.length; t++) { var o, i = p[t], d = G.p, l = i[2]; r > 3 ? (o = l === n) && (u = i[(c = i[4]) ? 5 : (c = 3, 3)], i[4] = i[5] = e) : i[0] <= d && ((o = r < 2 && d < i[1]) ? (c = 0, G.v = n, G.n = i[1]) : d < l && (o = r < 3 || i[0] > n || n > l) && (i[4] = r, i[5] = n, G.n = l, c = 0)); } if (o || r > 1) return a; throw y = !0, n; } return function (o, p, l) { if (f > 1) throw TypeError("Generator is already running"); for (y && 1 === p && d(p, l), c = p, u = l; (t = c < 2 ? e : u) || !y;) { i || (c ? c < 3 ? (c > 1 && (G.n = -1), d(c, u)) : G.n = u : G.v = u); try { if (f = 2, i) { if (c || (o = "next"), t = i[o]) { if (!(t = t.call(i, u))) throw TypeError("iterator result is not an object"); if (!t.done) return t; u = t.value, c < 2 && (c = 0); } else 1 === c && (t = i["return"]) && t.call(i), c < 2 && (u = TypeError("The iterator does not provide a '" + o + "' method"), c = 1); i = e; } else if ((t = (y = G.n < 0) ? u : r.call(n, G)) !== a) break; } catch (t) { i = e, c = 1, u = t; } finally { f = 1; } } return { value: t, done: y }; }; }(r, o, i), !0), u; } var a = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} t = Object.getPrototypeOf; var c = [][n] ? t(t([][n]())) : (_regeneratorDefine2(t = {}, n, function () { return this; }), t), u = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(c); function f(e) { return Object.setPrototypeOf ? Object.setPrototypeOf(e, GeneratorFunctionPrototype) : (e.__proto__ = GeneratorFunctionPrototype, _regeneratorDefine2(e, o, "GeneratorFunction")), e.prototype = Object.create(u), e; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, _regeneratorDefine2(u, "constructor", GeneratorFunctionPrototype), _regeneratorDefine2(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = "GeneratorFunction", _regeneratorDefine2(GeneratorFunctionPrototype, o, "GeneratorFunction"), _regeneratorDefine2(u), _regeneratorDefine2(u, o, "Generator"), _regeneratorDefine2(u, n, function () { return this; }), _regeneratorDefine2(u, "toString", function () { return "[object Generator]"; }), (_regenerator = function _regenerator() { return { w: i, m: f }; })(); }
|
|
21
29
|
function _regeneratorDefine2(e, r, n, t) { var i = Object.defineProperty; try { i({}, "", {}); } catch (e) { i = 0; } _regeneratorDefine2 = function _regeneratorDefine(e, r, n, t) { function o(r, n) { _regeneratorDefine2(e, r, function (e) { return this._invoke(r, n, e); }); } r ? i ? i(e, r, { value: n, enumerable: !t, configurable: !t, writable: !t }) : e[r] = n : (o("next", 0), o("throw", 1), o("return", 2)); }, _regeneratorDefine2(e, r, n, t); }
|
|
22
30
|
function asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); }
|
|
@@ -28,7 +36,22 @@ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol"
|
|
|
28
36
|
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
29
37
|
var middlewares = [_reduxThunk["default"]];
|
|
30
38
|
var mockStore = (0, _reduxMockStore["default"])(middlewares);
|
|
31
|
-
var dispatchStub = jest.fn()
|
|
39
|
+
var dispatchStub = jest.fn(function (action) {
|
|
40
|
+
if (typeof action === 'function') {
|
|
41
|
+
return action(dispatchStub, function () {
|
|
42
|
+
return {
|
|
43
|
+
api: {
|
|
44
|
+
validate2FARequiredEndpoints: {}
|
|
45
|
+
},
|
|
46
|
+
user: {
|
|
47
|
+
accounts: [],
|
|
48
|
+
userInfo: {}
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
return action;
|
|
54
|
+
});
|
|
32
55
|
jest.mock('../../apex', function () {
|
|
33
56
|
var response;
|
|
34
57
|
var getAccountInfoResponse;
|
|
@@ -37,7 +60,8 @@ jest.mock('../../apex', function () {
|
|
|
37
60
|
// eslint-disable-next-line no-unused-vars
|
|
38
61
|
var getUserConfigResponse;
|
|
39
62
|
var returnRPCPromiseValue;
|
|
40
|
-
|
|
63
|
+
var rpcPromiseResponsesByEndpoint = {};
|
|
64
|
+
var apexMock = {
|
|
41
65
|
connection: {
|
|
42
66
|
GetUserInfo: jest.fn().mockImplementation(function () {
|
|
43
67
|
return getUserInfoResponse;
|
|
@@ -93,14 +117,29 @@ jest.mock('../../apex', function () {
|
|
|
93
117
|
setGetUserConfigResponse: function setGetUserConfigResponse(res) {
|
|
94
118
|
getUserConfigResponse = res;
|
|
95
119
|
},
|
|
96
|
-
RPCPromise: jest.fn().mockImplementation(function () {
|
|
120
|
+
RPCPromise: jest.fn().mockImplementation(function (endpoint) {
|
|
121
|
+
if (Object.prototype.hasOwnProperty.call(rpcPromiseResponsesByEndpoint, endpoint)) {
|
|
122
|
+
return rpcPromiseResponsesByEndpoint[endpoint];
|
|
123
|
+
}
|
|
97
124
|
return returnRPCPromiseValue;
|
|
98
125
|
}),
|
|
99
126
|
setRPCPromiseReturnValue: function setRPCPromiseReturnValue(value) {
|
|
100
127
|
returnRPCPromiseValue = value;
|
|
101
|
-
}
|
|
128
|
+
},
|
|
129
|
+
setRPCPromiseReturnValueForEndpoint: function setRPCPromiseReturnValueForEndpoint(endpoint, value) {
|
|
130
|
+
rpcPromiseResponsesByEndpoint[endpoint] = value;
|
|
131
|
+
},
|
|
132
|
+
resetRPCPromiseResponses: function resetRPCPromiseResponses() {
|
|
133
|
+
returnRPCPromiseValue = undefined;
|
|
134
|
+
rpcPromiseResponsesByEndpoint = {};
|
|
135
|
+
},
|
|
136
|
+
subscribeAccountEvents: jest.fn()
|
|
102
137
|
}
|
|
103
138
|
};
|
|
139
|
+
apexMock.getApex = jest.fn(function () {
|
|
140
|
+
return apexMock;
|
|
141
|
+
});
|
|
142
|
+
return apexMock;
|
|
104
143
|
});
|
|
105
144
|
jest.mock('../../services/subscriptions/verificationLevelUpdateService', function () {
|
|
106
145
|
var updateData = [];
|
|
@@ -138,6 +177,12 @@ jest.mock('../../services/subscriptions/settlementSubscriptionService', function
|
|
|
138
177
|
stop: jest.fn()
|
|
139
178
|
};
|
|
140
179
|
});
|
|
180
|
+
jest.mock('../../services/subscriptions/AccountEventsSubscriptionService', function () {
|
|
181
|
+
return {
|
|
182
|
+
subscribe: jest.fn(),
|
|
183
|
+
stop: jest.fn()
|
|
184
|
+
};
|
|
185
|
+
});
|
|
141
186
|
jest.mock('./orderHistoryActions', function () {
|
|
142
187
|
return {
|
|
143
188
|
getOrders: jest.fn().mockImplementation(function () {
|
|
@@ -169,6 +214,11 @@ jest.mock('./orderHistoryActions', function () {
|
|
|
169
214
|
return {
|
|
170
215
|
type: 'mock'
|
|
171
216
|
};
|
|
217
|
+
}),
|
|
218
|
+
subscribeToMarginCancelOrderLiquidationEvents: jest.fn().mockImplementation(function () {
|
|
219
|
+
return {
|
|
220
|
+
type: 'mock'
|
|
221
|
+
};
|
|
172
222
|
})
|
|
173
223
|
};
|
|
174
224
|
});
|
|
@@ -222,6 +272,11 @@ jest.mock('./withdrawActions', function () {
|
|
|
222
272
|
return {
|
|
223
273
|
type: 'mock'
|
|
224
274
|
};
|
|
275
|
+
}),
|
|
276
|
+
getAccountVerificationLevelConfig: jest.fn().mockImplementation(function () {
|
|
277
|
+
return {
|
|
278
|
+
type: 'mock'
|
|
279
|
+
};
|
|
225
280
|
})
|
|
226
281
|
};
|
|
227
282
|
});
|
|
@@ -276,15 +331,6 @@ jest.mock('./snackbarActions', function () {
|
|
|
276
331
|
})
|
|
277
332
|
};
|
|
278
333
|
});
|
|
279
|
-
jest.mock('./languageActions', function () {
|
|
280
|
-
return {
|
|
281
|
-
changeLanguage: jest.fn().mockImplementation(function () {
|
|
282
|
-
return {
|
|
283
|
-
type: 'changeLanguage'
|
|
284
|
-
};
|
|
285
|
-
})
|
|
286
|
-
};
|
|
287
|
-
});
|
|
288
334
|
jest.mock('./modalActions', function () {
|
|
289
335
|
return {
|
|
290
336
|
closeModal: jest.fn().mockImplementation(function (payload) {
|
|
@@ -326,7 +372,12 @@ jest.mock('redux-form', function () {
|
|
|
326
372
|
}),
|
|
327
373
|
actionTypes: {
|
|
328
374
|
CHANGE: 'CHANGE'
|
|
329
|
-
}
|
|
375
|
+
},
|
|
376
|
+
formValueSelector: jest.fn().mockImplementation(function (option) {
|
|
377
|
+
return function (Component) {
|
|
378
|
+
return Component;
|
|
379
|
+
};
|
|
380
|
+
})
|
|
330
381
|
};
|
|
331
382
|
});
|
|
332
383
|
jest.mock('../../config', function () {
|
|
@@ -337,6 +388,12 @@ jest.mock('../../config', function () {
|
|
|
337
388
|
},
|
|
338
389
|
global: {
|
|
339
390
|
privateMarketData: false
|
|
391
|
+
},
|
|
392
|
+
Middleware: {
|
|
393
|
+
level2MonitorInterval: 60000
|
|
394
|
+
},
|
|
395
|
+
Snackbar: {
|
|
396
|
+
timeout: 15000
|
|
340
397
|
}
|
|
341
398
|
};
|
|
342
399
|
return _objectSpread({
|
|
@@ -352,6 +409,52 @@ jest.mock('../margin/selectors', function () {
|
|
|
352
409
|
return {
|
|
353
410
|
marginAccountSelector: jest.fn(function () {
|
|
354
411
|
return {};
|
|
412
|
+
}),
|
|
413
|
+
defaultAccountSelector: jest.fn(function () {
|
|
414
|
+
return undefined;
|
|
415
|
+
}),
|
|
416
|
+
isMarginActiveSelector: jest.fn(function () {
|
|
417
|
+
return false;
|
|
418
|
+
}),
|
|
419
|
+
marginAccountEquitySelector: jest.fn(function () {
|
|
420
|
+
return 0;
|
|
421
|
+
})
|
|
422
|
+
};
|
|
423
|
+
});
|
|
424
|
+
jest.mock('../futures/actions', function () {
|
|
425
|
+
return {
|
|
426
|
+
initFuturesTrading: jest.fn(function () {
|
|
427
|
+
return {
|
|
428
|
+
type: 'mock'
|
|
429
|
+
};
|
|
430
|
+
}),
|
|
431
|
+
preloadFuturesData: jest.fn(function () {
|
|
432
|
+
return {
|
|
433
|
+
type: 'mock'
|
|
434
|
+
};
|
|
435
|
+
}),
|
|
436
|
+
subscribeFuturesOrderHistory: jest.fn(function () {
|
|
437
|
+
return {
|
|
438
|
+
type: 'mock'
|
|
439
|
+
};
|
|
440
|
+
})
|
|
441
|
+
};
|
|
442
|
+
});
|
|
443
|
+
jest.mock('../futures/actions/futuresInstrumentsActions', function () {
|
|
444
|
+
return {
|
|
445
|
+
getFuturesInstruments: jest.fn(function () {
|
|
446
|
+
return {
|
|
447
|
+
type: 'mock'
|
|
448
|
+
};
|
|
449
|
+
})
|
|
450
|
+
};
|
|
451
|
+
});
|
|
452
|
+
jest.mock('./instrumentActions', function () {
|
|
453
|
+
return {
|
|
454
|
+
selectInstrument: jest.fn(function () {
|
|
455
|
+
return {
|
|
456
|
+
type: 'mock'
|
|
457
|
+
};
|
|
355
458
|
})
|
|
356
459
|
};
|
|
357
460
|
});
|
|
@@ -359,6 +462,7 @@ console.error = jest.fn();
|
|
|
359
462
|
describe('userActions', function () {
|
|
360
463
|
var store;
|
|
361
464
|
beforeEach(function () {
|
|
465
|
+
_apex["default"].connection.resetRPCPromiseResponses();
|
|
362
466
|
store = mockStore({
|
|
363
467
|
auth: {
|
|
364
468
|
userId: 1
|
|
@@ -366,7 +470,20 @@ describe('userActions', function () {
|
|
|
366
470
|
user: {
|
|
367
471
|
userInfo: {
|
|
368
472
|
Use2FA: false
|
|
369
|
-
}
|
|
473
|
+
},
|
|
474
|
+
accounts: [{
|
|
475
|
+
AccountId: 1,
|
|
476
|
+
AccountType: 'Standard'
|
|
477
|
+
}]
|
|
478
|
+
},
|
|
479
|
+
api: {
|
|
480
|
+
validate2FARequiredEndpoints: {}
|
|
481
|
+
},
|
|
482
|
+
apexCore: {
|
|
483
|
+
instrument: {}
|
|
484
|
+
},
|
|
485
|
+
futures: {
|
|
486
|
+
instruments: {}
|
|
370
487
|
}
|
|
371
488
|
});
|
|
372
489
|
global.localStorage = {
|
|
@@ -412,49 +529,83 @@ describe('userActions', function () {
|
|
|
412
529
|
describe('getUserInfo', function () {
|
|
413
530
|
beforeEach(function () {
|
|
414
531
|
jest.clearAllMocks();
|
|
532
|
+
_apex["default"].connection.resetRPCPromiseResponses();
|
|
415
533
|
var userInfo = {
|
|
416
534
|
UserId: 99,
|
|
417
535
|
OMSId: 99,
|
|
418
|
-
AccountId: 99
|
|
536
|
+
AccountId: 99,
|
|
537
|
+
OperatorId: 1
|
|
538
|
+
};
|
|
539
|
+
_apex["default"].connection.setRPCPromiseReturnValueForEndpoint('GetUserInfo', {
|
|
540
|
+
o: JSON.stringify(userInfo)
|
|
541
|
+
});
|
|
542
|
+
_apex["default"].connection.setRPCPromiseReturnValueForEndpoint('GetOMSs', {
|
|
543
|
+
o: JSON.stringify([])
|
|
544
|
+
});
|
|
545
|
+
_apex["default"].connection.setRPCPromiseReturnValueForEndpoint('GetUserPermissions', {
|
|
546
|
+
o: JSON.stringify([])
|
|
547
|
+
});
|
|
548
|
+
_apex["default"].connection.setRPCPromiseReturnValueForEndpoint('GetUserConfig', {
|
|
549
|
+
o: JSON.stringify([])
|
|
550
|
+
});
|
|
551
|
+
_apex["default"].connection.setRPCPromiseReturnValueForEndpoint('GetUserAccounts', {
|
|
552
|
+
o: JSON.stringify([])
|
|
553
|
+
});
|
|
554
|
+
_apex["default"].connection.setRPCPromiseReturnValueForEndpoint('GetUserAffiliateTag', {
|
|
555
|
+
o: JSON.stringify({})
|
|
556
|
+
});
|
|
557
|
+
_apex["default"].connection.setRPCPromiseReturnValueForEndpoint('GetOperatorLoyaltyFeeConfigsForOms', {
|
|
558
|
+
o: JSON.stringify([])
|
|
559
|
+
});
|
|
560
|
+
});
|
|
561
|
+
var getState = jest.fn(function () {
|
|
562
|
+
return {
|
|
563
|
+
user: {
|
|
564
|
+
accounts: []
|
|
565
|
+
}
|
|
419
566
|
};
|
|
420
|
-
_apex["default"].connection.setResponse(userInfo);
|
|
421
|
-
_apex["default"].connection.setGetUserInfoResponse(Promise.resolve(userInfo));
|
|
422
567
|
});
|
|
423
|
-
it('should
|
|
568
|
+
it('should log an error and mark accounts as loaded when GetUserInfo fails', /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee() {
|
|
424
569
|
return _regenerator().w(function (_context) {
|
|
425
570
|
while (1) switch (_context.n) {
|
|
426
571
|
case 0:
|
|
427
|
-
_apex["default"].connection.
|
|
572
|
+
_apex["default"].connection.setRPCPromiseReturnValueForEndpoint('GetUserInfo', Promise.reject(new Error('fail')));
|
|
428
573
|
_context.n = 1;
|
|
429
|
-
return actions.getUserInfo(99)(dispatchStub);
|
|
574
|
+
return actions.getUserInfo(99)(dispatchStub, getState);
|
|
430
575
|
case 1:
|
|
431
|
-
expect(console.error).
|
|
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());
|
|
432
579
|
case 2:
|
|
433
580
|
return _context.a(2);
|
|
434
581
|
}
|
|
435
582
|
}, _callee);
|
|
436
583
|
})));
|
|
437
|
-
it('getUserInfo should call apex.connection.
|
|
584
|
+
it('getUserInfo should call apex.connection.RPCPromise with GetUserInfo', /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2() {
|
|
438
585
|
return _regenerator().w(function (_context2) {
|
|
439
586
|
while (1) switch (_context2.n) {
|
|
440
587
|
case 0:
|
|
441
588
|
_context2.n = 1;
|
|
442
|
-
return actions.getUserInfo(99)(dispatchStub);
|
|
589
|
+
return actions.getUserInfo(99)(dispatchStub, getState);
|
|
443
590
|
case 1:
|
|
444
|
-
expect(_apex["default"].connection.
|
|
591
|
+
expect(_apex["default"].connection.RPCPromise).toHaveBeenCalledWith('GetUserInfo', {
|
|
592
|
+
UserId: 99
|
|
593
|
+
});
|
|
445
594
|
case 2:
|
|
446
595
|
return _context2.a(2);
|
|
447
596
|
}
|
|
448
597
|
}, _callee2);
|
|
449
598
|
})));
|
|
450
|
-
it('getUserPermissions should call apex.connection.
|
|
599
|
+
it('getUserPermissions should call apex.connection.RPCPromise with GetUserPermissions', /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3() {
|
|
451
600
|
return _regenerator().w(function (_context3) {
|
|
452
601
|
while (1) switch (_context3.n) {
|
|
453
602
|
case 0:
|
|
454
603
|
_context3.n = 1;
|
|
455
604
|
return actions.getUserPermissions(99)(dispatchStub);
|
|
456
605
|
case 1:
|
|
457
|
-
expect(_apex["default"].connection.
|
|
606
|
+
expect(_apex["default"].connection.RPCPromise).toHaveBeenCalledWith('GetUserPermissions', {
|
|
607
|
+
UserId: 99
|
|
608
|
+
});
|
|
458
609
|
case 2:
|
|
459
610
|
return _context3.a(2);
|
|
460
611
|
}
|
|
@@ -464,30 +615,36 @@ describe('userActions', function () {
|
|
|
464
615
|
describe('getUserConfig', function () {
|
|
465
616
|
beforeEach(function () {
|
|
466
617
|
jest.clearAllMocks();
|
|
467
|
-
_apex["default"].connection.
|
|
618
|
+
_apex["default"].connection.resetRPCPromiseResponses();
|
|
468
619
|
});
|
|
469
620
|
it('should call console error if response is rejected', /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee4() {
|
|
470
621
|
return _regenerator().w(function (_context4) {
|
|
471
622
|
while (1) switch (_context4.n) {
|
|
472
623
|
case 0:
|
|
473
|
-
_apex["default"].connection.
|
|
624
|
+
_apex["default"].connection.setRPCPromiseReturnValueForEndpoint('GetUserConfig', Promise.reject(new Error('fail')));
|
|
474
625
|
_context4.n = 1;
|
|
475
626
|
return actions.getUserConfig(99)(dispatchStub);
|
|
476
627
|
case 1:
|
|
477
|
-
expect(console.error).
|
|
628
|
+
expect(console.error).toHaveBeenCalledWith('getUserConfig action error', expect.anything());
|
|
478
629
|
case 2:
|
|
479
630
|
return _context4.a(2);
|
|
480
631
|
}
|
|
481
632
|
}, _callee4);
|
|
482
633
|
})));
|
|
483
|
-
it('getUserConfig should call apex.connection.
|
|
634
|
+
it('getUserConfig should call apex.connection.RPCPromise with GetUserConfig', /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee5() {
|
|
484
635
|
return _regenerator().w(function (_context5) {
|
|
485
636
|
while (1) switch (_context5.n) {
|
|
486
637
|
case 0:
|
|
638
|
+
_apex["default"].connection.setRPCPromiseReturnValueForEndpoint('GetUserConfig', {
|
|
639
|
+
o: JSON.stringify([])
|
|
640
|
+
});
|
|
487
641
|
_context5.n = 1;
|
|
488
642
|
return actions.getUserConfig(99)(dispatchStub);
|
|
489
643
|
case 1:
|
|
490
|
-
expect(_apex["default"].connection.
|
|
644
|
+
expect(_apex["default"].connection.RPCPromise).toHaveBeenCalledWith('GetUserConfig', {
|
|
645
|
+
UserId: 99,
|
|
646
|
+
UserName: undefined
|
|
647
|
+
});
|
|
491
648
|
case 2:
|
|
492
649
|
return _context5.a(2);
|
|
493
650
|
}
|
|
@@ -497,7 +654,10 @@ describe('userActions', function () {
|
|
|
497
654
|
describe('getUserAccounts', function () {
|
|
498
655
|
beforeEach(function () {
|
|
499
656
|
jest.clearAllMocks();
|
|
500
|
-
_apex["default"].connection.
|
|
657
|
+
_apex["default"].connection.resetRPCPromiseResponses();
|
|
658
|
+
_apex["default"].connection.setRPCPromiseReturnValueForEndpoint('GetAccountInfo', {
|
|
659
|
+
o: JSON.stringify({})
|
|
660
|
+
});
|
|
501
661
|
});
|
|
502
662
|
it('should call apex.connection.getUserAccounts', /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee6() {
|
|
503
663
|
var userAccountIds, accountInfo;
|
|
@@ -508,28 +668,41 @@ describe('userActions', function () {
|
|
|
508
668
|
accountInfo = {
|
|
509
669
|
foo: 'foo'
|
|
510
670
|
};
|
|
511
|
-
_apex["default"].connection.
|
|
512
|
-
|
|
671
|
+
_apex["default"].connection.setRPCPromiseReturnValueForEndpoint('GetUserAccounts', {
|
|
672
|
+
o: JSON.stringify(userAccountIds)
|
|
673
|
+
});
|
|
674
|
+
_apex["default"].connection.setRPCPromiseReturnValueForEndpoint('GetAccountInfo', {
|
|
675
|
+
o: JSON.stringify(accountInfo)
|
|
676
|
+
});
|
|
513
677
|
_context6.n = 1;
|
|
514
678
|
return actions.getUserAccounts(99)(dispatchStub);
|
|
515
679
|
case 1:
|
|
516
|
-
expect(_apex["default"].connection.
|
|
680
|
+
expect(_apex["default"].connection.RPCPromise).toHaveBeenCalledWith('GetUserAccounts', {
|
|
681
|
+
OMSId: 99
|
|
682
|
+
});
|
|
517
683
|
case 2:
|
|
518
684
|
return _context6.a(2);
|
|
519
685
|
}
|
|
520
686
|
}, _callee6);
|
|
521
687
|
})));
|
|
522
688
|
it('should call getAccountInfo after getUserAccounts for each UserAccount', /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee7() {
|
|
523
|
-
var userAccountIds;
|
|
689
|
+
var userAccountIds, getAccountInfoCalls;
|
|
524
690
|
return _regenerator().w(function (_context7) {
|
|
525
691
|
while (1) switch (_context7.n) {
|
|
526
692
|
case 0:
|
|
527
693
|
userAccountIds = [1, 2, 3];
|
|
528
|
-
_apex["default"].connection.
|
|
694
|
+
_apex["default"].connection.setRPCPromiseReturnValueForEndpoint('GetUserAccounts', {
|
|
695
|
+
o: JSON.stringify(userAccountIds)
|
|
696
|
+
});
|
|
529
697
|
_context7.n = 1;
|
|
530
698
|
return actions.getUserAccounts(99)(dispatchStub);
|
|
531
699
|
case 1:
|
|
532
|
-
|
|
700
|
+
getAccountInfoCalls = _apex["default"].connection.RPCPromise.mock.calls.filter(function (_ref8) {
|
|
701
|
+
var _ref9 = _slicedToArray(_ref8, 1),
|
|
702
|
+
endpoint = _ref9[0];
|
|
703
|
+
return endpoint === 'GetAccountInfo';
|
|
704
|
+
});
|
|
705
|
+
expect(getAccountInfoCalls.length).toBe(3);
|
|
533
706
|
case 2:
|
|
534
707
|
return _context7.a(2);
|
|
535
708
|
}
|
|
@@ -560,8 +733,12 @@ describe('userActions', function () {
|
|
|
560
733
|
type: actions.RECEIVE_ACCOUNT,
|
|
561
734
|
payload: [accountInfo]
|
|
562
735
|
}];
|
|
563
|
-
_apex["default"].connection.
|
|
564
|
-
|
|
736
|
+
_apex["default"].connection.setRPCPromiseReturnValueForEndpoint('GetUserAccounts', {
|
|
737
|
+
o: JSON.stringify(userAccountIds)
|
|
738
|
+
});
|
|
739
|
+
_apex["default"].connection.setRPCPromiseReturnValueForEndpoint('GetAccountInfo', {
|
|
740
|
+
o: JSON.stringify(accountInfo)
|
|
741
|
+
});
|
|
565
742
|
_context8.n = 1;
|
|
566
743
|
return store.dispatch(actions.getUserAccounts());
|
|
567
744
|
case 1:
|
|
@@ -596,8 +773,12 @@ describe('userActions', function () {
|
|
|
596
773
|
type: actions.RECEIVE_ACCOUNT,
|
|
597
774
|
payload: [accountInfo]
|
|
598
775
|
}];
|
|
599
|
-
_apex["default"].connection.
|
|
600
|
-
|
|
776
|
+
_apex["default"].connection.setRPCPromiseReturnValueForEndpoint('GetUserAccounts', {
|
|
777
|
+
o: JSON.stringify(userAccountIds)
|
|
778
|
+
});
|
|
779
|
+
_apex["default"].connection.setRPCPromiseReturnValueForEndpoint('GetAccountInfo', {
|
|
780
|
+
o: JSON.stringify(accountInfo)
|
|
781
|
+
});
|
|
601
782
|
_context9.n = 1;
|
|
602
783
|
return store.dispatch(actions.getUserAccounts());
|
|
603
784
|
case 1:
|
|
@@ -608,109 +789,133 @@ describe('userActions', function () {
|
|
|
608
789
|
}
|
|
609
790
|
}, _callee9);
|
|
610
791
|
})));
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
it('should dispatch expected thunks after select account if privateMarketData = false', /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee0() {
|
|
614
|
-
var accountId, expectedActions;
|
|
792
|
+
it('should mark accounts as loaded after receiving them', /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee0() {
|
|
793
|
+
var types;
|
|
615
794
|
return _regenerator().w(function (_context0) {
|
|
616
795
|
while (1) switch (_context0.n) {
|
|
617
796
|
case 0:
|
|
618
|
-
|
|
797
|
+
_apex["default"].connection.setRPCPromiseReturnValueForEndpoint('GetUserAccounts', {
|
|
798
|
+
o: JSON.stringify([1])
|
|
799
|
+
});
|
|
619
800
|
_context0.n = 1;
|
|
620
|
-
return store.dispatch(actions.
|
|
801
|
+
return store.dispatch(actions.getUserAccounts(99));
|
|
621
802
|
case 1:
|
|
622
|
-
|
|
623
|
-
type
|
|
624
|
-
|
|
625
|
-
}
|
|
626
|
-
expect(
|
|
627
|
-
expect(
|
|
628
|
-
expect(orderHistoryActions.getAccountTrades).toHaveBeenCalled();
|
|
629
|
-
expect(orderHistoryActions.getOpenTradeReports).toHaveBeenCalled();
|
|
630
|
-
expect(depositActions.getDepositTickets).toHaveBeenCalled();
|
|
631
|
-
expect(withdrawActions.getWithdrawTickets).toHaveBeenCalled();
|
|
632
|
-
expect(orderHistoryActions.subscribeToOrderHistory).toHaveBeenCalled();
|
|
633
|
-
expect(transferActions.getTransfers).toHaveBeenCalled();
|
|
634
|
-
expect(positionActions.getAccountPositions).toHaveBeenCalled();
|
|
635
|
-
expect(positionActions.subscribeToAccountPositionEvents).toHaveBeenCalled();
|
|
636
|
-
expect(positionActions.selectPosition).toHaveBeenCalled();
|
|
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));
|
|
637
809
|
case 2:
|
|
638
810
|
return _context0.a(2);
|
|
639
811
|
}
|
|
640
812
|
}, _callee0);
|
|
641
813
|
})));
|
|
642
|
-
it('should
|
|
643
|
-
var
|
|
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;
|
|
644
816
|
return _regenerator().w(function (_context1) {
|
|
645
817
|
while (1) switch (_context1.n) {
|
|
646
818
|
case 0:
|
|
647
|
-
|
|
648
|
-
|
|
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
|
+
});
|
|
649
827
|
_context1.n = 1;
|
|
650
|
-
return store.dispatch(actions.
|
|
828
|
+
return store.dispatch(actions.getUserAccounts(99));
|
|
651
829
|
case 1:
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
expect(store.getActions()).toEqual(
|
|
657
|
-
expect(orderHistoryActions.getOpenOrders).toHaveBeenCalled();
|
|
658
|
-
expect(orderHistoryActions.getOrders).toHaveBeenCalled();
|
|
659
|
-
expect(orderHistoryActions.getAccountTrades).toHaveBeenCalled();
|
|
660
|
-
expect(orderHistoryActions.getOpenTradeReports).toHaveBeenCalled();
|
|
661
|
-
expect(depositActions.getDepositTickets).toHaveBeenCalled();
|
|
662
|
-
expect(withdrawActions.getWithdrawTickets).toHaveBeenCalled();
|
|
663
|
-
expect(orderHistoryActions.subscribeToOrderHistory).toHaveBeenCalled();
|
|
664
|
-
expect(transferActions.getTransfers).toHaveBeenCalled();
|
|
665
|
-
expect(positionActions.getAccountPositions).toHaveBeenCalled();
|
|
666
|
-
expect(positionActions.subscribeToAccountPositionEvents).toHaveBeenCalled();
|
|
667
|
-
expect(positionActions.selectPosition).toHaveBeenCalled();
|
|
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()]);
|
|
668
835
|
case 2:
|
|
669
836
|
return _context1.a(2);
|
|
670
837
|
}
|
|
671
838
|
}, _callee1);
|
|
672
839
|
})));
|
|
673
|
-
it('should
|
|
674
|
-
var
|
|
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;
|
|
675
842
|
return _regenerator().w(function (_context10) {
|
|
676
843
|
while (1) switch (_context10.n) {
|
|
677
844
|
case 0:
|
|
678
|
-
|
|
679
|
-
global.localStorage.getItem = function (item) {
|
|
680
|
-
return item === 'selectedPositionId' ? selectedPositionId : 0;
|
|
681
|
-
};
|
|
845
|
+
_apex["default"].connection.setRPCPromiseReturnValueForEndpoint('GetUserAccounts', Promise.reject(new Error('fail')));
|
|
682
846
|
_context10.n = 1;
|
|
683
|
-
return store.dispatch(actions.
|
|
847
|
+
return store.dispatch(actions.getUserAccounts(99));
|
|
684
848
|
case 1:
|
|
685
|
-
|
|
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()]);
|
|
686
853
|
case 2:
|
|
687
854
|
return _context10.a(2);
|
|
688
855
|
}
|
|
689
856
|
}, _callee10);
|
|
690
857
|
})));
|
|
691
|
-
|
|
692
|
-
|
|
858
|
+
});
|
|
859
|
+
describe('selectAccount', function () {
|
|
860
|
+
it('should dispatch expected thunks after select account if privateMarketData = false', /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee11() {
|
|
861
|
+
var accountId, expectedActions;
|
|
693
862
|
return _regenerator().w(function (_context11) {
|
|
694
863
|
while (1) switch (_context11.n) {
|
|
695
864
|
case 0:
|
|
696
|
-
|
|
697
|
-
global.localStorage.getItem = function (item) {
|
|
698
|
-
return item === 'selectedPositionId' ? selectedPositionId : 0;
|
|
699
|
-
};
|
|
865
|
+
accountId = 1;
|
|
700
866
|
_context11.n = 1;
|
|
701
867
|
return store.dispatch(actions.selectAccount(1, 1));
|
|
702
868
|
case 1:
|
|
703
|
-
|
|
869
|
+
expectedActions = [{
|
|
870
|
+
type: actions.SET_ACCOUNT,
|
|
871
|
+
payload: accountId
|
|
872
|
+
}];
|
|
873
|
+
expect(store.getActions()).toEqual(expect.arrayContaining(expectedActions));
|
|
874
|
+
expect(orderHistoryActions.getOrders).not.toHaveBeenCalled();
|
|
875
|
+
expect(orderHistoryActions.subscribeToOrderHistory).toHaveBeenCalled();
|
|
876
|
+
expect(orderHistoryActions.subscribeToMarginCancelOrderLiquidationEvents).toHaveBeenCalled();
|
|
877
|
+
expect(withdrawActions.subscribeToWithdrawalTickets).toHaveBeenCalled();
|
|
878
|
+
expect(transferActions.getTransfers).toHaveBeenCalled();
|
|
879
|
+
expect(positionActions.getAccountPositions).toHaveBeenCalled();
|
|
880
|
+
expect(positionActions.subscribeToAccountPositionEvents).toHaveBeenCalled();
|
|
704
881
|
case 2:
|
|
705
882
|
return _context11.a(2);
|
|
706
883
|
}
|
|
707
884
|
}, _callee11);
|
|
708
885
|
})));
|
|
886
|
+
it('should dispatch expected thunks after select account if privateMarketData = true', /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee12() {
|
|
887
|
+
var accountId, expectedActions;
|
|
888
|
+
return _regenerator().w(function (_context12) {
|
|
889
|
+
while (1) switch (_context12.n) {
|
|
890
|
+
case 0:
|
|
891
|
+
_config["default"].setPrivateMarketData(true);
|
|
892
|
+
accountId = 1;
|
|
893
|
+
_context12.n = 1;
|
|
894
|
+
return store.dispatch(actions.selectAccount(1, 1));
|
|
895
|
+
case 1:
|
|
896
|
+
expectedActions = [{
|
|
897
|
+
type: actions.SET_ACCOUNT,
|
|
898
|
+
payload: accountId
|
|
899
|
+
}];
|
|
900
|
+
expect(store.getActions()).toEqual(expect.arrayContaining(expectedActions));
|
|
901
|
+
expect(orderHistoryActions.getOrders).toHaveBeenCalled();
|
|
902
|
+
expect(orderHistoryActions.subscribeToOrderHistory).toHaveBeenCalled();
|
|
903
|
+
expect(orderHistoryActions.subscribeToMarginCancelOrderLiquidationEvents).toHaveBeenCalled();
|
|
904
|
+
expect(withdrawActions.subscribeToWithdrawalTickets).toHaveBeenCalled();
|
|
905
|
+
expect(transferActions.getTransfers).toHaveBeenCalled();
|
|
906
|
+
expect(positionActions.getAccountPositions).toHaveBeenCalled();
|
|
907
|
+
expect(positionActions.subscribeToAccountPositionEvents).toHaveBeenCalled();
|
|
908
|
+
case 2:
|
|
909
|
+
return _context12.a(2);
|
|
910
|
+
}
|
|
911
|
+
}, _callee12);
|
|
912
|
+
})));
|
|
709
913
|
});
|
|
710
914
|
describe('updateAccount', function () {
|
|
711
915
|
var store;
|
|
712
916
|
beforeEach(function () {
|
|
713
917
|
jest.clearAllMocks();
|
|
918
|
+
_apex["default"].connection.resetRPCPromiseResponses();
|
|
714
919
|
store = mockStore({
|
|
715
920
|
user: {
|
|
716
921
|
userInfo: {
|
|
@@ -720,59 +925,54 @@ describe('userActions', function () {
|
|
|
720
925
|
accounts: [{
|
|
721
926
|
AccountId: 1
|
|
722
927
|
}]
|
|
928
|
+
},
|
|
929
|
+
api: {
|
|
930
|
+
validate2FARequiredEndpoints: {}
|
|
723
931
|
}
|
|
724
932
|
});
|
|
725
933
|
});
|
|
726
|
-
it('should call UpdateAccount from apex', /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
727
|
-
return _regenerator().w(function (_context12) {
|
|
728
|
-
while (1) switch (_context12.n) {
|
|
729
|
-
case 0:
|
|
730
|
-
_context12.n = 1;
|
|
731
|
-
return store.dispatch(actions.updateAccount());
|
|
732
|
-
case 1:
|
|
733
|
-
expect(_apex["default"].connection.UpdateAccount).toHaveBeenCalled();
|
|
734
|
-
case 2:
|
|
735
|
-
return _context12.a(2);
|
|
736
|
-
}
|
|
737
|
-
}, _callee12);
|
|
738
|
-
})));
|
|
739
|
-
it('should call UpdateAccount from apex with params if loyaltyProduct is passed', /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee13() {
|
|
740
|
-
var loyaltyProduct;
|
|
934
|
+
it('should call UpdateAccount from apex', /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee13() {
|
|
741
935
|
return _regenerator().w(function (_context13) {
|
|
742
936
|
while (1) switch (_context13.n) {
|
|
743
937
|
case 0:
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
938
|
+
_apex["default"].connection.setRPCPromiseReturnValueForEndpoint('UpdateAccount', {
|
|
939
|
+
o: JSON.stringify({
|
|
940
|
+
result: false
|
|
941
|
+
})
|
|
942
|
+
});
|
|
748
943
|
_context13.n = 1;
|
|
749
|
-
return store.dispatch(actions.updateAccount(
|
|
944
|
+
return store.dispatch(actions.updateAccount());
|
|
750
945
|
case 1:
|
|
751
|
-
expect(_apex["default"].connection.
|
|
946
|
+
expect(_apex["default"].connection.RPCPromise).toHaveBeenCalledWith('UpdateAccount', {
|
|
752
947
|
AccountId: 1,
|
|
753
|
-
LoyaltyEnabled:
|
|
754
|
-
LoyaltyProductId:
|
|
948
|
+
LoyaltyEnabled: false,
|
|
949
|
+
LoyaltyProductId: 0
|
|
755
950
|
});
|
|
756
951
|
case 2:
|
|
757
952
|
return _context13.a(2);
|
|
758
953
|
}
|
|
759
954
|
}, _callee13);
|
|
760
955
|
})));
|
|
761
|
-
it('should call UpdateAccount from apex with params if loyaltyProduct is passed
|
|
956
|
+
it('should call UpdateAccount from apex with params if loyaltyProduct is passed', /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee14() {
|
|
762
957
|
var loyaltyProduct;
|
|
763
958
|
return _regenerator().w(function (_context14) {
|
|
764
959
|
while (1) switch (_context14.n) {
|
|
765
960
|
case 0:
|
|
961
|
+
_apex["default"].connection.setRPCPromiseReturnValueForEndpoint('UpdateAccount', {
|
|
962
|
+
o: JSON.stringify({
|
|
963
|
+
result: false
|
|
964
|
+
})
|
|
965
|
+
});
|
|
766
966
|
loyaltyProduct = {
|
|
767
967
|
ProductId: 2,
|
|
768
|
-
Amount:
|
|
968
|
+
Amount: 1
|
|
769
969
|
};
|
|
770
970
|
_context14.n = 1;
|
|
771
971
|
return store.dispatch(actions.updateAccount(loyaltyProduct));
|
|
772
972
|
case 1:
|
|
773
|
-
expect(_apex["default"].connection.
|
|
973
|
+
expect(_apex["default"].connection.RPCPromise).toHaveBeenCalledWith('UpdateAccount', {
|
|
774
974
|
AccountId: 1,
|
|
775
|
-
LoyaltyEnabled:
|
|
975
|
+
LoyaltyEnabled: true,
|
|
776
976
|
LoyaltyProductId: 2
|
|
777
977
|
});
|
|
778
978
|
case 2:
|
|
@@ -780,60 +980,74 @@ describe('userActions', function () {
|
|
|
780
980
|
}
|
|
781
981
|
}, _callee14);
|
|
782
982
|
})));
|
|
783
|
-
it('should
|
|
983
|
+
it('should call UpdateAccount from apex with params if loyaltyProduct is passed and Amount === 0', /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee15() {
|
|
984
|
+
var loyaltyProduct;
|
|
784
985
|
return _regenerator().w(function (_context15) {
|
|
785
986
|
while (1) switch (_context15.n) {
|
|
786
987
|
case 0:
|
|
787
|
-
_apex["default"].connection.
|
|
788
|
-
|
|
988
|
+
_apex["default"].connection.setRPCPromiseReturnValueForEndpoint('UpdateAccount', {
|
|
989
|
+
o: JSON.stringify({
|
|
990
|
+
result: false
|
|
991
|
+
})
|
|
789
992
|
});
|
|
993
|
+
loyaltyProduct = {
|
|
994
|
+
ProductId: 2,
|
|
995
|
+
Amount: 0
|
|
996
|
+
};
|
|
790
997
|
_context15.n = 1;
|
|
791
|
-
return store.dispatch(actions.updateAccount());
|
|
998
|
+
return store.dispatch(actions.updateAccount(loyaltyProduct));
|
|
792
999
|
case 1:
|
|
793
|
-
expect(_apex["default"].connection.
|
|
1000
|
+
expect(_apex["default"].connection.RPCPromise).toHaveBeenCalledWith('UpdateAccount', {
|
|
1001
|
+
AccountId: 1,
|
|
1002
|
+
LoyaltyEnabled: false,
|
|
1003
|
+
LoyaltyProductId: 2
|
|
1004
|
+
});
|
|
794
1005
|
case 2:
|
|
795
1006
|
return _context15.a(2);
|
|
796
1007
|
}
|
|
797
1008
|
}, _callee15);
|
|
798
1009
|
})));
|
|
799
|
-
it('should dispatch
|
|
1010
|
+
it('should dispatch expected action if response result is true', /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee16() {
|
|
800
1011
|
return _regenerator().w(function (_context16) {
|
|
801
1012
|
while (1) switch (_context16.n) {
|
|
802
1013
|
case 0:
|
|
803
|
-
_apex["default"].connection.
|
|
804
|
-
|
|
1014
|
+
_apex["default"].connection.setRPCPromiseReturnValueForEndpoint('UpdateAccount', {
|
|
1015
|
+
o: JSON.stringify({
|
|
1016
|
+
result: true
|
|
1017
|
+
})
|
|
1018
|
+
});
|
|
1019
|
+
_apex["default"].connection.setRPCPromiseReturnValueForEndpoint('GetUserAccounts', {
|
|
1020
|
+
o: JSON.stringify([])
|
|
805
1021
|
});
|
|
806
1022
|
_context16.n = 1;
|
|
807
1023
|
return store.dispatch(actions.updateAccount());
|
|
808
1024
|
case 1:
|
|
809
|
-
expect(
|
|
810
|
-
|
|
811
|
-
text: 'Fee token successfully unset',
|
|
812
|
-
type: 'success'
|
|
1025
|
+
expect(_apex["default"].connection.RPCPromise).toHaveBeenCalledWith('GetUserAccounts', {
|
|
1026
|
+
OMSId: 1
|
|
813
1027
|
});
|
|
814
1028
|
case 2:
|
|
815
1029
|
return _context16.a(2);
|
|
816
1030
|
}
|
|
817
1031
|
}, _callee16);
|
|
818
1032
|
})));
|
|
819
|
-
it('should dispatch showSnack if response result is true
|
|
820
|
-
var loyaltyProduct;
|
|
1033
|
+
it('should dispatch showSnack if response result is true', /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee17() {
|
|
821
1034
|
return _regenerator().w(function (_context17) {
|
|
822
1035
|
while (1) switch (_context17.n) {
|
|
823
1036
|
case 0:
|
|
824
|
-
_apex["default"].connection.
|
|
825
|
-
|
|
1037
|
+
_apex["default"].connection.setRPCPromiseReturnValueForEndpoint('UpdateAccount', {
|
|
1038
|
+
o: JSON.stringify({
|
|
1039
|
+
result: true
|
|
1040
|
+
})
|
|
1041
|
+
});
|
|
1042
|
+
_apex["default"].connection.setRPCPromiseReturnValueForEndpoint('GetUserAccounts', {
|
|
1043
|
+
o: JSON.stringify([])
|
|
826
1044
|
});
|
|
827
|
-
loyaltyProduct = {
|
|
828
|
-
ProductId: 2,
|
|
829
|
-
Amount: 0
|
|
830
|
-
};
|
|
831
1045
|
_context17.n = 1;
|
|
832
|
-
return store.dispatch(actions.updateAccount(
|
|
1046
|
+
return store.dispatch(actions.updateAccount());
|
|
833
1047
|
case 1:
|
|
834
1048
|
expect(snackbarActions.showSnack).toHaveBeenCalledWith({
|
|
835
1049
|
id: 'UpdateAccountSuccess',
|
|
836
|
-
text: 'Fee token successfully
|
|
1050
|
+
text: 'Fee token successfully unset',
|
|
837
1051
|
type: 'success'
|
|
838
1052
|
});
|
|
839
1053
|
case 2:
|
|
@@ -841,48 +1055,87 @@ describe('userActions', function () {
|
|
|
841
1055
|
}
|
|
842
1056
|
}, _callee17);
|
|
843
1057
|
})));
|
|
844
|
-
it('should dispatch showSnack if response result is
|
|
1058
|
+
it('should dispatch showSnack if response result is true and loyaltyProduct is passed', /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee18() {
|
|
1059
|
+
var loyaltyProduct;
|
|
845
1060
|
return _regenerator().w(function (_context18) {
|
|
846
1061
|
while (1) switch (_context18.n) {
|
|
847
1062
|
case 0:
|
|
848
|
-
_apex["default"].connection.
|
|
849
|
-
|
|
1063
|
+
_apex["default"].connection.setRPCPromiseReturnValueForEndpoint('UpdateAccount', {
|
|
1064
|
+
o: JSON.stringify({
|
|
1065
|
+
result: true
|
|
1066
|
+
})
|
|
1067
|
+
});
|
|
1068
|
+
_apex["default"].connection.setRPCPromiseReturnValueForEndpoint('GetUserAccounts', {
|
|
1069
|
+
o: JSON.stringify([])
|
|
850
1070
|
});
|
|
1071
|
+
loyaltyProduct = {
|
|
1072
|
+
ProductId: 2,
|
|
1073
|
+
Amount: 0
|
|
1074
|
+
};
|
|
851
1075
|
_context18.n = 1;
|
|
852
|
-
return store.dispatch(actions.updateAccount());
|
|
1076
|
+
return store.dispatch(actions.updateAccount(loyaltyProduct));
|
|
853
1077
|
case 1:
|
|
854
|
-
expect(snackbarActions.showSnack).
|
|
1078
|
+
expect(snackbarActions.showSnack).toHaveBeenCalledWith({
|
|
1079
|
+
id: 'UpdateAccountSuccess',
|
|
1080
|
+
text: 'Fee token successfully set',
|
|
1081
|
+
type: 'success'
|
|
1082
|
+
});
|
|
855
1083
|
case 2:
|
|
856
1084
|
return _context18.a(2);
|
|
857
1085
|
}
|
|
858
1086
|
}, _callee18);
|
|
859
1087
|
})));
|
|
860
|
-
|
|
861
|
-
describe('setUserInfo', function () {
|
|
862
|
-
it('should call apex.connection.SetUserInfo', /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee19() {
|
|
863
|
-
var userInfo, user;
|
|
1088
|
+
it('should dispatch showSnack if response result is false', /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee19() {
|
|
864
1089
|
return _regenerator().w(function (_context19) {
|
|
865
1090
|
while (1) switch (_context19.n) {
|
|
866
1091
|
case 0:
|
|
867
|
-
|
|
1092
|
+
_apex["default"].connection.setRPCPromiseReturnValueForEndpoint('UpdateAccount', {
|
|
1093
|
+
o: JSON.stringify({
|
|
1094
|
+
result: false
|
|
1095
|
+
})
|
|
1096
|
+
});
|
|
1097
|
+
_context19.n = 1;
|
|
1098
|
+
return store.dispatch(actions.updateAccount());
|
|
1099
|
+
case 1:
|
|
1100
|
+
expect(snackbarActions.showSnack).toHaveBeenCalled();
|
|
1101
|
+
case 2:
|
|
1102
|
+
return _context19.a(2);
|
|
1103
|
+
}
|
|
1104
|
+
}, _callee19);
|
|
1105
|
+
})));
|
|
1106
|
+
});
|
|
1107
|
+
describe('setUserInfo', function () {
|
|
1108
|
+
beforeEach(function () {
|
|
1109
|
+
_apex["default"].connection.resetRPCPromiseResponses();
|
|
1110
|
+
});
|
|
1111
|
+
it('should call apex.connection.RPCPromise with SetUserInfo', /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee20() {
|
|
1112
|
+
var user;
|
|
1113
|
+
return _regenerator().w(function (_context20) {
|
|
1114
|
+
while (1) switch (_context20.n) {
|
|
1115
|
+
case 0:
|
|
868
1116
|
user = {
|
|
869
1117
|
UserName: 'UserName',
|
|
870
1118
|
Email: 'example@gmail.com'
|
|
871
1119
|
};
|
|
872
|
-
_apex["default"].connection.
|
|
873
|
-
|
|
1120
|
+
_apex["default"].connection.setRPCPromiseReturnValueForEndpoint('SetUserInfo', {
|
|
1121
|
+
o: JSON.stringify({})
|
|
1122
|
+
});
|
|
1123
|
+
_context20.n = 1;
|
|
874
1124
|
return actions.setUserInfo(user)(dispatchStub);
|
|
875
1125
|
case 1:
|
|
876
|
-
expect(_apex["default"].connection.
|
|
1126
|
+
expect(_apex["default"].connection.RPCPromise).toHaveBeenCalledWith('SetUserInfo', {
|
|
1127
|
+
UserName: undefined,
|
|
1128
|
+
Email: undefined
|
|
1129
|
+
});
|
|
877
1130
|
case 2:
|
|
878
|
-
return
|
|
1131
|
+
return _context20.a(2);
|
|
879
1132
|
}
|
|
880
|
-
},
|
|
1133
|
+
}, _callee20);
|
|
881
1134
|
})));
|
|
882
|
-
it('should dispatch expected actions after set user info', /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
1135
|
+
it('should dispatch expected actions after set user info', /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee21() {
|
|
883
1136
|
var userInfo, user, expectedActions;
|
|
884
|
-
return _regenerator().w(function (
|
|
885
|
-
while (1) switch (
|
|
1137
|
+
return _regenerator().w(function (_context21) {
|
|
1138
|
+
while (1) switch (_context21.n) {
|
|
886
1139
|
case 0:
|
|
887
1140
|
userInfo = {
|
|
888
1141
|
result: true
|
|
@@ -894,23 +1147,23 @@ describe('userActions', function () {
|
|
|
894
1147
|
expectedActions = [{
|
|
895
1148
|
type: actions.USER_INFO_FETCHED,
|
|
896
1149
|
payload: userInfo
|
|
897
|
-
}, {
|
|
898
|
-
type: 'changeLanguage'
|
|
899
1150
|
}];
|
|
900
|
-
_apex["default"].connection.
|
|
901
|
-
|
|
1151
|
+
_apex["default"].connection.setRPCPromiseReturnValueForEndpoint('SetUserInfo', {
|
|
1152
|
+
o: JSON.stringify(userInfo)
|
|
1153
|
+
});
|
|
1154
|
+
_context21.n = 1;
|
|
902
1155
|
return store.dispatch(actions.setUserInfo(user));
|
|
903
1156
|
case 1:
|
|
904
1157
|
expect(store.getActions()).toEqual(expect.arrayContaining(expectedActions));
|
|
905
1158
|
case 2:
|
|
906
|
-
return
|
|
1159
|
+
return _context21.a(2);
|
|
907
1160
|
}
|
|
908
|
-
},
|
|
1161
|
+
}, _callee21);
|
|
909
1162
|
})));
|
|
910
|
-
it('should dispatch expected actions after failed set user info', /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
1163
|
+
it('should dispatch expected actions after failed set user info', /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee22() {
|
|
911
1164
|
var userInfo, user;
|
|
912
|
-
return _regenerator().w(function (
|
|
913
|
-
while (1) switch (
|
|
1165
|
+
return _regenerator().w(function (_context22) {
|
|
1166
|
+
while (1) switch (_context22.n) {
|
|
914
1167
|
case 0:
|
|
915
1168
|
userInfo = {
|
|
916
1169
|
result: false
|
|
@@ -919,48 +1172,64 @@ describe('userActions', function () {
|
|
|
919
1172
|
UserName: 'UserName',
|
|
920
1173
|
Email: 'example@gmail.com'
|
|
921
1174
|
};
|
|
922
|
-
_apex["default"].connection.
|
|
923
|
-
|
|
1175
|
+
_apex["default"].connection.setRPCPromiseReturnValueForEndpoint('SetUserInfo', {
|
|
1176
|
+
o: JSON.stringify(userInfo)
|
|
1177
|
+
});
|
|
1178
|
+
_context22.n = 1;
|
|
924
1179
|
return store.dispatch(actions.setUserInfo(user));
|
|
925
1180
|
case 1:
|
|
926
1181
|
expect(snackbarActions.showSnack).toHaveBeenCalled();
|
|
927
1182
|
case 2:
|
|
928
|
-
return
|
|
1183
|
+
return _context22.a(2);
|
|
929
1184
|
}
|
|
930
|
-
},
|
|
1185
|
+
}, _callee22);
|
|
931
1186
|
})));
|
|
932
1187
|
});
|
|
933
1188
|
describe('setUserConfig', function () {
|
|
934
1189
|
beforeEach(function () {
|
|
935
1190
|
jest.clearAllMocks();
|
|
936
|
-
_apex["default"].connection.
|
|
937
|
-
|
|
1191
|
+
_apex["default"].connection.resetRPCPromiseResponses();
|
|
1192
|
+
_apex["default"].connection.setRPCPromiseReturnValueForEndpoint('GetUserConfig', {
|
|
1193
|
+
o: JSON.stringify({
|
|
1194
|
+
foo: 'foo'
|
|
1195
|
+
})
|
|
938
1196
|
});
|
|
939
1197
|
});
|
|
940
|
-
it('should call apex.connection.SetUserConfig', /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
941
|
-
return _regenerator().w(function (
|
|
942
|
-
while (1) switch (
|
|
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) {
|
|
943
1201
|
case 0:
|
|
944
|
-
|
|
1202
|
+
_apex["default"].connection.setRPCPromiseReturnValueForEndpoint('SetUserConfig', {
|
|
1203
|
+
o: JSON.stringify({
|
|
1204
|
+
result: false
|
|
1205
|
+
})
|
|
1206
|
+
});
|
|
1207
|
+
_context23.n = 1;
|
|
945
1208
|
return store.dispatch(actions.setUserConfig());
|
|
946
1209
|
case 1:
|
|
947
|
-
expect(_apex["default"].connection.
|
|
1210
|
+
expect(_apex["default"].connection.RPCPromise).toHaveBeenCalledWith('SetUserConfig', {
|
|
1211
|
+
UserId: undefined,
|
|
1212
|
+
UserName: undefined,
|
|
1213
|
+
Config: undefined
|
|
1214
|
+
});
|
|
948
1215
|
case 2:
|
|
949
|
-
return
|
|
1216
|
+
return _context23.a(2);
|
|
950
1217
|
}
|
|
951
|
-
},
|
|
1218
|
+
}, _callee23);
|
|
952
1219
|
})));
|
|
953
|
-
it('should dispatch expected actions after set user config', /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
954
|
-
return _regenerator().w(function (
|
|
955
|
-
while (1) switch (
|
|
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) {
|
|
956
1223
|
case 0:
|
|
957
|
-
_apex["default"].connection.
|
|
958
|
-
|
|
1224
|
+
_apex["default"].connection.setRPCPromiseReturnValueForEndpoint('SetUserConfig', {
|
|
1225
|
+
o: JSON.stringify({
|
|
1226
|
+
result: true
|
|
1227
|
+
})
|
|
959
1228
|
});
|
|
960
|
-
|
|
1229
|
+
_context24.n = 1;
|
|
961
1230
|
return store.dispatch(actions.setUserConfig());
|
|
962
1231
|
case 1:
|
|
963
|
-
return
|
|
1232
|
+
return _context24.a(2, new Promise(function (resolve, reject) {
|
|
964
1233
|
setTimeout(function () {
|
|
965
1234
|
try {
|
|
966
1235
|
expect(store.getActions()).toEqual([{
|
|
@@ -976,31 +1245,36 @@ describe('userActions', function () {
|
|
|
976
1245
|
}, 0);
|
|
977
1246
|
}));
|
|
978
1247
|
}
|
|
979
|
-
},
|
|
1248
|
+
}, _callee24);
|
|
980
1249
|
})));
|
|
981
|
-
it('should dispatch expected actions after failed set user config', /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
982
|
-
return _regenerator().w(function (
|
|
983
|
-
while (1) switch (
|
|
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) {
|
|
984
1253
|
case 0:
|
|
985
|
-
_apex["default"].connection.
|
|
986
|
-
|
|
1254
|
+
_apex["default"].connection.setRPCPromiseReturnValueForEndpoint('SetUserConfig', {
|
|
1255
|
+
o: JSON.stringify({
|
|
1256
|
+
result: false
|
|
1257
|
+
})
|
|
987
1258
|
});
|
|
988
|
-
|
|
1259
|
+
_context25.n = 1;
|
|
989
1260
|
return store.dispatch(actions.setUserConfig());
|
|
990
1261
|
case 1:
|
|
991
1262
|
expect(snackbarActions.showSnack).toHaveBeenCalled();
|
|
992
1263
|
case 2:
|
|
993
|
-
return
|
|
1264
|
+
return _context25.a(2);
|
|
994
1265
|
}
|
|
995
|
-
},
|
|
1266
|
+
}, _callee25);
|
|
996
1267
|
})));
|
|
997
1268
|
});
|
|
998
1269
|
describe('enable2FA', function () {
|
|
999
|
-
it('should call apex.connection.Authenticate2FA', /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
1270
|
+
it('should call apex.connection.Authenticate2FA', /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee26() {
|
|
1000
1271
|
var getState;
|
|
1001
|
-
return _regenerator().w(function (
|
|
1002
|
-
while (1) switch (
|
|
1272
|
+
return _regenerator().w(function (_context26) {
|
|
1273
|
+
while (1) switch (_context26.n) {
|
|
1003
1274
|
case 0:
|
|
1275
|
+
_apex["default"].connection.setResponse({
|
|
1276
|
+
Authenticated: true
|
|
1277
|
+
});
|
|
1004
1278
|
getState = jest.fn(function () {
|
|
1005
1279
|
return {
|
|
1006
1280
|
user: {
|
|
@@ -1010,23 +1284,23 @@ describe('userActions', function () {
|
|
|
1010
1284
|
}
|
|
1011
1285
|
};
|
|
1012
1286
|
});
|
|
1013
|
-
|
|
1287
|
+
_context26.n = 1;
|
|
1014
1288
|
return actions.enable2FA()(dispatchStub, getState);
|
|
1015
1289
|
case 1:
|
|
1016
1290
|
expect(_apex["default"].connection.Authenticate2FA).toHaveBeenCalled();
|
|
1017
1291
|
case 2:
|
|
1018
|
-
return
|
|
1292
|
+
return _context26.a(2);
|
|
1019
1293
|
}
|
|
1020
|
-
},
|
|
1294
|
+
}, _callee26);
|
|
1021
1295
|
})));
|
|
1022
|
-
it('should dispatch expected actions after enable2FA', /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
1023
|
-
return _regenerator().w(function (
|
|
1024
|
-
while (1) switch (
|
|
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) {
|
|
1025
1299
|
case 0:
|
|
1026
1300
|
_apex["default"].connection.setResponse({
|
|
1027
1301
|
Authenticated: true
|
|
1028
1302
|
});
|
|
1029
|
-
|
|
1303
|
+
_context27.n = 1;
|
|
1030
1304
|
return store.dispatch(actions.enable2FA());
|
|
1031
1305
|
case 1:
|
|
1032
1306
|
expect(store.getActions()).toContainEqual({
|
|
@@ -1041,32 +1315,32 @@ describe('userActions', function () {
|
|
|
1041
1315
|
});
|
|
1042
1316
|
expect(snackbarActions.showSnack).toHaveBeenCalled();
|
|
1043
1317
|
case 2:
|
|
1044
|
-
return
|
|
1318
|
+
return _context27.a(2);
|
|
1045
1319
|
}
|
|
1046
|
-
},
|
|
1320
|
+
}, _callee27);
|
|
1047
1321
|
})));
|
|
1048
|
-
it('should dispatch expected actions after failed enable2FA', /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
1049
|
-
return _regenerator().w(function (
|
|
1050
|
-
while (1) switch (
|
|
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) {
|
|
1051
1325
|
case 0:
|
|
1052
1326
|
_apex["default"].connection.setResponse({
|
|
1053
1327
|
Authenticated: false
|
|
1054
1328
|
});
|
|
1055
|
-
|
|
1329
|
+
_context28.n = 1;
|
|
1056
1330
|
return store.dispatch(actions.enable2FA());
|
|
1057
1331
|
case 1:
|
|
1058
1332
|
expect(snackbarActions.showSnack).toHaveBeenCalled();
|
|
1059
1333
|
case 2:
|
|
1060
|
-
return
|
|
1334
|
+
return _context28.a(2);
|
|
1061
1335
|
}
|
|
1062
|
-
},
|
|
1336
|
+
}, _callee28);
|
|
1063
1337
|
})));
|
|
1064
1338
|
});
|
|
1065
1339
|
describe('disable2FA', function () {
|
|
1066
|
-
it('should call apex.connection.Disable2FA andapex.connection.Authenticate2FA', /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
1340
|
+
it('should call apex.connection.Disable2FA andapex.connection.Authenticate2FA', /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee29() {
|
|
1067
1341
|
var getState;
|
|
1068
|
-
return _regenerator().w(function (
|
|
1069
|
-
while (1) switch (
|
|
1342
|
+
return _regenerator().w(function (_context29) {
|
|
1343
|
+
while (1) switch (_context29.n) {
|
|
1070
1344
|
case 0:
|
|
1071
1345
|
getState = jest.fn(function () {
|
|
1072
1346
|
return {
|
|
@@ -1078,24 +1352,33 @@ describe('userActions', function () {
|
|
|
1078
1352
|
}
|
|
1079
1353
|
};
|
|
1080
1354
|
});
|
|
1081
|
-
|
|
1355
|
+
_apex["default"].connection.setRPCPromiseReturnValue(Promise.resolve({
|
|
1356
|
+
o: JSON.stringify({
|
|
1357
|
+
Authenticated: true
|
|
1358
|
+
})
|
|
1359
|
+
}));
|
|
1360
|
+
_context29.n = 1;
|
|
1082
1361
|
return actions.disable2FA()(dispatchStub, getState);
|
|
1083
1362
|
case 1:
|
|
1084
1363
|
expect(_apex["default"].connection.Disable2FA).toHaveBeenCalled();
|
|
1085
|
-
expect(_apex["default"].connection.
|
|
1364
|
+
expect(_apex["default"].connection.RPCPromise).toHaveBeenCalledWith('Authenticate2FA', {
|
|
1365
|
+
Code: undefined
|
|
1366
|
+
});
|
|
1086
1367
|
case 2:
|
|
1087
|
-
return
|
|
1368
|
+
return _context29.a(2);
|
|
1088
1369
|
}
|
|
1089
|
-
},
|
|
1370
|
+
}, _callee29);
|
|
1090
1371
|
})));
|
|
1091
|
-
it('should dispatch expected actions after disable2FA', /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
1092
|
-
return _regenerator().w(function (
|
|
1093
|
-
while (1) switch (
|
|
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) {
|
|
1094
1375
|
case 0:
|
|
1095
|
-
_apex["default"].connection.
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1376
|
+
_apex["default"].connection.setRPCPromiseReturnValue(Promise.resolve({
|
|
1377
|
+
o: JSON.stringify({
|
|
1378
|
+
Authenticated: true
|
|
1379
|
+
})
|
|
1380
|
+
}));
|
|
1381
|
+
_context30.n = 1;
|
|
1099
1382
|
return store.dispatch(actions.disable2FA());
|
|
1100
1383
|
case 1:
|
|
1101
1384
|
expect(store.getActions()).toContainEqual({
|
|
@@ -1107,49 +1390,51 @@ describe('userActions', function () {
|
|
|
1107
1390
|
expect(_modalActions.closeModal).toHaveBeenCalledWith(_modalActions.MODAL_TYPES.DISABLE_2FA);
|
|
1108
1391
|
expect(snackbarActions.showSnack).toHaveBeenCalled();
|
|
1109
1392
|
case 2:
|
|
1110
|
-
return
|
|
1393
|
+
return _context30.a(2);
|
|
1111
1394
|
}
|
|
1112
|
-
},
|
|
1395
|
+
}, _callee30);
|
|
1113
1396
|
})));
|
|
1114
|
-
it('should dispatch expected actions after failed disable2FA', /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
1115
|
-
return _regenerator().w(function (
|
|
1116
|
-
while (1) switch (
|
|
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) {
|
|
1117
1400
|
case 0:
|
|
1118
|
-
_apex["default"].connection.
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1401
|
+
_apex["default"].connection.setRPCPromiseReturnValue(Promise.resolve({
|
|
1402
|
+
o: JSON.stringify({
|
|
1403
|
+
Authenticated: false
|
|
1404
|
+
})
|
|
1405
|
+
}));
|
|
1406
|
+
_context31.n = 1;
|
|
1122
1407
|
return store.dispatch(actions.disable2FA());
|
|
1123
1408
|
case 1:
|
|
1124
1409
|
expect(snackbarActions.showSnack).toHaveBeenCalled();
|
|
1125
1410
|
case 2:
|
|
1126
|
-
return
|
|
1411
|
+
return _context31.a(2);
|
|
1127
1412
|
}
|
|
1128
|
-
},
|
|
1413
|
+
}, _callee31);
|
|
1129
1414
|
})));
|
|
1130
1415
|
});
|
|
1131
1416
|
describe('getGoogleQrCode', function () {
|
|
1132
|
-
it('should call apex.connection.EnableGoogle2FA', /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
1133
|
-
return _regenerator().w(function (
|
|
1134
|
-
while (1) switch (
|
|
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) {
|
|
1135
1420
|
case 0:
|
|
1136
|
-
|
|
1421
|
+
_context32.n = 1;
|
|
1137
1422
|
return actions.getGoogleQrCode()(dispatchStub);
|
|
1138
1423
|
case 1:
|
|
1139
1424
|
expect(_apex["default"].connection.EnableGoogle2FA).toHaveBeenCalled();
|
|
1140
1425
|
case 2:
|
|
1141
|
-
return
|
|
1426
|
+
return _context32.a(2);
|
|
1142
1427
|
}
|
|
1143
|
-
},
|
|
1428
|
+
}, _callee32);
|
|
1144
1429
|
})));
|
|
1145
|
-
it('should dispatch expected actions after getGoogleQrCode', /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
1146
|
-
return _regenerator().w(function (
|
|
1147
|
-
while (1) switch (
|
|
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) {
|
|
1148
1433
|
case 0:
|
|
1149
1434
|
_apex["default"].connection.setResponse({
|
|
1150
1435
|
qrCode: 1234
|
|
1151
1436
|
});
|
|
1152
|
-
|
|
1437
|
+
_context33.n = 1;
|
|
1153
1438
|
return store.dispatch(actions.getGoogleQrCode());
|
|
1154
1439
|
case 1:
|
|
1155
1440
|
expect(store.getActions()).toEqual([{
|
|
@@ -1159,16 +1444,63 @@ describe('userActions', function () {
|
|
|
1159
1444
|
}
|
|
1160
1445
|
}]);
|
|
1161
1446
|
case 2:
|
|
1162
|
-
return
|
|
1447
|
+
return _context33.a(2);
|
|
1163
1448
|
}
|
|
1164
|
-
},
|
|
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);
|
|
1165
1497
|
})));
|
|
1166
1498
|
});
|
|
1167
1499
|
describe('getGoogle2FARecoveryCode', function () {
|
|
1168
|
-
it('should return recovery code', /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
1500
|
+
it('should return recovery code', /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee36() {
|
|
1169
1501
|
var code;
|
|
1170
|
-
return _regenerator().w(function (
|
|
1171
|
-
while (1) switch (
|
|
1502
|
+
return _regenerator().w(function (_context36) {
|
|
1503
|
+
while (1) switch (_context36.n) {
|
|
1172
1504
|
case 0:
|
|
1173
1505
|
code = 123212;
|
|
1174
1506
|
_apex["default"].connection.setRPCPromiseReturnValue(Promise.resolve({
|
|
@@ -1176,21 +1508,21 @@ describe('userActions', function () {
|
|
|
1176
1508
|
Authenticated: true
|
|
1177
1509
|
})
|
|
1178
1510
|
}));
|
|
1179
|
-
|
|
1511
|
+
_context36.n = 1;
|
|
1180
1512
|
return actions.getGoogle2FARecoveryCode(code)(dispatchStub);
|
|
1181
1513
|
case 1:
|
|
1182
1514
|
expect(_apex["default"].connection.RPCPromise).toHaveBeenCalledWith('GetGoogle2FARecoveryKey', {
|
|
1183
1515
|
Code: code
|
|
1184
1516
|
});
|
|
1185
1517
|
case 2:
|
|
1186
|
-
return
|
|
1518
|
+
return _context36.a(2);
|
|
1187
1519
|
}
|
|
1188
|
-
},
|
|
1520
|
+
}, _callee36);
|
|
1189
1521
|
})));
|
|
1190
|
-
it('should dispatch `showSnack` with warning if `Authenticated` = false', /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
1522
|
+
it('should dispatch `showSnack` with warning if `Authenticated` = false', /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee37() {
|
|
1191
1523
|
var code, errormsg;
|
|
1192
|
-
return _regenerator().w(function (
|
|
1193
|
-
while (1) switch (
|
|
1524
|
+
return _regenerator().w(function (_context37) {
|
|
1525
|
+
while (1) switch (_context37.n) {
|
|
1194
1526
|
case 0:
|
|
1195
1527
|
code = 123212;
|
|
1196
1528
|
errormsg = 'False';
|
|
@@ -1200,7 +1532,7 @@ describe('userActions', function () {
|
|
|
1200
1532
|
errormsg: errormsg
|
|
1201
1533
|
})
|
|
1202
1534
|
}));
|
|
1203
|
-
|
|
1535
|
+
_context37.n = 1;
|
|
1204
1536
|
return actions.getGoogle2FARecoveryCode(code)(dispatchStub);
|
|
1205
1537
|
case 1:
|
|
1206
1538
|
expect(snackbarActions.showSnack).toHaveBeenCalledWith({
|
|
@@ -1209,14 +1541,14 @@ describe('userActions', function () {
|
|
|
1209
1541
|
type: 'warning'
|
|
1210
1542
|
});
|
|
1211
1543
|
case 2:
|
|
1212
|
-
return
|
|
1544
|
+
return _context37.a(2);
|
|
1213
1545
|
}
|
|
1214
|
-
},
|
|
1546
|
+
}, _callee37);
|
|
1215
1547
|
})));
|
|
1216
|
-
it('should dispatch `change` with code if `Authenticated` = true', /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
1548
|
+
it('should dispatch `change` with code if `Authenticated` = true', /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee38() {
|
|
1217
1549
|
var code, RecoveryKey;
|
|
1218
|
-
return _regenerator().w(function (
|
|
1219
|
-
while (1) switch (
|
|
1550
|
+
return _regenerator().w(function (_context38) {
|
|
1551
|
+
while (1) switch (_context38.n) {
|
|
1220
1552
|
case 0:
|
|
1221
1553
|
code = 123212;
|
|
1222
1554
|
RecoveryKey = 123123;
|
|
@@ -1226,14 +1558,14 @@ describe('userActions', function () {
|
|
|
1226
1558
|
RecoveryKey: RecoveryKey
|
|
1227
1559
|
})
|
|
1228
1560
|
}));
|
|
1229
|
-
|
|
1561
|
+
_context38.n = 1;
|
|
1230
1562
|
return actions.getGoogle2FARecoveryCode(code)(dispatchStub);
|
|
1231
1563
|
case 1:
|
|
1232
1564
|
expect(_reduxForm.change).toHaveBeenCalledWith('google2FARecoveryKeyModal', 'recoveryKey', RecoveryKey);
|
|
1233
1565
|
case 2:
|
|
1234
|
-
return
|
|
1566
|
+
return _context38.a(2);
|
|
1235
1567
|
}
|
|
1236
|
-
},
|
|
1568
|
+
}, _callee38);
|
|
1237
1569
|
})));
|
|
1238
1570
|
});
|
|
1239
1571
|
describe('updateUserConfig', function () {
|
|
@@ -1312,8 +1644,16 @@ describe('userActions', function () {
|
|
|
1312
1644
|
userInfo: {
|
|
1313
1645
|
UserName: 'k-stas'
|
|
1314
1646
|
}
|
|
1647
|
+
},
|
|
1648
|
+
api: {
|
|
1649
|
+
validate2FARequiredEndpoints: {}
|
|
1315
1650
|
}
|
|
1316
1651
|
});
|
|
1652
|
+
_apex["default"].connection.setRPCPromiseReturnValueForEndpoint('ResetPassword', {
|
|
1653
|
+
o: JSON.stringify({
|
|
1654
|
+
result: true
|
|
1655
|
+
})
|
|
1656
|
+
});
|
|
1317
1657
|
store.dispatch(actions.submitResetPasswordForm());
|
|
1318
1658
|
expect(store.getActions()).toEqual([]);
|
|
1319
1659
|
});
|
|
@@ -1322,37 +1662,41 @@ describe('userActions', function () {
|
|
|
1322
1662
|
beforeEach(function () {
|
|
1323
1663
|
jest.clearAllMocks();
|
|
1324
1664
|
});
|
|
1325
|
-
it('should dispatch `sendResetPasswordEmail` and showSnack if response result is true', /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
1326
|
-
return _regenerator().w(function (
|
|
1327
|
-
while (1) switch (
|
|
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) {
|
|
1328
1668
|
case 0:
|
|
1329
|
-
_apex["default"].connection.
|
|
1330
|
-
|
|
1669
|
+
_apex["default"].connection.setRPCPromiseReturnValueForEndpoint('ResetPassword', {
|
|
1670
|
+
o: JSON.stringify({
|
|
1671
|
+
result: true
|
|
1672
|
+
})
|
|
1331
1673
|
});
|
|
1332
|
-
|
|
1674
|
+
_context39.n = 1;
|
|
1333
1675
|
return store.dispatch(actions.sendResetPasswordEmail());
|
|
1334
1676
|
case 1:
|
|
1335
1677
|
expect(snackbarActions.showSnack).toHaveBeenCalled();
|
|
1336
1678
|
case 2:
|
|
1337
|
-
return
|
|
1679
|
+
return _context39.a(2);
|
|
1338
1680
|
}
|
|
1339
|
-
},
|
|
1681
|
+
}, _callee39);
|
|
1340
1682
|
})));
|
|
1341
|
-
it('should dispatch `sendResetPasswordEmail` and showSnack if response result is false', /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
1342
|
-
return _regenerator().w(function (
|
|
1343
|
-
while (1) switch (
|
|
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) {
|
|
1344
1686
|
case 0:
|
|
1345
|
-
_apex["default"].connection.
|
|
1346
|
-
|
|
1687
|
+
_apex["default"].connection.setRPCPromiseReturnValueForEndpoint('ResetPassword', {
|
|
1688
|
+
o: JSON.stringify({
|
|
1689
|
+
result: false
|
|
1690
|
+
})
|
|
1347
1691
|
});
|
|
1348
|
-
|
|
1692
|
+
_context40.n = 1;
|
|
1349
1693
|
return store.dispatch(actions.sendResetPasswordEmail());
|
|
1350
1694
|
case 1:
|
|
1351
1695
|
expect(snackbarActions.showSnack).toHaveBeenCalled();
|
|
1352
1696
|
case 2:
|
|
1353
|
-
return
|
|
1697
|
+
return _context40.a(2);
|
|
1354
1698
|
}
|
|
1355
|
-
},
|
|
1699
|
+
}, _callee40);
|
|
1356
1700
|
})));
|
|
1357
1701
|
});
|
|
1358
1702
|
describe('resendVerificationEmail', function () {
|
|
@@ -1361,51 +1705,56 @@ describe('userActions', function () {
|
|
|
1361
1705
|
jest.clearAllMocks();
|
|
1362
1706
|
store = mockStore({});
|
|
1363
1707
|
});
|
|
1364
|
-
it('should dispatch showSnack if response result is true', /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
1365
|
-
return _regenerator().w(function (
|
|
1366
|
-
while (1) switch (
|
|
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) {
|
|
1367
1711
|
case 0:
|
|
1368
1712
|
_apex["default"].connection.setResponse({
|
|
1369
1713
|
result: true
|
|
1370
1714
|
});
|
|
1371
|
-
|
|
1715
|
+
_context41.n = 1;
|
|
1372
1716
|
return store.dispatch(actions.resendVerificationEmail());
|
|
1373
1717
|
case 1:
|
|
1374
1718
|
expect(snackbarActions.showSnack).toHaveBeenCalled();
|
|
1375
1719
|
case 2:
|
|
1376
|
-
return
|
|
1720
|
+
return _context41.a(2);
|
|
1377
1721
|
}
|
|
1378
|
-
},
|
|
1722
|
+
}, _callee41);
|
|
1379
1723
|
})));
|
|
1380
|
-
it('should dispatch showSnack if response result is false', /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
1381
|
-
return _regenerator().w(function (
|
|
1382
|
-
while (1) switch (
|
|
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) {
|
|
1383
1727
|
case 0:
|
|
1384
1728
|
_apex["default"].connection.setResponse({
|
|
1385
1729
|
result: false
|
|
1386
1730
|
});
|
|
1387
|
-
|
|
1731
|
+
_context42.n = 1;
|
|
1388
1732
|
return store.dispatch(actions.resendVerificationEmail());
|
|
1389
1733
|
case 1:
|
|
1390
1734
|
expect(snackbarActions.showSnack).toHaveBeenCalled();
|
|
1391
1735
|
case 2:
|
|
1392
|
-
return
|
|
1736
|
+
return _context42.a(2);
|
|
1393
1737
|
}
|
|
1394
|
-
},
|
|
1738
|
+
}, _callee42);
|
|
1395
1739
|
})));
|
|
1396
|
-
it('should dispatch showSnack if apex.connection is not include ResendVerificationEmail', /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
1397
|
-
|
|
1398
|
-
|
|
1740
|
+
it('should dispatch showSnack if apex.connection is not include ResendVerificationEmail', /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee43() {
|
|
1741
|
+
var _apex$connection, ResendVerificationEmail, connectionWithoutResendVerificationEmail;
|
|
1742
|
+
return _regenerator().w(function (_context43) {
|
|
1743
|
+
while (1) switch (_context43.n) {
|
|
1399
1744
|
case 0:
|
|
1400
|
-
_apex["default"].connection =
|
|
1401
|
-
|
|
1745
|
+
_apex$connection = _apex["default"].connection, ResendVerificationEmail = _apex$connection.ResendVerificationEmail, connectionWithoutResendVerificationEmail = _objectWithoutProperties(_apex$connection, _excluded);
|
|
1746
|
+
_apex["default"].connection = connectionWithoutResendVerificationEmail;
|
|
1747
|
+
_context43.n = 1;
|
|
1402
1748
|
return store.dispatch(actions.resendVerificationEmail());
|
|
1403
1749
|
case 1:
|
|
1404
1750
|
expect(snackbarActions.showSnack).toHaveBeenCalled();
|
|
1751
|
+
_apex["default"].connection = _objectSpread(_objectSpread({}, _apex["default"].connection), {}, {
|
|
1752
|
+
ResendVerificationEmail: ResendVerificationEmail
|
|
1753
|
+
});
|
|
1405
1754
|
case 2:
|
|
1406
|
-
return
|
|
1755
|
+
return _context43.a(2);
|
|
1407
1756
|
}
|
|
1408
|
-
},
|
|
1757
|
+
}, _callee43);
|
|
1409
1758
|
})));
|
|
1410
1759
|
});
|
|
1411
1760
|
describe('goToResetPasswordFormStep', function () {
|