mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-11-24 19:10:22 +01:00
59 lines
1.8 KiB
JavaScript
59 lines
1.8 KiB
JavaScript
import React from 'react';
|
|
import { screen } from '@testing-library/react';
|
|
|
|
import { GAS_ESTIMATE_TYPES } from '../../../../../shared/constants/gas';
|
|
import mockEstimates from '../../../../../test/data/mock-estimates.json';
|
|
import mockState from '../../../../../test/data/mock-state.json';
|
|
import { renderWithProvider } from '../../../../../test/lib/render-helpers';
|
|
import configureStore from '../../../../store/store';
|
|
import AdvancedGasFeeInputSubtext from './advanced-gas-fee-input-subtext';
|
|
|
|
jest.mock('../../../../store/actions', () => ({
|
|
disconnectGasFeeEstimatePoller: jest.fn(),
|
|
getGasFeeEstimatesAndStartPolling: jest
|
|
.fn()
|
|
.mockImplementation(() => Promise.resolve()),
|
|
addPollingTokenToAppState: jest.fn(),
|
|
removePollingTokenFromAppState: jest.fn(),
|
|
}));
|
|
|
|
const render = () => {
|
|
const store = configureStore({
|
|
metamask: {
|
|
...mockState.metamask,
|
|
accounts: {
|
|
[mockState.metamask.selectedAddress]: {
|
|
address: mockState.metamask.selectedAddress,
|
|
balance: '0x1F4',
|
|
},
|
|
},
|
|
advancedGasFee: { priorityFee: 100 },
|
|
featureFlags: { advancedInlineGas: true },
|
|
gasFeeEstimates:
|
|
mockEstimates[GAS_ESTIMATE_TYPES.FEE_MARKET].gasFeeEstimates,
|
|
},
|
|
});
|
|
|
|
return renderWithProvider(
|
|
<AdvancedGasFeeInputSubtext
|
|
latest="Latest Value"
|
|
historical="Historical value"
|
|
/>,
|
|
store,
|
|
);
|
|
};
|
|
|
|
describe('AdvancedGasFeeInputSubtext', () => {
|
|
it('should renders latest and historical values passed', () => {
|
|
render(
|
|
<AdvancedGasFeeInputSubtext
|
|
latest="Latest Value"
|
|
historical="Historical value"
|
|
/>,
|
|
);
|
|
|
|
expect(screen.queryByText('Latest Value')).toBeInTheDocument();
|
|
expect(screen.queryByText('Historical value')).toBeInTheDocument();
|
|
});
|
|
});
|