diff --git a/packages/trader/src/AppV2/Components/Guide/Description/ContractDescription/multipliers-trade-description.tsx b/packages/trader/src/AppV2/Components/Guide/Description/ContractDescription/multipliers-trade-description.tsx index a568f779e261..ed512793b0a4 100644 --- a/packages/trader/src/AppV2/Components/Guide/Description/ContractDescription/multipliers-trade-description.tsx +++ b/packages/trader/src/AppV2/Components/Guide/Description/ContractDescription/multipliers-trade-description.tsx @@ -115,6 +115,12 @@ const MultipliersTradeDescription = ({ onTermClick }: { onTermClick: (term: stri ), }, + { + type: 'paragraph', + text: ( + + ), + }, ]; return {getContractDescription(content)}; diff --git a/packages/trader/src/AppV2/Components/PurchaseButton/__tests__/purchase-button-content.spec.tsx b/packages/trader/src/AppV2/Components/PurchaseButton/__tests__/purchase-button-content.spec.tsx new file mode 100644 index 000000000000..ed6a4a0a1255 --- /dev/null +++ b/packages/trader/src/AppV2/Components/PurchaseButton/__tests__/purchase-button-content.spec.tsx @@ -0,0 +1,145 @@ +import React from 'react'; +import { render, screen } from '@testing-library/react'; +import { getLocalizedBasis } from '@deriv/shared'; +import PurchaseButtonContent from '../purchase-button-content'; + +type TInfo = React.ComponentProps['info']; + +const mock_props = { + currency: 'USD', + current_stake: 12, + has_open_accu_contract: false, + info: { + has_error: false, + has_error_details: false, + obj_contract_basis: { + text: 'Payout', + value: 19.23, + }, + payout: 19.23, + profit: '9.23', + } as TInfo, + is_accumulator: false, + is_multiplier: false, + is_turbos: false, + is_vanilla: false, + is_vanilla_fx: false, + is_reverse: false, +}; +const wrapper_data_test_id = 'dt_purchase_button_wrapper'; +const localized_basis = getLocalizedBasis(); + +describe('PurchaseButtonContent', () => { + it('should render empty wrapper with specific className if info prop is empty object or falsy', () => { + render(); + + expect(screen.getByTestId(wrapper_data_test_id)).toHaveClass( + 'purchase-button__information__wrapper--disabled-placeholder' + ); + expect(screen.queryByText(mock_props.currency)).not.toBeInTheDocument(); + }); + + it('should render correct default text basis and amount if info was passed', () => { + render(); + + expect(screen.getByTestId(wrapper_data_test_id)).not.toHaveClass( + 'purchase-button__information__wrapper--disabled-placeholder' + ); + expect(screen.getByText(localized_basis.payout)).toBeInTheDocument(); + expect(screen.getByText(/19.23/)).toBeInTheDocument(); + expect(screen.getByText(/USD/i)).toBeInTheDocument(); + }); + + it('should apply specific className to wrapper when is_reverse is true', () => { + render(); + + expect(screen.getByTestId(wrapper_data_test_id)).toHaveClass('purchase-button__information__wrapper--reverse'); + }); + + it('should render correct specific text basis and amount for Multipliers', () => { + const multipliers_info = { + has_error: false, + has_error_details: false, + obj_contract_basis: { + text: '', + value: '', + }, + stake: '10.00', + }; + render(); + + expect(screen.getByText(localized_basis.stake)).toBeInTheDocument(); + expect(screen.getByText(/10/)).toBeInTheDocument(); + expect(screen.getByText(/USD/i)).toBeInTheDocument(); + }); + + it('should render correct specific text basis and amount for Accumulators (when there is no open contract and with it)', () => { + const accumulators_info = { + has_error: false, + has_error_details: false, + obj_contract_basis: { + text: '', + value: '', + }, + maximum_payout: 4000, + }; + const { rerender } = render( + + ); + + expect(screen.getByText(localized_basis.max_payout)).toBeInTheDocument(); + expect(screen.getByText(/4,000.00/)).toBeInTheDocument(); + expect(screen.getByText(/USD/i)).toBeInTheDocument(); + + rerender( + + ); + + expect(screen.getByText(localized_basis.current_stake)).toBeInTheDocument(); + expect(screen.getByText(/12/)).toBeInTheDocument(); + expect(screen.getByText(/USD/i)).toBeInTheDocument(); + }); + + it('should render correct specific text basis and amount for Turbos', () => { + const turbos_info = { + has_error: false, + has_error_details: false, + obj_contract_basis: { + text: 'Payout per point', + value: '8.250455', + }, + }; + render(); + + expect(screen.getByText(localized_basis.payout_per_point)).toBeInTheDocument(); + expect(screen.getByText(/8.250455/)).toBeInTheDocument(); + expect(screen.getByText(/USD/i)).toBeInTheDocument(); + }); + + it('should render correct specific text basis and amount for Vanilla (not fx and fx)', () => { + const vanilla_info = { + has_error: false, + has_error_details: false, + obj_contract_basis: { + text: 'Payout per point', + value: '12.77095', + }, + }; + const { rerender } = render(); + + expect(screen.getByText(localized_basis.payout_per_point)).toBeInTheDocument(); + expect(screen.getByText(/12.77095/)).toBeInTheDocument(); + expect(screen.getByText(/USD/i)).toBeInTheDocument(); + + rerender(); + + expect(screen.getByText(localized_basis.payout_per_pip)).toBeInTheDocument(); + expect(screen.getByText(/12.77095/)).toBeInTheDocument(); + expect(screen.getByText(/USD/i)).toBeInTheDocument(); + }); +}); diff --git a/packages/trader/src/AppV2/Components/PurchaseButton/__tests__/purchase-button.spec.tsx b/packages/trader/src/AppV2/Components/PurchaseButton/__tests__/purchase-button.spec.tsx new file mode 100644 index 000000000000..9adb211798f7 --- /dev/null +++ b/packages/trader/src/AppV2/Components/PurchaseButton/__tests__/purchase-button.spec.tsx @@ -0,0 +1,228 @@ +import React from 'react'; +import { render, screen } from '@testing-library/react'; +import userEvent from '@testing-library/user-event'; +import { mockContractInfo } from '@deriv/shared'; +import { mockStore } from '@deriv/stores'; +import { ReportsStoreProvider } from '../../../../../../reports/src/Stores/useReportsStores'; +import TraderProviders from '../../../../trader-providers'; +import ModulesProvider from 'Stores/Providers/modules-providers'; +import PurchaseButton from '../purchase-button'; + +describe('PositionsContent', () => { + let defaultMockStore: ReturnType; + + beforeEach(() => { + defaultMockStore = mockStore({ + portfolio: { + all_positions: [ + { + contract_info: { + ...mockContractInfo({ + contract_id: 243687440268, + contract_type: 'MULTUP', + multiplier: 100, + }), + }, + details: + "If you select 'Up', your total profit/loss will be the percentage increase in Volatility 100 (1s) Index, multiplied by 1000, minus commissions.", + display_name: '', + id: 243687440268, + indicative: 41.4, + purchase: 10, + reference: 486015531488, + type: 'MULTUP', + contract_update: { + stop_out: { + display_name: 'Stop out', + order_amount: -10, + order_date: 1716877413, + value: '774.81', + }, + }, + entry_spot: 782.35, + profit_loss: 31.4, + is_valid_to_sell: true, + status: 'profit', + }, + { + contract_info: { + ...mockContractInfo({ + contract_id: 243705193508, + contract_type: 'TURBOSLONG', + }), + }, + details: + 'You will receive a payout at expiry if the spot price never breaches the barrier. The payout is equal to the payout per point multiplied by the distance between the final price and the barrier.', + display_name: '', + id: 243705193508, + indicative: 4.4, + purchase: 10, + reference: 486048790368, + type: 'TURBOSLONG', + barrier: 821.69, + entry_spot: 824.24, + profit_loss: -5.6, + is_valid_to_sell: true, + status: 'profit', + }, + { + contract_info: { + ...mockContractInfo({ + contract_id: 249545026128, + contract_type: 'ACCU', + is_settleable: 0, + is_sold: 0, + is_valid_to_cancel: 0, + is_valid_to_sell: 1, + growth_rate: 0.03, + entry_spot: 364.15, + entry_spot_display_value: '364.15', + }), + }, + details: + 'After the entry spot tick, your stake will grow continuously by 3% for every tick that the spot price remains within the ± 0.03797% from the previous spot price.', + display_name: 'Volatility 100 (1s) Index', + id: 249545026128, + indicative: 18.6, + purchase: 10, + type: 'ACCU', + profit_loss: 8.6, + is_valid_to_sell: true, + current_tick: 21, + status: 'profit', + entry_spot: 364.15, + high_barrier: 364.149, + low_barrier: 363.871, + }, + ], + }, + modules: { + trade: { + ...mockStore({}).modules.trade, + currency: 'USD', + contract_type: 'rise_fall', + is_purchase_enabled: true, + proposal_info: { + PUT: { + id: 1234, + has_error: false, + has_error_details: false, + message: + 'Win payout if Volatility 100 (1s) Index is strictly lower than entry spot at 10 minutes after contract start time.', + obj_contract_basis: { + text: 'Payout', + value: 19.2, + }, + payout: 19.2, + profit: '9.20', + returns: '92.00%', + stake: '10.00', + spot: 366.11, + barrier: '366.11', + growth_rate: 0.03, + spot_time: 1721206371, + }, + CALL: { + id: 12345, + has_error: false, + has_error_details: false, + message: + 'Win payout if Volatility 100 (1s) Index is strictly higher than entry spot at 10 minutes after contract start time.', + obj_contract_basis: { + text: 'Payout', + value: 19.26, + }, + payout: 19.26, + profit: '9.26', + returns: '92.60%', + stake: '10.00', + spot: 366.11, + barrier: '366.11', + growth_rate: 0.03, + spot_time: 1721206371, + }, + }, + symbol: '1HZ100V', + trade_types: { + CALL: 'Rise', + PUT: 'Fall', + }, + }, + }, + }); + }); + + const mockPurchaseButton = () => { + render( + + + + + + + + ); + }; + + it('should render two buttons (for Rise and for Fall) with a proper content from proposal_info', () => { + mockPurchaseButton(); + + expect(screen.getAllByText('Payout')).toHaveLength(2); + expect(screen.getByText(/19.26/)).toBeInTheDocument(); + expect(screen.getAllByText(/USD/i)).toHaveLength(2); + expect(screen.getByText('Rise')).toBeInTheDocument(); + expect(screen.getByText('Fall')).toBeInTheDocument(); + }); + + it('should switch to loading state (apply a proper className and show loader instead of button name) and call onPurchase function if user clicks on purchase button', () => { + mockPurchaseButton(); + + const purchase_button = screen.getAllByRole('button')[0]; + expect(purchase_button).not.toHaveClass('purchase-button--loading'); + expect(defaultMockStore.modules.trade.onPurchase).not.toBeCalled(); + expect(screen.queryByTestId('button-loader')).not.toBeInTheDocument(); + + userEvent.click(purchase_button); + + expect(purchase_button).toHaveClass('purchase-button--loading'); + expect(defaultMockStore.modules.trade.onPurchase).toBeCalled(); + expect(screen.getByTestId('button-loader')).toBeInTheDocument(); + }); + + it('should disable the button if one of the prop is false (is_trade_enabled, is_proposal_empty, !info.id, is_purchase_enabled): button should have a specific attribute and if user clicks on it onPurchase will not be called', () => { + defaultMockStore.modules.trade.is_purchase_enabled = false; + mockPurchaseButton(); + + const purchase_button = screen.getAllByRole('button')[0]; + expect(purchase_button).toBeDisabled(); + expect(defaultMockStore.modules.trade.onPurchase).not.toBeCalled(); + + userEvent.click(purchase_button); + + expect(defaultMockStore.modules.trade.onPurchase).not.toBeCalled(); + }); + + it('should render only one button if trade_types have only one field', () => { + defaultMockStore.modules.trade.trade_types = { + CALL: 'Rise', + }; + mockPurchaseButton(); + + const purchase_button = screen.getByRole('button'); + expect(purchase_button).toBeInTheDocument(); + expect(purchase_button).toHaveClass('purchase-button--single'); + }); + + it('should render sell button for Accumulators contract if there is an open Accumulators contract; if user clicks on it - onClickSell should be called', () => { + defaultMockStore.modules.trade.has_open_accu_contract = true; + defaultMockStore.modules.trade.is_accumulator = true; + mockPurchaseButton(); + + const sell_button = screen.getByText('Sell'); + expect(sell_button).toBeInTheDocument(); + expect(defaultMockStore.portfolio.onClickSell).not.toBeCalled(); + + userEvent.click(sell_button); + expect(defaultMockStore.portfolio.onClickSell).toBeCalled(); + }); +}); diff --git a/packages/trader/src/AppV2/Components/PurchaseButton/purchase-button-content.tsx b/packages/trader/src/AppV2/Components/PurchaseButton/purchase-button-content.tsx index 6e6495d0ced5..19c091b71d28 100644 --- a/packages/trader/src/AppV2/Components/PurchaseButton/purchase-button-content.tsx +++ b/packages/trader/src/AppV2/Components/PurchaseButton/purchase-button-content.tsx @@ -59,6 +59,7 @@ const PurchaseButtonContent = ({ is_reverse && 'purchase-button__information__wrapper--reverse', is_content_empty && 'purchase-button__information__wrapper--disabled-placeholder' )} + data-testid='dt_purchase_button_wrapper' > {!is_content_empty && ( diff --git a/packages/trader/src/AppV2/Components/TradeParameters/TradeTypeTabs/__tests__/trade-type-tabs.spec.tsx b/packages/trader/src/AppV2/Components/TradeParameters/TradeTypeTabs/__tests__/trade-type-tabs.spec.tsx new file mode 100644 index 000000000000..13396962497f --- /dev/null +++ b/packages/trader/src/AppV2/Components/TradeParameters/TradeTypeTabs/__tests__/trade-type-tabs.spec.tsx @@ -0,0 +1,59 @@ +import React from 'react'; +import { render, screen } from '@testing-library/react'; +import userEvent from '@testing-library/user-event'; +import { TRADE_TYPES } from '@deriv/shared'; +import { mockStore } from '@deriv/stores'; +import TraderProviders from '../../../../../trader-providers'; +import { ReportsStoreProvider } from '../../../../../../../reports/src/Stores/useReportsStores'; +import ModulesProvider from 'Stores/Providers/modules-providers'; +import TradeTypeTabs from '../trade-type-tabs'; + +describe('TradeTypeTabs', () => { + let defaultMockStore: ReturnType; + + beforeEach(() => { + defaultMockStore = mockStore({}); + }); + + const mockTradeTypeTabs = (props?: React.ComponentProps) => { + return ( + + + + + + + + ); + }; + + it('should not render component if contract type is not Vanillas or Turbos', () => { + const { container } = render(mockTradeTypeTabs()); + + expect(container).toBeEmptyDOMElement(); + }); + + it('should render correct tabs name for Vanillas', () => { + defaultMockStore.modules.trade.contract_type = TRADE_TYPES.VANILLA.CALL; + render(mockTradeTypeTabs({ is_minimized: true })); + + expect(screen.getByText('Call')).toBeInTheDocument(); + expect(screen.getByText('Put')).toBeInTheDocument(); + + userEvent.click(screen.getByText('Put')); + }); + + it('should call onChange function if user clicks on another tab and not call it if he clicks on the already chosen one', () => { + defaultMockStore.modules.trade.contract_type = TRADE_TYPES.TURBOS.LONG; + render(mockTradeTypeTabs()); + + const current_tab = screen.getByText('Up'); + const another_tab = screen.getByText('Down'); + expect(defaultMockStore.modules.trade.onChange).not.toBeCalled(); + userEvent.click(current_tab); + expect(defaultMockStore.modules.trade.onChange).not.toBeCalled(); + + userEvent.click(another_tab); + expect(defaultMockStore.modules.trade.onChange).toBeCalled(); + }); +}); diff --git a/packages/trader/src/AppV2/Components/TradeParameters/__tests__/trade-parameters-container.spec.tsx b/packages/trader/src/AppV2/Components/TradeParameters/__tests__/trade-parameters-container.spec.tsx new file mode 100644 index 000000000000..508777e820c3 --- /dev/null +++ b/packages/trader/src/AppV2/Components/TradeParameters/__tests__/trade-parameters-container.spec.tsx @@ -0,0 +1,29 @@ +import React from 'react'; +import { render, screen } from '@testing-library/react'; +import TradeParametersContainer from '../trade-parameters-container'; + +const children = 'children'; +const mock_children =
{children}
; + +jest.mock('react-transition-group', () => ({ + CSSTransition: jest.fn(({ children }) =>
{children}
), +})); +jest.mock('../../Guide', () => jest.fn(() => 'Guide')); + +describe('TradeParametersContainer', () => { + it('should render a proper content with children if is_minimized is false', () => { + render({mock_children}); + + expect(screen.getByText('Set your trade')).toBeInTheDocument(); + expect(screen.getByText('Guide')).toBeInTheDocument(); + expect(screen.getByText(children)).toBeInTheDocument(); + }); + + it('should render only children if is_minimized is true', () => { + render({mock_children}); + + expect(screen.queryByText('Set your trade')).not.toBeInTheDocument(); + expect(screen.queryByText('Guide')).not.toBeInTheDocument(); + expect(screen.getByText(children)).toBeInTheDocument(); + }); +}); diff --git a/packages/trader/src/AppV2/Components/TradeParameters/__tests__/trade-parameters.spec.tsx b/packages/trader/src/AppV2/Components/TradeParameters/__tests__/trade-parameters.spec.tsx new file mode 100644 index 000000000000..ae058aa82f13 --- /dev/null +++ b/packages/trader/src/AppV2/Components/TradeParameters/__tests__/trade-parameters.spec.tsx @@ -0,0 +1,171 @@ +import React from 'react'; +import { render, screen } from '@testing-library/react'; +import { TRADE_TYPES } from '@deriv/shared'; +import { mockStore } from '@deriv/stores'; +import ModulesProvider from 'Stores/Providers/modules-providers'; +import TraderProviders from '../../../../trader-providers'; +import { ReportsStoreProvider } from '../../../../../../reports/src/Stores/useReportsStores'; +import TradeParameters from '../trade-parameters'; + +const TRADE_PARAMS = { + ALLOW_EQUALS: 'AllowEquals', + DURATION: 'Duration', + STAKE: 'Stake', + BARRIER: 'Barrier', + GROWTH_RATE: 'GrowthRate', + TAKE_PROFIT: 'TakeProfit', + ACCUMULATORS_INFORMATION: 'AccumulatorsInformation', + MULTIPLIER: 'Multiplier', + RISK_MANAGEMENT: 'RiskManagement', + MULTIPLIERS_INFORMATION: 'MultipliersInformation', + TRADE_TYPE_TABS: 'TradeTypeTabs', + STRIKE: 'Strike', + PAYOUT_PER_POINT: 'PayoutPerPoint', + LAST_DIGIT_PREDICTION: 'LastDigitPrediction', +}; +const data_test = 'dt_trade_param'; + +jest.mock('../AllowEquals', () => jest.fn(() =>
{TRADE_PARAMS.ALLOW_EQUALS}
)); +jest.mock('../Duration', () => jest.fn(() =>
{TRADE_PARAMS.DURATION}
)); +jest.mock('../Stake', () => jest.fn(() =>
{TRADE_PARAMS.STAKE}
)); +jest.mock('../Barrier', () => jest.fn(() =>
{TRADE_PARAMS.BARRIER}
)); +jest.mock('../GrowthRate', () => jest.fn(() =>
{TRADE_PARAMS.GROWTH_RATE}
)); +jest.mock('../TakeProfit', () => jest.fn(() =>
{TRADE_PARAMS.TAKE_PROFIT}
)); +jest.mock('../AccumulatorsInformation', () => + jest.fn(() =>
{TRADE_PARAMS.ACCUMULATORS_INFORMATION}
) +); +jest.mock('../Multiplier', () => jest.fn(() =>
{TRADE_PARAMS.MULTIPLIER}
)); +jest.mock('../RiskManagement', () => jest.fn(() =>
{TRADE_PARAMS.RISK_MANAGEMENT}
)); +jest.mock('../MultipliersInformation', () => + jest.fn(() =>
{TRADE_PARAMS.MULTIPLIERS_INFORMATION}
) +); +jest.mock('../TradeTypeTabs', () => jest.fn(() =>
{TRADE_PARAMS.TRADE_TYPE_TABS}
)); +jest.mock('../Strike', () => jest.fn(() =>
{TRADE_PARAMS.STRIKE}
)); +jest.mock('../PayoutPerPoint', () => jest.fn(() =>
{TRADE_PARAMS.PAYOUT_PER_POINT}
)); +jest.mock('../LastDigitPrediction', () => + jest.fn(() =>
{TRADE_PARAMS.LAST_DIGIT_PREDICTION}
) +); + +describe('TradeParameters', () => { + let defaultMockStore: ReturnType; + + beforeEach(() => { + defaultMockStore = mockStore({}); + }); + + const mockTradeParameters = () => { + return ( + + + + + + + + ); + }; + + it('should render correct trade params for Accumulators', () => { + defaultMockStore.modules.trade.contract_type = TRADE_TYPES.ACCUMULATOR; + render(mockTradeParameters()); + + expect(screen.getByText(TRADE_PARAMS.GROWTH_RATE)).toBeInTheDocument(); + expect(screen.getByText(TRADE_PARAMS.STAKE)).toBeInTheDocument(); + expect(screen.getByText(TRADE_PARAMS.TAKE_PROFIT)).toBeInTheDocument(); + expect(screen.getByText(TRADE_PARAMS.ACCUMULATORS_INFORMATION)).toBeInTheDocument(); + expect(screen.getAllByTestId(data_test)).toHaveLength(4); + }); + + it('should render correct trade params for Vanillas', () => { + defaultMockStore.modules.trade.contract_type = TRADE_TYPES.VANILLA.CALL; + render(mockTradeParameters()); + + expect(screen.getByText(TRADE_PARAMS.TRADE_TYPE_TABS)).toBeInTheDocument(); + expect(screen.getByText(TRADE_PARAMS.DURATION)).toBeInTheDocument(); + expect(screen.getByText(TRADE_PARAMS.STRIKE)).toBeInTheDocument(); + expect(screen.getByText(TRADE_PARAMS.STAKE)).toBeInTheDocument(); + expect(screen.getAllByTestId(data_test)).toHaveLength(4); + }); + + it('should render correct trade params for Turbos', () => { + defaultMockStore.modules.trade.contract_type = TRADE_TYPES.TURBOS.LONG; + render(mockTradeParameters()); + + expect(screen.getByText(TRADE_PARAMS.TRADE_TYPE_TABS)).toBeInTheDocument(); + expect(screen.getByText(TRADE_PARAMS.DURATION)).toBeInTheDocument(); + expect(screen.getByText(TRADE_PARAMS.PAYOUT_PER_POINT)).toBeInTheDocument(); + expect(screen.getByText(TRADE_PARAMS.STAKE)).toBeInTheDocument(); + expect(screen.getByText(TRADE_PARAMS.TAKE_PROFIT)).toBeInTheDocument(); + expect(screen.getAllByTestId(data_test)).toHaveLength(5); + }); + + it('should render correct trade params for Multipliers', () => { + defaultMockStore.modules.trade.contract_type = TRADE_TYPES.MULTIPLIER; + render(mockTradeParameters()); + + expect(screen.getByText(TRADE_PARAMS.MULTIPLIER)).toBeInTheDocument(); + expect(screen.getByText(TRADE_PARAMS.STAKE)).toBeInTheDocument(); + expect(screen.getByText(TRADE_PARAMS.RISK_MANAGEMENT)).toBeInTheDocument(); + expect(screen.getByText(TRADE_PARAMS.MULTIPLIERS_INFORMATION)).toBeInTheDocument(); + expect(screen.getAllByTestId(data_test)).toHaveLength(4); + }); + + it('should render correct trade params for Rise/Fall', () => { + defaultMockStore.modules.trade.contract_type = TRADE_TYPES.RISE_FALL; + render(mockTradeParameters()); + + expect(screen.getByText(TRADE_PARAMS.DURATION)).toBeInTheDocument(); + expect(screen.getByText(TRADE_PARAMS.STAKE)).toBeInTheDocument(); + expect(screen.getByText(TRADE_PARAMS.ALLOW_EQUALS)).toBeInTheDocument(); + expect(screen.getAllByTestId(data_test)).toHaveLength(3); + }); + + it('should render correct trade params for Higher/Lower', () => { + defaultMockStore.modules.trade.contract_type = TRADE_TYPES.HIGH_LOW; + render(mockTradeParameters()); + + expect(screen.getByText(TRADE_PARAMS.DURATION)).toBeInTheDocument(); + expect(screen.getByText(TRADE_PARAMS.BARRIER)).toBeInTheDocument(); + expect(screen.getByText(TRADE_PARAMS.STAKE)).toBeInTheDocument(); + expect(screen.getAllByTestId(data_test)).toHaveLength(3); + }); + + it('should render correct trade params for Touch/No Touch', () => { + defaultMockStore.modules.trade.contract_type = TRADE_TYPES.TOUCH; + render(mockTradeParameters()); + + expect(screen.getByText(TRADE_PARAMS.DURATION)).toBeInTheDocument(); + expect(screen.getByText(TRADE_PARAMS.BARRIER)).toBeInTheDocument(); + expect(screen.getByText(TRADE_PARAMS.STAKE)).toBeInTheDocument(); + expect(screen.getAllByTestId(data_test)).toHaveLength(3); + }); + + it('should render correct trade params for Matches/Differs', () => { + defaultMockStore.modules.trade.contract_type = TRADE_TYPES.MATCH_DIFF; + render(mockTradeParameters()); + + expect(screen.getByText(TRADE_PARAMS.LAST_DIGIT_PREDICTION)).toBeInTheDocument(); + expect(screen.getByText(TRADE_PARAMS.DURATION)).toBeInTheDocument(); + expect(screen.getByText(TRADE_PARAMS.STAKE)).toBeInTheDocument(); + expect(screen.getAllByTestId(data_test)).toHaveLength(3); + }); + + it('should render correct trade params for Even/Odd', () => { + defaultMockStore.modules.trade.contract_type = TRADE_TYPES.EVEN_ODD; + render(mockTradeParameters()); + + expect(screen.getByText(TRADE_PARAMS.DURATION)).toBeInTheDocument(); + expect(screen.getByText(TRADE_PARAMS.STAKE)).toBeInTheDocument(); + expect(screen.getAllByTestId(data_test)).toHaveLength(2); + }); + + it('should render correct trade params for Over/Under', () => { + defaultMockStore.modules.trade.contract_type = TRADE_TYPES.OVER_UNDER; + render(mockTradeParameters()); + + expect(screen.getByText(TRADE_PARAMS.LAST_DIGIT_PREDICTION)).toBeInTheDocument(); + expect(screen.getByText(TRADE_PARAMS.DURATION)).toBeInTheDocument(); + expect(screen.getByText(TRADE_PARAMS.STAKE)).toBeInTheDocument(); + expect(screen.getAllByTestId(data_test)).toHaveLength(3); + }); +});