forked from binary-com/deriv-app
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #124 from likhith-deriv/likhith/shaheer/COJ-506/in…
…tegrate-manual-upload-flow Likhith/shaheer/coj 506/integrate manual upload flow
- Loading branch information
Showing
84 changed files
with
1,324 additions
and
184 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
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
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
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
61 changes: 35 additions & 26 deletions
61
packages/account-v2/src/hooks/__tests__/useManualForm.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 |
---|---|---|
@@ -1,46 +1,55 @@ | ||
import { useSettings } from '@deriv/api'; | ||
import { useKycAuthStatus } from '@deriv/api'; | ||
import { renderHook } from '@testing-library/react-hooks'; | ||
import useManualForm from '../useManualForm'; | ||
|
||
jest.mock('@deriv/api', () => ({ | ||
...jest.requireActual('@deriv/api'), | ||
useSettings: jest.fn(), | ||
useKycAuthStatus: jest.fn(), | ||
})); | ||
|
||
describe('useManualForm', () => { | ||
it('should return false if citizenship is ng', () => { | ||
(useSettings as jest.Mock).mockReturnValue({ | ||
data: { | ||
citizen: 'ng', | ||
country_code: 'in', | ||
it('should return false for expiry date if citizenship is ng and document is nimc slip', () => { | ||
(useKycAuthStatus as jest.Mock).mockReturnValue({ | ||
isLoading: false, | ||
kyc_auth_status: { | ||
identity: { | ||
available_services: ['onfido', 'manual'], | ||
}, | ||
}, | ||
}); | ||
const { result } = renderHook(() => useManualForm()); | ||
const { isExpiryDateRequired } = result.current; | ||
expect(isExpiryDateRequired).toBe(false); | ||
const { result } = renderHook(() => useManualForm('ng', 'nimc_slip')); | ||
const { isExpiryDateRequired, poiService } = result.current; | ||
expect(isExpiryDateRequired).toBeFalsy(); | ||
expect(poiService).toBe('manual'); | ||
}); | ||
|
||
it('should return true if citizenship and country code is not ng', () => { | ||
(useSettings as jest.Mock).mockReturnValue({ | ||
data: { | ||
citizen: 'au', | ||
country_code: 'au', | ||
it('should return true for expiry date if citizenship is ng and document is passport', () => { | ||
(useKycAuthStatus as jest.Mock).mockReturnValue({ | ||
isLoading: false, | ||
kyc_auth_status: { | ||
identity: { | ||
available_services: ['onfido', 'manual'], | ||
}, | ||
}, | ||
}); | ||
const { result } = renderHook(() => useManualForm()); | ||
const { isExpiryDateRequired } = result.current; | ||
expect(isExpiryDateRequired).toBe(true); | ||
const { result } = renderHook(() => useManualForm('ng', 'passport')); | ||
const { isExpiryDateRequired, poiService } = result.current; | ||
expect(isExpiryDateRequired).toBeTruthy(); | ||
expect(poiService).toBe('onfido'); | ||
}); | ||
|
||
it('should return true if citizenship is not ng but country code is ng', () => { | ||
(useSettings as jest.Mock).mockReturnValue({ | ||
data: { | ||
citizen: 'in', | ||
country_code: 'ng', | ||
it('should return manual as POI service if citizenship is in and document is passport', () => { | ||
(useKycAuthStatus as jest.Mock).mockReturnValue({ | ||
isLoading: false, | ||
kyc_auth_status: { | ||
identity: { | ||
available_services: ['onfido', 'manual'], | ||
}, | ||
}, | ||
}); | ||
const { result } = renderHook(() => useManualForm()); | ||
const { isExpiryDateRequired } = result.current; | ||
expect(isExpiryDateRequired).toBe(true); | ||
const { result } = renderHook(() => useManualForm('in', 'passport')); | ||
const { isExpiryDateRequired, poiService } = result.current; | ||
expect(isExpiryDateRequired).toBeTruthy(); | ||
expect(poiService).toBe('manual'); | ||
}); | ||
}); |
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
3 changes: 1 addition & 2 deletions
3
packages/account-v2/src/modules/IDVForm/__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
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.