Skip to content

Commit

Permalink
test: ✅ added onboarding test for financial restricted countries
Browse files Browse the repository at this point in the history
  • Loading branch information
arshad-rao-deriv committed Aug 15, 2023
1 parent e4c4670 commit d3e04dd
Showing 1 changed file with 18 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,13 @@ import { StoreProvider, mockStore } from '@deriv/stores';
import { render, screen } from '@testing-library/react';
import StaticDashboard, { TStaticDashboard } from '../static-dashboard';

jest.mock('../static-trading-app-card.tsx', () =>
jest.fn(({ name }) => <div data-testid='trading_app_card'>{name}</div>)
);
jest.mock('../static-cfd-account-manager.tsx', () =>
jest.fn(({ appname }) => <div data-testid='cfd_account_manager'>{appname}</div>)
);

describe('StaticDashboard', () => {
const render_container = (mock_store_override = {}) => {
const mock_store = mockStore(mock_store_override);
Expand Down Expand Up @@ -65,4 +72,15 @@ describe('StaticDashboard', () => {
const dashboard_sections = screen.getByTestId('dt_onboarding_dashboard');
expect(dashboard_sections).toHaveClass('static-dashboard--eu');
});

it('should display correct platforms if the user residence is in financial restricted countries', () => {
render_container({ client: { is_logged_in: true }, traders_hub: { financial_restricted_countries: true } });
const trading_app_card = screen.getAllByTestId('trading_app_card');
const cfd_account_manager = screen.getAllByTestId('cfd_account_manager');
expect(trading_app_card.length).not.toBeGreaterThan(1);
expect(trading_app_card[0]).toHaveTextContent('Deriv Trader');
expect(cfd_account_manager.length).not.toBeGreaterThan(2);
expect(cfd_account_manager[0]).toHaveTextContent('Deriv account');
expect(cfd_account_manager[1]).toHaveTextContent('Financial');
});
});

0 comments on commit d3e04dd

Please sign in to comment.