1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-10-24 12:23:39 +02:00
metamask-extension/ui/app/pages/swaps/fee-card/fee-card.test.js
Daniel 1b4bc46c7b
Swaps: Show a network name dynamically in a tooltip (#10882)
* Swaps: Show a network name dynamically in a tooltip

* Replace “Ethereum” with “$1”, change “Test” to “Testnet”

* Replace 이더리움 with $1

* Translate network names, use ‘Ethereum’ by default if a translation is not available yet

* Reorder messages to resolve ESLint issues

* Add a snapshot test for the FeeCard component, increase Jest threshold

* Enable snapshot testing into external .snap files in ESLint

* Add the “networkNameEthereum” key in ko/messages.json, remove default “Ethereum” value

* Throw an error if chain ID is not supported by the Swaps feature

* Use string literals when calling the `t` fn,
2021-04-16 19:22:32 -02:30

32 lines
919 B
JavaScript

import React from 'react';
import { render } from '@testing-library/react';
import { MAINNET_CHAIN_ID } from '../../../../../shared/constants/network';
import FeeCard from './fee-card';
describe('FeeCard', () => {
const createProps = (customProps = {}) => {
return {
primaryFee: '1 ETH',
secondaryFee: '2500 USD',
hideTokenApprovalRow: false,
onFeeCardMaxRowClick: jest.fn(),
tokenApprovalTextComponent: <></>,
tokenApprovalSourceTokenSymbol: 'ABC',
onTokenApprovalClick: jest.fn(),
metaMaskFee: '0.875',
isBestQuote: true,
numberOfQuotes: 6,
onQuotesClick: jest.fn(),
tokenConversionRate: 0.015,
chainId: MAINNET_CHAIN_ID,
...customProps,
};
};
it('renders the component with initial props', () => {
const { container } = render(<FeeCard {...createProps()} />);
expect(container).toMatchSnapshot();
});
});