A Metamask fork with Infura removed and default networks editable
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
ciphermask/ui/pages/swaps/build-quote/build-quote.test.js

48 lines
1.5 KiB

import React from 'react';
import configureMockStore from 'redux-mock-store';
import thunk from 'redux-thunk';
import {
renderWithProvider,
createSwapsMockStore,
setBackgroundConnection,
} from '../../../../test/jest';
import BuildQuote from '.';
const middleware = [thunk];
const createProps = (customProps = {}) => {
return {
ethBalance: '0x8',
selectedAccountAddress: 'selectedAccountAddress',
isFeatureFlagLoaded: false,
shuffledTokensList: [],
...customProps,
};
};
setBackgroundConnection({
resetPostFetchState: jest.fn(),
ignoreTokens: jest.fn(),
setBackgroundSwapRouteState: jest.fn(),
clearSwapsQuotes: jest.fn(),
stopPollingForQuotes: jest.fn(),
clearSmartTransactionFees: jest.fn(),
});
describe('BuildQuote', () => {
it('renders the component with initial props', () => {
const store = configureMockStore(middleware)(createSwapsMockStore());
const props = createProps();
const { getByText } = renderWithProvider(<BuildQuote {...props} />, store);
expect(getByText('Swap from')).toBeInTheDocument();
expect(getByText('Swap to')).toBeInTheDocument();
expect(getByText('ETH')).toBeInTheDocument();
expect(getByText('Slippage tolerance')).toBeInTheDocument();
expect(getByText('2%')).toBeInTheDocument();
expect(getByText('3%')).toBeInTheDocument();
expect(getByText('Review swap')).toBeInTheDocument();
expect(
document.querySelector('.slippage-buttons__button-group'),
).toMatchSnapshot();
});
});