1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-12-18 07:23:21 +01:00
metamask-extension/ui/pages/swaps/main-quote-summary/main-quote-summary.test.js
2021-04-28 14:53:59 -05:00

40 lines
1.2 KiB
JavaScript

import React from 'react';
import { renderWithProvider } from '../../../../test/jest';
import MainQuoteSummary from '.';
const createProps = (customProps = {}) => {
return {
sourceValue: '2000000000000000000',
sourceDecimals: 18,
sourceSymbol: 'ETH',
destinationValue: '200000000000000000',
destinationDecimals: 18,
destinationSymbol: 'BAT',
...customProps,
};
};
describe('MainQuoteSummary', () => {
it('renders the component with initial props', () => {
const props = createProps();
const { getAllByText } = renderWithProvider(
<MainQuoteSummary {...props} />,
);
expect(getAllByText(props.sourceSymbol)).toHaveLength(2);
expect(getAllByText(props.destinationSymbol)).toHaveLength(2);
expect(
document.querySelector('.main-quote-summary__source-row'),
).toMatchSnapshot();
expect(
document.querySelector('.main-quote-summary__destination-row'),
).toMatchSnapshot();
expect(
document.querySelector('.main-quote-summary__quote-large'),
).toMatchSnapshot();
expect(
document.querySelector('.main-quote-summary__exchange-rate-container'),
).toMatchSnapshot();
});
});