1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-11-27 12:56:01 +01:00
metamask-extension/ui/components/app/gas-details-item/gas-details-item-title/gas-details-item-title.test.js

52 lines
1.5 KiB
JavaScript
Raw Normal View History

2021-12-12 00:26:28 +01:00
import React from 'react';
import { screen, waitFor } from '@testing-library/react';
import { MAINNET_CHAIN_ID } from '../../../../../shared/constants/network';
import { GasFeeContextProvider } from '../../../../contexts/gasFee';
import { renderWithProvider } from '../../../../../test/jest';
import configureStore from '../../../../store/store';
import GasDetailsItemTitle from './gas-details-item-title';
jest.mock('../../../../store/actions', () => ({
disconnectGasFeeEstimatePoller: jest.fn(),
getGasFeeEstimatesAndStartPolling: jest
.fn()
.mockImplementation(() => Promise.resolve()),
addPollingTokenToAppState: jest.fn(),
getGasFeeTimeEstimate: jest.fn().mockImplementation(() => Promise.resolve()),
}));
const render = () => {
const store = configureStore({
metamask: {
provider: { chainId: MAINNET_CHAIN_ID },
cachedBalances: {},
accounts: {
'0xAddress': {
address: '0xAddress',
balance: '0x176e5b6f173ebe66',
},
},
selectedAddress: '0xAddress',
},
});
return renderWithProvider(
<GasFeeContextProvider transaction={{ txParams: {} }}>
<GasDetailsItemTitle userAcknowledgedGasMissing={false} />
</GasFeeContextProvider>,
store,
);
};
describe('GasDetailsItem', () => {
it('should render label', async () => {
render();
await waitFor(() => {
expect(screen.queryByText('Gas')).toBeInTheDocument();
expect(screen.queryByText('(estimated)')).toBeInTheDocument();
});
});
});