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.
Likhith/trah 3856/add poa document type (deriv-com#16611)
* feat: incorporated POA dropdown field * chore: fixed the POA dropdown * fix: type issues in TS * fix: testcase for File upload * chore: incorporated Mobile layout * chore: incorporated POA for mobile * fix: failing testcases * fix: failing testcase in cfd-poa * fix: failing testcase in cfd-poa * chore: added POAForm testcase * chore: added POAForm testcase * fix: incorporated review comments * fix: incorporated new layout changes * fix: incorporated validation for Document type field * fix: incorporated validation for Document type field * likhith/trah-4188/incorporate POA enhancement for wallet (#75) * chore: incorporated POA enhancement in Desktop for wallet * chore: incorporated POA changes in mobile * fix: incorporated review comments * fix: remove comment * Merge remote-tracking branch 'origin/likhith/TRAH-3856/add-poa-document-type' into likhith/TRAH-4188/handle-poa-enhancement-in-wallets * fix: failing testcase * fix: overirde CSS * fix: incorporated review comments * fix: incoprorated review comments * chore: added POA others
- Loading branch information
1 parent
3b30cb8
commit 8bb21d4
Showing
27 changed files
with
1,097 additions
and
197 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
64 changes: 61 additions & 3 deletions
64
packages/account/src/Components/file-uploader-container/file-uploader-container.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
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
101 changes: 101 additions & 0 deletions
101
...account/src/Sections/Verification/ProofOfAddress/__tests__/proof-of-address-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,101 @@ | ||
import React from 'react'; | ||
import { render, screen, waitFor } from '@testing-library/react'; | ||
import ProofOfAddressForm from '../proof-of-address-form'; | ||
import { useDevice } from '@deriv-com/ui'; | ||
import { mockStore, StoreProvider } from '@deriv/stores'; | ||
import { BrowserRouter } from 'react-router-dom'; | ||
|
||
jest.mock('@deriv-com/ui', () => ({ | ||
...jest.requireActual('@deriv-com/ui'), | ||
useDevice: jest.fn(), | ||
})); | ||
|
||
jest.mock('@deriv/hooks', () => ({ | ||
...jest.requireActual('@deriv/hooks'), | ||
useFileUploader: jest.fn(() => ({ | ||
upload: jest.fn(), | ||
})), | ||
})); | ||
|
||
jest.mock('../poa-desktop-layout.tsx', () => jest.fn(() => 'mockedPOADesktopForm')); | ||
|
||
jest.mock('../poa-mobile-layout.tsx', () => jest.fn(() => 'mockedPOAMobileForm')); | ||
|
||
jest.mock('@deriv/shared', () => ({ | ||
...jest.requireActual('@deriv/shared'), | ||
WS: { | ||
authorized: { | ||
storage: { | ||
getSettings: jest.fn().mockResolvedValue({ | ||
get_settings: { | ||
address_line_1: 'test address_line_1', | ||
address_line_2: 'test address_line_2', | ||
address_city: 'test address_city', | ||
address_state: 'test address_state', | ||
address_postcode: 'test address_postcode', | ||
}, | ||
}), | ||
getAccountStatus: jest.fn().mockResolvedValue({ | ||
get_account_status: { | ||
authentication: { | ||
document: { | ||
status: 'none', | ||
}, | ||
identity: { | ||
status: 'none', | ||
}, | ||
}, | ||
}, | ||
}), | ||
}, | ||
}, | ||
setSettings: jest.fn(() => Promise.resolve({ error: '' })), | ||
wait: jest.fn(() => Promise.resolve([])), | ||
getSocket: jest.fn().mockReturnValue({}), | ||
}, | ||
})); | ||
|
||
describe('ProofOfAddressForm', () => { | ||
const mock_props: React.ComponentProps<typeof ProofOfAddressForm> = {}; | ||
|
||
const mock_store = mockStore({ | ||
client: { | ||
account_settings: { | ||
address_line_1: 'test address_line_1', | ||
address_line_2: 'test address_line_2', | ||
address_city: 'test address_city', | ||
address_state: 'test address_state', | ||
address_postcode: 'test address_postcode', | ||
}, | ||
fetchResidenceList: jest.fn(() => Promise.resolve('')), | ||
fetchStatesList: jest.fn(() => Promise.resolve('')), | ||
getChangeableFields: jest.fn(() => []), | ||
}, | ||
}); | ||
|
||
const renderComponent = ({ props = mock_props, store = mock_store }) => { | ||
return render( | ||
<BrowserRouter> | ||
<StoreProvider store={store}> | ||
<ProofOfAddressForm {...props} /> | ||
</StoreProvider> | ||
</BrowserRouter> | ||
); | ||
}; | ||
|
||
it('should render Desktop layout of the form', async () => { | ||
(useDevice as jest.Mock).mockReturnValue({ isMobile: false, isDesktop: true }); | ||
|
||
renderComponent({}); | ||
|
||
expect(await screen.findByText('mockedPOADesktopForm')).toBeInTheDocument(); | ||
}); | ||
|
||
it('should render Mobile layout of the form', async () => { | ||
(useDevice as jest.Mock).mockReturnValue({ isMobile: true, isDesktop: false }); | ||
|
||
renderComponent({}); | ||
|
||
expect(await screen.findByText('mockedPOAMobileForm')).toBeInTheDocument(); | ||
}); | ||
}); |
Oops, something went wrong.