forked from deriv-com/deriv-app
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch master into kate/OPT-306/accum_chore_text_changes
- Loading branch information
Showing
190 changed files
with
3,864 additions
and
1,665 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
18 changes: 18 additions & 0 deletions
18
...Components/poa-address-mismatch-hint-box/__tests__/poa-address-mismatch-hint-box.spec.tsx
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,18 @@ | ||
import React from 'react'; | ||
import { render, screen, waitFor } from '@testing-library/react'; | ||
import POAAddressMismatchHintBox from '../poa-address-mismatch-hint-box'; | ||
|
||
describe('<POAAddressMismatchHintBox/>', () => { | ||
const msg = | ||
'It appears that the address in your document doesn’t match the address in your Deriv profile. Please update your personal details now with the correct address.'; | ||
|
||
it('should render POAAddressMismatchHintBox component', async () => { | ||
window.HTMLElement.prototype.scrollIntoView = jest.fn(); | ||
|
||
render(<POAAddressMismatchHintBox />); | ||
await waitFor(() => { | ||
expect(window.HTMLElement.prototype.scrollIntoView).toHaveBeenCalled(); | ||
}); | ||
expect(screen.getByText(msg)).toBeVisible(); | ||
}); | ||
}); |
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
109 changes: 109 additions & 0 deletions
109
packages/account/src/Configs/__test__/personal-details-config.spec.ts
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,109 @@ | ||
import { personal_details_config } from 'Configs/personal-details-config'; | ||
|
||
jest.mock('@deriv/shared', () => ({ | ||
...jest.requireActual('@deriv/shared'), | ||
getErrorMessages: jest.fn().mockReturnValue({ | ||
name: jest.fn(), | ||
password: jest.fn(), | ||
}), | ||
generateValidationFunction: jest.fn(), | ||
getDefaultFields: jest.fn(), | ||
toMoment: jest.fn(), | ||
validLength: jest.fn(), | ||
})); | ||
describe('personal-details-config', () => { | ||
const mock_props = { | ||
residence_list: [ | ||
{ | ||
services: { | ||
idv: { | ||
documents_supported: {}, | ||
has_visual_sample: 0, | ||
is_country_supported: 0, | ||
}, | ||
onfido: { | ||
documents_supported: { | ||
passport: { | ||
display_name: 'Passport', | ||
}, | ||
}, | ||
is_country_supported: 0, | ||
}, | ||
}, | ||
phone_idd: '93', | ||
text: 'Afghanistan', | ||
value: 'af', | ||
tin_format: [], | ||
disabled: '1', | ||
}, | ||
{ | ||
services: { | ||
idv: { | ||
documents_supported: {}, | ||
has_visual_sample: 0, | ||
is_country_supported: 0, | ||
}, | ||
onfido: { | ||
documents_supported: { | ||
driving_licence: { | ||
display_name: 'Driving Licence', | ||
}, | ||
national_identity_card: { | ||
display_name: 'National Identity Card', | ||
}, | ||
passport: { | ||
display_name: 'Passport', | ||
}, | ||
residence_permit: { | ||
display_name: 'Residence Permit', | ||
}, | ||
}, | ||
is_country_supported: 1, | ||
}, | ||
phone_idd: '93', | ||
text: 'Indonesia', | ||
value: 'af', | ||
tin_format: [], | ||
disabled: '1', | ||
}, | ||
}, | ||
], | ||
account_settings: { | ||
tax_residence: 'af', | ||
residence: 'Indonesia', | ||
}, | ||
is_appstore: false, | ||
real_account_signup_target: 'maltainvest', | ||
account_status: { cashier_validation: ['system_maintenance'] }, | ||
}; | ||
|
||
it('should return account tax residence as default value if it is already set', () => { | ||
const personal_details = personal_details_config(mock_props); | ||
expect(personal_details[0].tax_residence.default_value).toEqual('Afghanistan'); | ||
}); | ||
|
||
it('should return residence as the default value for MF clients, If the account tax residence is not set', () => { | ||
const new_props = { | ||
...mock_props, | ||
account_settings: { | ||
...mock_props.account_settings, | ||
tax_residence: '', | ||
}, | ||
}; | ||
const personal_details = personal_details_config(new_props); | ||
expect(personal_details[0].tax_residence.default_value).toEqual(new_props.account_settings.residence); | ||
}); | ||
|
||
it('should not set default value for CR clients, If the account tax residence is not set', () => { | ||
const new_props = { | ||
...mock_props, | ||
real_account_signup_target: 'svg', | ||
account_settings: { | ||
...mock_props.account_settings, | ||
tax_residence: '', | ||
}, | ||
}; | ||
const personal_details = personal_details_config(new_props); | ||
expect(personal_details[0].tax_residence.default_value).toEqual(''); | ||
}); | ||
}); |
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
Oops, something went wrong.