import React from 'react'; import mockState from '../../../../test/data/mock-state.json'; import { renderWithProvider } from '../../../../test/lib/render-helpers'; import configureStore from '../../../store/store'; import MultilayerFeeMessage from './multi-layer-fee-message'; jest.mock('../../../helpers/utils/optimism/fetchEstimatedL1Fee', () => '0x5'); describe('Multi layer fee message', () => { describe('when balance and token price checker is enabled', () => { let store; beforeEach(() => { store = configureStore(mockState); }); afterEach(() => { store = null; }); it('should match snapshot', () => { const { container } = renderWithProvider( , store, ); expect(container).toMatchSnapshot(); }); it('should contain fee values', () => { const { getByText } = renderWithProvider( , store, ); expect(getByText('Layer 1 fees')).toBeInTheDocument(); expect(getByText('Amount + fees')).toBeInTheDocument(); expect(getByText('0.001000021000 ETH')).toBeInTheDocument(); expect(getByText('$0.56')).toBeInTheDocument(); }); }); describe('when balance and token price checker is disabled', () => { let storeWithPriceCheckerDisabled; beforeEach(() => { storeWithPriceCheckerDisabled = configureStore({ ...mockState, metamask: { ...mockState.metamask, useCurrencyRateCheck: false, }, }); }); afterEach(() => { storeWithPriceCheckerDisabled = null; }); it('should match screenshot', () => { const { container } = renderWithProvider( , storeWithPriceCheckerDisabled, ); expect(container).toMatchSnapshot(); }); it('should not contain a fiat value', () => { const { queryByText } = renderWithProvider( , storeWithPriceCheckerDisabled, ); expect(queryByText('$0.56')).not.toBeInTheDocument(); }); }); });