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

Arshad/ WALL-833/ show correct platform on trader's hub onboarding #9680

Merged
Show file tree
Hide file tree
Changes from 2 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
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');
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -270,11 +270,11 @@ const StaticDashboard = observer(
availability='All'
has_applauncher_account={has_applauncher_account}
is_item_blurry={is_blurry.platformlauncher}
has_divider={!eu_user}
has_divider={!eu_user && !financial_restricted_countries}
/>
</div>

{!eu_user && (
{!eu_user && !financial_restricted_countries && (
<React.Fragment>
<div className='static-dashboard-wrapper__body--apps-item'>
<StaticTradingAppCard
Expand Down Expand Up @@ -429,7 +429,7 @@ const StaticDashboard = observer(
</div>

<div className='static-dashboard-wrapper__body'>
{!is_eu_user && !CFDs_restricted_countries && (
{!is_eu_user && !CFDs_restricted_countries && !financial_restricted_countries && (
<StaticCFDAccountManager
type='synthetic'
platform='mt5'
Expand Down Expand Up @@ -540,7 +540,7 @@ const StaticDashboard = observer(
</div>
</React.Fragment>
)}
{!is_eu_user && !CFDs_restricted_countries && (
{!is_eu_user && !CFDs_restricted_countries && !financial_restricted_countries && (
<div className='static-dashboard-wrapper__body'>
<StaticCFDAccountManager
type='all'
Expand Down