-
Notifications
You must be signed in to change notification settings - Fork 319
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[TRAH] george / TRAH-5131 / Payment Agents and Deriv P2P Options are …
…Intermittently unavailable after login. (#17921) * fix(client-store): fix language key handling, fix p2p and pa availability check * refactor(cashier): reorganize imports and enhance payment agent handling * fix(client-store): handle undefined currencies_config in available_onramp_currencies method
- Loading branch information
1 parent
e489a4f
commit 19e27b4
Showing
7 changed files
with
74 additions
and
75 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,16 @@ | ||
import React from 'react'; | ||
import { fireEvent, render, screen } from '@testing-library/react'; | ||
import { BrowserHistory, createBrowserHistory } from 'history'; | ||
import { Router } from 'react-router'; | ||
import { BrowserHistory, createBrowserHistory } from 'history'; | ||
|
||
import { APIProvider } from '@deriv/api'; | ||
import { routes } from '@deriv/shared'; | ||
import { mockStore, P2PSettingsProvider } from '@deriv/stores'; | ||
import { fireEvent, render, screen } from '@testing-library/react'; | ||
|
||
import getRoutesConfig from 'Constants/routes-config'; | ||
import Cashier from '../cashier'; | ||
import { P2PSettingsProvider, mockStore } from '@deriv/stores'; | ||
|
||
import CashierProviders from '../../../cashier-providers'; | ||
import { routes } from '@deriv/shared'; | ||
import { APIProvider } from '@deriv/api'; | ||
import Cashier from '../cashier'; | ||
|
||
jest.mock('@deriv-com/ui', () => ({ | ||
...jest.requireActual('@deriv-com/ui'), | ||
|
@@ -19,38 +22,6 @@ jest.mock('@deriv/p2p', () => jest.fn(() => <div>P2P</div>)); | |
jest.mock('@deriv/hooks', () => { | ||
return { | ||
...jest.requireActual('@deriv/hooks'), | ||
usePaymentAgentList: jest.fn(() => ({ | ||
data: [ | ||
{ | ||
currencies: 'USD', | ||
email: '[email protected]', | ||
further_information: 'Further information', | ||
max_withdrawal: '2000', | ||
min_withdrawal: '10', | ||
name: 'PA', | ||
paymentagent_loginid: 'CR9999999', | ||
phone_numbers: [ | ||
{ | ||
phone_number: '+987654321', | ||
}, | ||
], | ||
summary: '', | ||
supported_payment_methods: [ | ||
{ | ||
payment_method: 'Visa', | ||
}, | ||
], | ||
urls: [ | ||
{ | ||
url: 'https://test.test', | ||
}, | ||
], | ||
withdrawal_commission: '0', | ||
}, | ||
], | ||
isLoading: false, | ||
isSuccess: true, | ||
})), | ||
usePaymentAgentTransferVisible: jest.fn(() => ({ | ||
data: true, | ||
isLoading: false, | ||
|
@@ -141,6 +112,9 @@ describe('<Cashier />', () => { | |
transaction_history: { | ||
is_transactions_crypto_visible: false, | ||
}, | ||
payment_agent: { | ||
is_payment_agent_visible: false, | ||
}, | ||
}, | ||
}, | ||
}); | ||
|
@@ -186,6 +160,7 @@ describe('<Cashier />', () => { | |
mockRootStore.client.is_logged_in = true; | ||
mockRootStore.client.is_logging_in = false; | ||
mockRootStore.modules.cashier.general_store.is_cashier_onboarding = true; | ||
mockRootStore.modules.cashier.payment_agent.is_payment_agent_visible = true; | ||
|
||
renderWithRouter(<Cashier routes={getRoutesConfig()[0].routes || []} />, mockRootStore); | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters