-
Notifications
You must be signed in to change notification settings - Fork 303
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* fixed translation for amount field in account transfer form cashier (#5605) Co-authored-by: Carol Sachdeva <58209918+carol-binary@users.noreply.github.com> * farrah/updated deposit store test coverage (#5430) * updated deposit store test coverage * added a check for updateAccountStatus Co-authored-by: Carol Sachdeva <58209918+carol-binary@users.noreply.github.com> * likhith/Fix validation message for payment methods (#5187) * Added appropriate error message * Fixed error messages in Edit form * Added validation for SWIFT * Added a hook to validate methods * Removed commented code * Refactored the code by moving the custom hook to hooks folder * Minor bug fixes * refactor: Renamed a variable * fix: added regex to allow more characters as valid * fix: implemented button disabled * fix: changed the edit payment method * fix: added payment error message overlapping issue Co-authored-by: Likhith Kolayari <likhith@deriv.com> Co-authored-by: Carol Sachdeva <58209918+carol-binary@users.noreply.github.com> * Amina/poi_limited_test_case (#5642) * poi_limited_test_case * poi_limited_test_case Co-authored-by: Carol Sachdeva <58209918+carol-binary@users.noreply.github.com> * yauheni / IdvRejected test coverage (#5637) Co-authored-by: “yauheni-kryzhyk-deriv” <“yauheni@deriv.me”> Co-authored-by: Carol Sachdeva <58209918+carol-binary@users.noreply.github.com> * yauheni / IdvNoSubmisssions test coverage (#5636) * yauheni / IdvNoSubmisssions test coverage * imports fix * naming typo fix * Delete poi-idv-rejected.spec.js Co-authored-by: “yauheni-kryzhyk-deriv” <“yauheni@deriv.me”> Co-authored-by: Carol Sachdeva <58209918+carol-binary@users.noreply.github.com> * feat: add check if has restricted parent (#5635) Co-authored-by: Carol Sachdeva <58209918+carol-binary@users.noreply.github.com> * Adrienne / P2P responsive add PM full screen modal button footers are now fixed by design (#5561) * Mobile add PM full screen modal button footers are now fixed by design specs * Incorporated code review changes Co-authored-by: Carol Sachdeva <58209918+carol-binary@users.noreply.github.com> * Bala/Add bootstrap dev script (#5659) * chore: add bootstrap dev script * Update package.json Co-authored-by: Yashim Wong <75345074+yashim-deriv@users.noreply.github.com> * chore: remove build from bootstrap Co-authored-by: Yashim Wong <75345074+yashim-deriv@users.noreply.github.com> Co-authored-by: Carol Sachdeva <58209918+carol-binary@users.noreply.github.com> * translations: 📚 sync translations with crowdin (#5679) Co-authored-by: DerivFE <80095553+DerivFE@users.noreply.github.com> * update branch Co-authored-by: vinu-deriv <100689171+vinu-deriv@users.noreply.github.com> Co-authored-by: Farrah Mae Ochoa <82315152+farrah-deriv@users.noreply.github.com> Co-authored-by: Likhith Kolayari <98398322+likhith-deriv@users.noreply.github.com> Co-authored-by: Likhith Kolayari <likhith@deriv.com> Co-authored-by: amina-deriv <84661147+amina-deriv@users.noreply.github.com> Co-authored-by: yauheni-kryzhyk-deriv <103182683+yauheni-kryzhyk-deriv@users.noreply.github.com> Co-authored-by: “yauheni-kryzhyk-deriv” <“yauheni@deriv.me”> Co-authored-by: maryiafrantsava-binary <103181650+maryiafrantsava-binary@users.noreply.github.com> Co-authored-by: adrienne-deriv <103016120+adrienne-deriv@users.noreply.github.com> Co-authored-by: balakrishna-binary <56330681+balakrishna-binary@users.noreply.github.com> Co-authored-by: Yashim Wong <75345074+yashim-deriv@users.noreply.github.com> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: DerivFE <80095553+DerivFE@users.noreply.github.com>
- Loading branch information
1 parent
99307da
commit 66ef317
Showing
35 changed files
with
511 additions
and
297 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
23 changes: 23 additions & 0 deletions
23
packages/account/src/Components/poi-idv-limited/__tests__/poi-idv-limited.spec.js
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 |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import React from 'react'; | ||
import { fireEvent, render, screen } from '@testing-library/react'; | ||
import IdvNoSubmissions from '../poi-idv-limited'; | ||
|
||
jest.mock('../../../Assets/ic-idv-document-rejected.svg', () => jest.fn(() => 'IdvDocumentRejected')); | ||
|
||
describe('<IdvNoSubmissions/>', () => { | ||
const mockHandleRequireSubmission = jest.fn(); | ||
|
||
it('should render IdvNoSubmissions component and trigger click', () => { | ||
render(<IdvNoSubmissions handleRequireSubmission={mockHandleRequireSubmission} />); | ||
|
||
expect(screen.getByText('IdvDocumentRejected')).toBeInTheDocument(); | ||
expect(screen.getByText(/ID verification failed/i)).toBeInTheDocument(); | ||
expect(screen.getByText(/we were unable to verify your ID with the details you provided/i)).toBeInTheDocument(); | ||
expect(screen.getByText(/please upload your identity document/i)).toBeInTheDocument(); | ||
|
||
const btn = screen.getByRole('button'); | ||
expect(btn).toHaveTextContent(/upload identity document/i); | ||
fireEvent.click(btn); | ||
expect(mockHandleRequireSubmission).toHaveBeenCalledTimes(1); | ||
}); | ||
}); |
22 changes: 22 additions & 0 deletions
22
packages/account/src/Components/poi-idv-rejected/__tests__/poi-idv-rejected.spec.js
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 |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import React from 'react'; | ||
import { fireEvent, render, screen } from '@testing-library/react'; | ||
import IdvRejected from '../poi-idv-rejected'; | ||
|
||
jest.mock('../../../Assets/ic-idv-document-rejected.svg', () => jest.fn(() => 'IdvDocumentRejected')); | ||
|
||
describe('<IdvRejected/>', () => { | ||
const mockHandleRequireSubmission = jest.fn(); | ||
|
||
it('should render IdvRejected component and trigger click', () => { | ||
render(<IdvRejected handleRequireSubmission={mockHandleRequireSubmission} />); | ||
|
||
expect(screen.getByText('IdvDocumentRejected')).toBeInTheDocument(); | ||
expect(screen.getByText(/ID verification failed/i)).toBeInTheDocument(); | ||
expect(screen.getByText(/we were unable to verify your ID with the details you provided/i)).toBeInTheDocument(); | ||
|
||
const btn = screen.getByRole('button'); | ||
expect(btn).toHaveTextContent(/try again/i); | ||
fireEvent.click(btn); | ||
expect(mockHandleRequireSubmission).toHaveBeenCalledTimes(1); | ||
}); | ||
}); |
19 changes: 19 additions & 0 deletions
19
packages/account/src/Components/poi-limited/__tests__/poi-limited.spec.js
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 |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import React from 'react'; | ||
import { fireEvent, render, screen } from '@testing-library/react'; | ||
import { POILimited } from '../poi-limited'; | ||
|
||
describe('<POILimited/>', () => { | ||
it('should render POILimited component', () => { | ||
window.LC_API = { | ||
open_chat_window: jest.fn(), | ||
}; | ||
render(<POILimited />); | ||
expect(screen.getByText(/you've reached the limit for uploading your documents\./i)).toBeInTheDocument(); | ||
expect(screen.getByText(/please contact us via/i)).toBeInTheDocument(); | ||
|
||
const live_chat_text = screen.getByText(/live chat/i); | ||
expect(live_chat_text).toBeInTheDocument(); | ||
fireEvent.click(live_chat_text); | ||
expect(window.LC_API.open_chat_window).toHaveBeenCalledTimes(1); | ||
}); | ||
}); |
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
157 changes: 157 additions & 0 deletions
157
packages/cashier/src/Stores/__tests__/deposit-store.spec.js
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 |
---|---|---|
@@ -0,0 +1,157 @@ | ||
import DepositStore from '../deposit-store'; | ||
|
||
describe('DepositStore', () => { | ||
let deposit_store; | ||
|
||
beforeEach(() => { | ||
const root_store = { | ||
client: { | ||
is_authentication_needed: false, | ||
is_tnc_needed: false, | ||
is_financial_account: false, | ||
is_financial_information_incomplete: false, | ||
is_trading_experience_incomplete: false, | ||
account_status: {}, | ||
is_eu: false, | ||
mt5_login_list: [], | ||
is_deposit_lock: false, | ||
is_virtual: false, | ||
updateAccountStatus: jest.fn(), | ||
}, | ||
modules: { | ||
cashier: { | ||
general_store: { | ||
active_container: 'deposit', | ||
is_crypto: false, | ||
onMountCommon: jest.fn(), | ||
setLoading: jest.fn(), | ||
setOnRemount: jest.fn(), | ||
}, | ||
iframe: { | ||
checkIframeLoaded: jest.fn(), | ||
clearTimeoutCashierUrl: jest.fn(), | ||
is_session_timeout: false, | ||
setContainerHeight: jest.fn(), | ||
setIframeUrl: jest.fn(), | ||
setSessionTimeout: jest.fn(), | ||
setTimeoutCashierUrl: jest.fn(), | ||
}, | ||
}, | ||
}, | ||
}; | ||
const WS = { | ||
authorized: { | ||
cashier: jest.fn(() => Promise.resolve({ cashier: 'https://cashier.deriv.com' })), | ||
}, | ||
send: jest.fn(() => Promise.resolve({})), | ||
}; | ||
|
||
deposit_store = new DepositStore({ root_store, WS }); | ||
}); | ||
|
||
it('should mount deposit properly', async () => { | ||
const { checkIframeLoaded, setIframeUrl, setSessionTimeout, setTimeoutCashierUrl } = | ||
deposit_store.root_store.modules.cashier.iframe; | ||
const { updateAccountStatus } = deposit_store.root_store.client; | ||
|
||
await deposit_store.onMountDeposit(); | ||
expect(checkIframeLoaded).toHaveBeenCalled(); | ||
|
||
deposit_store.root_store.modules.cashier.iframe.is_session_timeout = true; | ||
|
||
await deposit_store.onMountDeposit(); | ||
expect(checkIframeLoaded).toHaveBeenCalled(); | ||
expect(setIframeUrl).toHaveBeenCalledWith('https://cashier.deriv.com'); | ||
expect(setSessionTimeout).toHaveBeenCalledWith(false); | ||
expect(setTimeoutCashierUrl).toHaveBeenCalled(); | ||
expect(updateAccountStatus).toHaveBeenCalled(); | ||
}); | ||
|
||
it('should handle the error on deposit', async () => { | ||
const { setSessionTimeout, clearTimeoutCashierUrl } = deposit_store.root_store.modules.cashier.iframe; | ||
const error_message = 'Sorry, an error occured.'; | ||
const spyHandleCashierError = jest.spyOn(deposit_store.error, 'handleCashierError'); | ||
|
||
deposit_store.root_store.modules.cashier.iframe.is_session_timeout = true; | ||
deposit_store.WS.authorized.cashier.mockResolvedValueOnce({ error: { message: error_message } }); | ||
|
||
await deposit_store.onMountDeposit(); | ||
expect(spyHandleCashierError).toHaveBeenCalledWith({ message: error_message }); | ||
expect(setSessionTimeout).toHaveBeenCalledWith(true); | ||
expect(clearTimeoutCashierUrl).toHaveBeenCalled(); | ||
}); | ||
|
||
it('should not load the iframe if client is on virtual account', async () => { | ||
const { setLoading } = deposit_store.root_store.modules.cashier.general_store; | ||
const { checkIframeLoaded } = deposit_store.root_store.modules.cashier.iframe; | ||
|
||
deposit_store.root_store.modules.cashier.iframe.is_session_timeout = true; | ||
deposit_store.root_store.client.is_virtual = true; | ||
|
||
await deposit_store.onMountDeposit(); | ||
expect(checkIframeLoaded).not.toHaveBeenCalled(); | ||
expect(setLoading).toHaveBeenCalledWith(false); | ||
}); | ||
|
||
it('should return is_deposit_locked equal to true if the client needs authentication', () => { | ||
expect(deposit_store.is_deposit_locked).toBeFalse(); | ||
|
||
deposit_store.root_store.client.account_status.status = ['authentication_needed']; | ||
deposit_store.root_store.client.is_authentication_needed = true; | ||
deposit_store.root_store.client.is_eu = true; | ||
expect(deposit_store.is_deposit_locked).toBeTrue(); | ||
}); | ||
|
||
it('should return is_deposit_locked equal to true if the client needs financial assessment', () => { | ||
deposit_store.root_store.client.account_status.status = [ | ||
'financial_information_not_complete', | ||
'trading_experience_not_complete', | ||
]; | ||
deposit_store.root_store.client.is_financial_account = true; | ||
deposit_store.root_store.client.is_financial_information_incomplete = true; | ||
expect(deposit_store.is_deposit_locked).toBeTrue(); | ||
|
||
deposit_store.root_store.client.is_financial_information_incomplete = false; | ||
deposit_store.root_store.client.is_trading_experience_incomplete = true; | ||
expect(deposit_store.is_deposit_locked).toBeTrue(); | ||
}); | ||
|
||
it('should return is_deposit_locked equal to true if the client needs terms and conditions', () => { | ||
deposit_store.root_store.client.account_status.status = ['cashier_locked']; | ||
deposit_store.root_store.client.is_eu = true; | ||
deposit_store.root_store.client.is_tnc_needed = true; | ||
expect(deposit_store.is_deposit_locked).toBeTrue(); | ||
|
||
deposit_store.root_store.client.is_eu = false; | ||
deposit_store.root_store.client.mt5_login_list = [{ account_type: 'real', sub_account_type: 'financial_stp' }]; | ||
expect(deposit_store.is_deposit_locked).toBeTrue(); | ||
}); | ||
|
||
it('should return is_deposit_locked equal to true if the client needs financial risk approval', () => { | ||
deposit_store.root_store.client.account_status.status = ['financial_assessment_not_complete']; | ||
deposit_store.error.is_ask_financial_risk_approval = true; | ||
expect(deposit_store.is_deposit_locked).toBeTrue(); | ||
}); | ||
|
||
it('should submit funds protection', async () => { | ||
Object.defineProperty(window, 'location', { | ||
configurable: true, | ||
value: { reload: jest.fn() }, | ||
}); | ||
|
||
await deposit_store.submitFundsProtection(); | ||
expect(location.reload).toHaveBeenCalled(); | ||
|
||
window.location.reload.mockRestore(); | ||
}); | ||
|
||
it('should handle the error upon submitting funds protection', async () => { | ||
const spySetMessage = jest.spyOn(deposit_store.error, 'setMessage'); | ||
const error_message = 'Sorry, an error occurred.'; | ||
|
||
deposit_store.WS.send.mockResolvedValueOnce({ error: { message: error_message } }); | ||
|
||
await deposit_store.submitFundsProtection(); | ||
expect(spySetMessage).toHaveBeenCalledWith(error_message); | ||
}); | ||
}); |
Oops, something went wrong.