Skip to content

Commit ef59d53

Browse files
authored
[COJ1414] Suisin/fix: add Continue Trading button in POI (deriv-com#17243)
* fix: add Continue Trading button in POI * chore: fix test case fail issue
1 parent 4462035 commit ef59d53

File tree

2 files changed

+25
-7
lines changed

2 files changed

+25
-7
lines changed

packages/account/src/Components/poi/status/verified/__tests__/verified.spec.tsx

+23-6
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { render, screen } from '@testing-library/react';
33
import { Button } from '@deriv/components';
44
import React from 'react';
55
import { Verified } from '../verified';
6+
import { MemoryRouter } from 'react-router';
67

78
jest.mock('Components/poa/poa-button', () => jest.fn(() => <div data-testid='poa-button' />));
89

@@ -12,12 +13,20 @@ describe('<Verified/>', () => {
1213
const needs_poa_msg = 'To continue trading, you must also submit a proof of address.';
1314

1415
it('should render Verified component', () => {
15-
render(<Verified />);
16+
render(
17+
<MemoryRouter>
18+
<Verified />
19+
</MemoryRouter>
20+
);
1621
expect(screen.getByText(message)).toBeInTheDocument();
1722
});
1823

1924
it('should show icon with message if needs_poa is false', () => {
20-
render(<Verified />);
25+
render(
26+
<MemoryRouter>
27+
<Verified />
28+
</MemoryRouter>
29+
);
2130

2231
expect(screen.getByTestId('dt_IcPoaVerified')).toBeInTheDocument();
2332
expect(screen.getByText(message)).toBeInTheDocument();
@@ -28,13 +37,21 @@ describe('<Verified/>', () => {
2837
expect(screen.getByRole('button')).toBeInTheDocument();
2938
});
3039

31-
it('should not show redirect button if redirect_button is not passed', () => {
32-
render(<Verified />);
33-
expect(screen.queryByRole('button')).not.toBeInTheDocument();
40+
it('should show continue trading button if redirect_button is not passed', () => {
41+
render(
42+
<MemoryRouter>
43+
<Verified />
44+
</MemoryRouter>
45+
);
46+
expect(screen.getByText('Continue trading')).toBeInTheDocument();
3447
});
3548

3649
it('should show poa buttons and the message if needs_poa is true and is_from_external is false ', () => {
37-
render(<Verified needs_poa redirect_button={redirect_button} />);
50+
render(
51+
<MemoryRouter>
52+
<Verified needs_poa redirect_button={redirect_button} />
53+
</MemoryRouter>
54+
);
3855
expect(screen.getByTestId('poa-button')).toBeInTheDocument();
3956
expect(screen.getByText(needs_poa_msg)).toBeInTheDocument();
4057
});

packages/account/src/Components/poi/status/verified/verified.tsx

+2-1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { TPOIStatus } from 'Types';
55
import IconMessageContent from '../../../icon-message-content';
66
import PoaButton from '../../../poa/poa-button';
77
import { service_code } from '../../../../Sections/Verification/ProofOfIdentity/proof-of-identity-utils';
8+
import ContinueTradingButton from '../../../poa/continue-trading-button';
89

910
export const Verified = ({ needs_poa, redirect_button, is_from_external, service }: TPOIStatus) => {
1011
const message =
@@ -19,7 +20,7 @@ export const Verified = ({ needs_poa, redirect_button, is_from_external, service
1920
icon={<Icon icon='IcPoaVerified' size={128} data_testid='dt_IcPoaVerified' />}
2021
className='account-management-dashboard'
2122
>
22-
{!is_from_external && redirect_button}
23+
{!is_from_external && (redirect_button || <ContinueTradingButton />)}
2324
</IconMessageContent>
2425
);
2526
}

0 commit comments

Comments
 (0)