Skip to content

Commit

Permalink
[WALL] Aizad/WALL-2899/WalletMarketCurrencyIcon-test-case (deriv-com#…
Browse files Browse the repository at this point in the history
…15685)

* chore: added WalletMarketCurrencyIcon test case

* chore: rerun workflow
  • Loading branch information
aizad-deriv authored Jun 19, 2024
1 parent c5fada5 commit f91a215
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ const WalletMarketCurrencyIcon: FC<TWalletMarketCurrencyIconProps> = ({ currency
} else MarketTypeIcon = 'IcWalletOptionsLight';

return (
<div className='wallets-market-currency-icon'>
<div className='wallets-market-currency-icon' data-testid='dt_wallet_market_icon'>
<div className='wallets-market-currency-icon__container'>
<WalletMarketIcon
className='wallets-market-currency-icon__market-icon'
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
import React from 'react';
import { render, screen } from '@testing-library/react';
import { CFD_PLATFORMS, MARKET_TYPE } from '../../../features/cfd/constants';
import WalletMarketCurrencyIcon from '../WalletMarketCurrencyIcon';
import '@testing-library/jest-dom';

const defaultProps = {
currency: 'USD',
isDemo: false,
};
describe('WalletMarketCurrencyIcon', () => {
it('renders MT5 Financial Icon', () => {
render(
<WalletMarketCurrencyIcon
{...defaultProps}
marketType={MARKET_TYPE.FINANCIAL}
platform={CFD_PLATFORMS.MT5}
/>
);
const marketIcon = screen.getByTestId('dt_wallet_icon');
const currencyIcon = screen.getByTestId('dt_wallet_currency_icon');
expect(screen.getByTestId('dt_wallet_market_icon')).toBeInTheDocument();
expect(marketIcon).toBeInTheDocument();
expect(currencyIcon).toBeInTheDocument();
});

it('renders DXTrade icon', () => {
render(
<WalletMarketCurrencyIcon {...defaultProps} marketType={MARKET_TYPE.ALL} platform={CFD_PLATFORMS.DXTRADE} />
);
const marketIcon = screen.getByTestId('dt_wallet_icon');
const currencyIcon = screen.getByTestId('dt_wallet_currency_icon');
expect(screen.getByTestId('dt_wallet_market_icon')).toBeInTheDocument();
expect(marketIcon).toBeInTheDocument();
expect(currencyIcon).toBeInTheDocument();
});

it('renders Options icon', () => {
render(<WalletMarketCurrencyIcon {...defaultProps} marketType={undefined} platform={undefined} />);
const marketIcon = screen.getByTestId('dt_wallet_icon');
const currencyIcon = screen.getByTestId('dt_wallet_currency_icon');
expect(screen.getByTestId('dt_wallet_market_icon')).toBeInTheDocument();
expect(marketIcon).toBeInTheDocument();
expect(currencyIcon).toBeInTheDocument();
});
});

0 comments on commit f91a215

Please sign in to comment.