Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Suisin/74142/ts migration idv verified #28

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions packages/account/globals.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
declare module '*.svg' {
const content: any;
export default content;
}
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,12 @@ describe('<IdvVerified />', () => {
expect(screen.getByText(submit_text)).toBeInTheDocument();
expect(history.location.pathname).not.toBe('/account/proof-of-address');
fireEvent.click(screen.getByText(submit_text));
expect(screen.getByRole('link', { name: submit_text }).closest('a')).toHaveAttribute(
'href',
'/account/proof-of-address'
);
expect(screen.getByRole('link', { name: submit_text })).toHaveAttribute('href', '/account/proof-of-address');
expect(history.location.pathname).toBe('/account/proof-of-address');
});

it('should render the IdvVerified component when needs_poa is false and is_from_external is true in mobile', () => {
isMobile.mockReturnValue(true);
(isMobile as jest.Mock).mockReturnValue(true);
renderWithRouter(<IdvVerified is_from_external />);
expect(screen.getByTestId('poi_idv_verified_container')).toBeInTheDocument();
expect(screen.getByText(/mockedsvgicon/i)).toBeInTheDocument();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,12 @@ import { localize } from '@deriv/translations';
import PoaButton from 'Components/poa/poa-button';
import IdvDocumentVerified from 'Assets/ic-idv-verified.svg';

const IdvVerified = ({ needs_poa, is_from_external }) => {
type TIdvVerified = {
needs_poa: boolean;
is_from_external: boolean;
};

const IdvVerified = ({ needs_poa, is_from_external }: Partial<TIdvVerified>) => {
const header_Text = needs_poa
? localize('Your ID is verified. You will also need to submit proof of your address.')
: localize('ID verification passed');
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
import IdvVerified from './idv-verified.jsx';
import IdvVerified from './idv-verified';

export default IdvVerified;
1 change: 1 addition & 0 deletions packages/account/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"outDir": "./dist",
"baseUrl": "./",
"paths": {
"Assets/*": ["src/Assets/*"],
"Components/*": ["src/Components/*"],
"Containers/*": ["src/Containers/*"],
"Constants/*": ["src/Constants/*"],
Expand Down