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.
yauheni/likhith/Combined/wall 400/idv error message handled (deriv-co…
…m#8884) * chore: new pr for wall 400 * feat: ✨ incorporated change to display the id document name * chore: country selector warning if failed * fix: ♻️ resolved comments * refactor: css file rename * feat: resolved code smell * refactor: expired and failed different warnings * refactor: failed messaged moved to country selector * chore: 💚 trigger build * refactor: review comments * refactor: review comments css * fix: 🐛 incorporated message to display document type * fix: resolved code smell * fix: 🐛 incorporated generic error message * fix: 🐛 added missing dependency * chore: 🔀 synced with master * fix: ♻️ incorporated review comments * fix: resolved un necessary render issue * fix: 🐛 resolved issue with expired status * style: fix side container width in poi (#39) * style: container height fix for POI error messages when content in not overflowing (#40) * fix: onfido message alignment * fix: 🐛 incorporated continue trade button * fix: onfido page mobile * style: no padding on fields container in idv screen (#41) * refactor: onfido hint center alignment fix * fix: odd translate value fix * fix: 🐛 minor CSS fix * fix: green message responsive position * fix: green message full width * fix: ✅ updated testcases * fix: failing tests * refactor: code and ts fixes * fix: display of IDV error * chore: add duplication account error * refactor: added undefined check to response data * chore: review comments * chore: review comments * fix: ♻️ incorporated review comments * fix: barriers test fix form master * fix: barriers test * chore: refactored object.freeze to as const * chore: optional chaining to document type * chore: update spec file for idv-form * test: update personal-details spec * chore: review comments * refactor: css structure * fix: barriers test * fix: ♻️ incorporated review comments * refactor: rename properties * refactor: remove is_appstore from tests * refactor: styles refactor * fix: ⚡ reduced duplicate data * fix: incorporated review comments * fix: ♻️ incorporated review comments * chore: Trigger Build * fix: 🚚 modified path * chore: remove unused fila and variable, updated icons * revert: 🍻 removed icon changes * refactor: removed formatting * fix: removed assignment of default values * fix: 🐛 unable to select a new doc supporting country * fix: 🐛 resolved re-render issue * fix: ⚡ resolved message issue * refactor: 🚚 renamed varibales * fix: 🧪 failing testcase * fix: 🐛 resolved issues with failure messages * fix: 🐛 resolved issue with DIEL accounts * fix: 🐛 fixed issue for DIEL clients * fix: styling issues * fix: ts error for format-response * fix: 🚚 fixed path * fix: 🚚 fixed path * fix: 🐛 resolved styling bugs * fix: 🐛 resolved styling bugs * fix: 🔥 incorporated new styles to fix icon size * fix: 🔥 incorporated new styles to fix icon size * fix: ✅ fixed failing testcase * fix: 💚 eslint issues * fix: layout styles * fix: style issues * fix: styles * fix: moved common styles to core * fix: 💄 updated styles * refactor: incorporated review comments * Merge branch 'master' into combined/wall-400/IDV-error-message-handled --------- Co-authored-by: “yauheni-kryzhyk-deriv” <“yauheni@deriv.me”> Co-authored-by: yauheni-deriv <103182683+yauheni-deriv@users.noreply.github.com> Co-authored-by: Shahzaib <shahzaib@deriv.com>
- Loading branch information
1 parent
ad3eb3b
commit 164c4c7
Showing
55 changed files
with
2,742 additions
and
1,771 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
120 changes: 120 additions & 0 deletions
120
packages/account/src/Components/forms/__tests__/idv-form.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,120 @@ | ||
import React from 'react'; | ||
import { render, screen, waitFor } from '@testing-library/react'; | ||
import userEvent from '@testing-library/user-event'; | ||
import IDVForm from '../idv-form'; | ||
import { Formik } from 'formik'; | ||
|
||
jest.mock('Helpers/utils', () => ({ | ||
...jest.requireActual('Helpers/utils'), | ||
getDocumentData: jest.fn((country_code, key) => { | ||
const data = { | ||
tc: { | ||
document_1: { | ||
new_display_name: '', | ||
example_format: '5436454364243', | ||
sample_image: '', | ||
}, | ||
document_2: { | ||
new_display_name: '', | ||
example_format: 'A-52431', | ||
sample_image: '', | ||
}, | ||
}, | ||
}; | ||
return data[country_code][key]; | ||
}), | ||
})); | ||
|
||
jest.mock('formik', () => ({ | ||
...jest.requireActual('formik'), | ||
useFormikContext: jest.fn(() => ({ | ||
values: { | ||
document_type: {}, | ||
document_number: '', | ||
}, | ||
errors: {}, | ||
touched: {}, | ||
setFieldValue: jest.fn(), | ||
setFieldTouched: jest.fn(), | ||
validateForm: jest.fn(), | ||
validateField: jest.fn(), | ||
handleBlur: jest.fn(), | ||
handleChange: jest.fn(), | ||
})), | ||
})); | ||
|
||
jest.mock('@deriv/shared', () => ({ | ||
...jest.requireActual('@deriv/shared'), | ||
isDesktop: jest.fn(() => true), | ||
isMobile: jest.fn(() => false), | ||
})); | ||
|
||
describe('<IDVForm/>', () => { | ||
const mock_props = { | ||
selected_country: { | ||
value: 'tc', | ||
identity: { | ||
services: { | ||
idv: { | ||
documents_supported: { | ||
document_1: { | ||
display_name: 'Test document 1 name', | ||
format: '5436454364243', | ||
}, | ||
document_2: { | ||
display_name: 'Test document 2 name', | ||
format: 'A54321', | ||
}, | ||
}, | ||
has_visual_sample: 1, | ||
}, | ||
}, | ||
}, | ||
}, | ||
}; | ||
|
||
const mock_values = { | ||
document_type: { | ||
display_name: 'Test document 1 name', | ||
format: '5436454364243', | ||
id: '1', | ||
value: 'document_1', | ||
}, | ||
document_number: '5436454364243', | ||
}; | ||
|
||
it('should render IDVForm component', () => { | ||
render(<IDVForm {...mock_props} />, { | ||
wrapper: ({ children }) => ( | ||
<Formik initialValues={mock_values} onSubmit={jest.fn()}> | ||
{() => children} | ||
</Formik> | ||
), | ||
}); | ||
|
||
const document_type_input = screen.getByLabelText('Choose the document type'); | ||
const document_number_input = screen.getByLabelText('Enter your document number'); | ||
|
||
expect(document_type_input).toBeInTheDocument(); | ||
expect(document_number_input).toBeInTheDocument(); | ||
}); | ||
|
||
it('Should change the document type value when document type is changed', async () => { | ||
render(<IDVForm {...mock_props} />, { | ||
wrapper: ({ children }) => ( | ||
<Formik initialValues={mock_values} onSubmit={jest.fn()}> | ||
{() => children} | ||
</Formik> | ||
), | ||
}); | ||
|
||
const document_type_input = screen.getByLabelText('Choose the document type'); | ||
|
||
userEvent.click(document_type_input); | ||
expect(await screen.findByText('Test document 1 name')).toBeInTheDocument(); | ||
userEvent.tab(); | ||
await waitFor(() => { | ||
expect(screen.queryByText('Test document 1 name')).not.toBeInTheDocument(); | ||
}); | ||
}); | ||
}); |
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.