Skip to content

Commit

Permalink
Arshad/ WALL-833/ show correct platform on trader's hub onboarding (#…
Browse files Browse the repository at this point in the history
…9680)

* fix: show correct platform on trader's hub onboarding

* test: ✅ added onboarding test for financial restricted countries

* fix: fixed cfd restricted countries
  • Loading branch information
arshad-rao-deriv committed Aug 29, 2023
1 parent f836654 commit 74a5827
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 4 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');
});
});
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 && !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

1 comment on commit 74a5827

@vercel
Copy link

@vercel vercel bot commented on 74a5827 Aug 29, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

deriv-app – ./

deriv-app.vercel.app
binary.sx
deriv-app.binary.sx
deriv-app-git-master.binary.sx

Please sign in to comment.