mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 09:52:26 +01:00
7a92e22111
* Trigger Build * Trigger Build * Move swaps index variables to redux * all optimizations so far * Add better equality checks for selectors in swaps index and build quote * Clean up PR, remove extra code and logs * Clean up lavamoat file * Fixes for optimizations * Update tests and test snapshots * Remove unnecessary tests * Remove unnecessary console log * Trigger Build * Trigger Build * Add delay to account for remote call made by trezor keyring Co-authored-by: Dan Miller <danjm.com@gmail.com>
48 lines
1.4 KiB
JavaScript
48 lines
1.4 KiB
JavaScript
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(),
|
|
removeToken: jest.fn(),
|
|
setBackgroundSwapRouteState: jest.fn(),
|
|
clearSwapsQuotes: jest.fn(),
|
|
stopPollingForQuotes: 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();
|
|
});
|
|
});
|