Skip to content

Commit

Permalink
update spec mocks
Browse files Browse the repository at this point in the history
  • Loading branch information
jiexi committed Mar 20, 2024
1 parent ac8bf75 commit 988285f
Show file tree
Hide file tree
Showing 23 changed files with 47 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ import TransactionListItemDetails from '.';

jest.mock('../../../store/actions.ts', () => ({
tryReverseResolveAddress: () => jest.fn(),
addPollingTokenToAppState: jest.fn(),
removePollingTokenFromAppState: jest.fn(),
gasFeeStartPollingByNetworkClientId: jest
.fn()
.mockResolvedValue('pollingToken'),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ import AdvancedGasFeeDefaults from './advanced-gas-fee-defaults';
const TEXT_SELECTOR = 'Save these values as my default for the Goerli network.';

jest.mock('../../../../../store/actions', () => ({
addPollingTokenToAppState: jest.fn(),
removePollingTokenFromAppState: jest.fn(),
gasFeeStartPollingByNetworkClientId: jest
.fn()
.mockResolvedValue('pollingToken'),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ import { AdvancedGasFeePopoverContextProvider } from '../context';
import AdvancedGasFeeGasLimit from './advanced-gas-fee-gas-limit';

jest.mock('../../../../../store/actions', () => ({
addPollingTokenToAppState: jest.fn(),
removePollingTokenFromAppState: jest.fn(),
gasFeeStartPollingByNetworkClientId: jest
.fn()
.mockResolvedValue('pollingToken'),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ import BaseFeeInput from './base-fee-input';
const LOW_BASE_FEE = 0.000000001;

jest.mock('../../../../../../store/actions', () => ({
addPollingTokenToAppState: jest.fn(),
removePollingTokenFromAppState: jest.fn(),
gasFeeStartPollingByNetworkClientId: jest
.fn()
.mockResolvedValue('pollingToken'),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ import PriorityfeeInput from './priority-fee-input';
const LOW_PRIORITY_FEE = 0.000000001;

jest.mock('../../../../../../store/actions', () => ({
addPollingTokenToAppState: jest.fn(),
removePollingTokenFromAppState: jest.fn(),
gasFeeStartPollingByNetworkClientId: jest
.fn()
.mockResolvedValue('pollingToken'),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ import configureStore from '../../../../store/store';
import AdvancedGasFeePopover from './advanced-gas-fee-popover';

jest.mock('../../../../store/actions', () => ({
addPollingTokenToAppState: jest.fn(),
removePollingTokenFromAppState: jest.fn(),
gasFeeStartPollingByNetworkClientId: jest
.fn()
.mockResolvedValue('pollingToken'),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ import { GasFeeContextProvider } from '../../../../contexts/gasFee';
import ConfirmGasDisplay from './confirm-gas-display';

jest.mock('../../../../store/actions', () => ({
addPollingTokenToAppState: jest.fn(),
removePollingTokenFromAppState: jest.fn(),
gasFeeStartPollingByNetworkClientId: jest
.fn()
.mockResolvedValue('pollingToken'),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@ const props = {
};

jest.mock('../../../../store/actions', () => ({
removePollingTokenFromAppState: jest.fn(),
disconnectGasFeeEstimatePoller: jest.fn(),
getGasFeeEstimatesAndStartPolling: jest
.fn()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ import configureStore from '../../../../store/store';
import EditGasFeeButton from './edit-gas-fee-button';

jest.mock('../../../../store/actions', () => ({
addPollingTokenToAppState: jest.fn(),
removePollingTokenFromAppState: jest.fn(),
gasFeeStartPollingByNetworkClientId: jest
.fn()
.mockResolvedValue('pollingToken'),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ import mockState from '../../../../../test/data/mock-state.json';
import EditGasFeeIcon from './edit-gas-fee-icon';

jest.mock('../../../../store/actions', () => ({
addPollingTokenToAppState: jest.fn(),
removePollingTokenFromAppState: jest.fn(),
gasFeeStartPollingByNetworkClientId: jest
.fn()
.mockResolvedValue('pollingToken'),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ import {
import EditGasFeePopover from './edit-gas-fee-popover';

jest.mock('../../../../store/actions', () => ({
addPollingTokenToAppState: jest.fn(),
removePollingTokenFromAppState: jest.fn(),
gasFeeStartPollingByNetworkClientId: jest
.fn()
.mockResolvedValue('pollingToken'),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ import {
import EditGasItem from './edit-gas-item';

jest.mock('../../../../../store/actions', () => ({
addPollingTokenToAppState: jest.fn(),
removePollingTokenFromAppState: jest.fn(),
gasFeeStartPollingByNetworkClientId: jest
.fn()
.mockResolvedValue('pollingToken'),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ import { GasFeeContextProvider } from '../../../../../contexts/gasFee';
import EditGasToolTip from './edit-gas-tooltip';

jest.mock('../../../../../store/actions', () => ({
addPollingTokenToAppState: jest.fn(),
removePollingTokenFromAppState: jest.fn(),
gasFeeStartPollingByNetworkClientId: jest
.fn()
.mockResolvedValue('pollingToken'),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ import { renderWithProvider } from '../../../../../test/lib/render-helpers';
import FeeDetailsComponent from './fee-details-component';

jest.mock('../../../../store/actions', () => ({
addPollingTokenToAppState: jest.fn(),
removePollingTokenFromAppState: jest.fn(),
gasFeeStartPollingByNetworkClientId: jest
.fn()
.mockResolvedValue('pollingToken'),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ import configureStore from '../../../../store/store';
import GasDetailsItem from './gas-details-item';

jest.mock('../../../../store/actions', () => ({
addPollingTokenToAppState: jest.fn(),
removePollingTokenFromAppState: jest.fn(),
gasFeeStartPollingByNetworkClientId: jest
.fn()
.mockResolvedValue('pollingToken'),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ import configureStore from '../../../../store/store';
import TransactionDetail from './transaction-detail.component';

jest.mock('../../../../store/actions', () => ({
addPollingTokenToAppState: jest.fn(),
removePollingTokenFromAppState: jest.fn(),
gasFeeStartPollingByNetworkClientId: jest
.fn()
.mockResolvedValue('pollingToken'),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ import configureStore from '../../../store/store';
import ConfirmSendEther from './confirm-send-ether';

setBackgroundConnection({
addPollingTokenToAppState: jest.fn(),
removePollingTokenFromAppState: jest.fn(),
gasFeeStartPollingByNetworkClientId: jest
.fn()
.mockResolvedValue('pollingToken'),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ import ConfirmTransactionBase from './confirm-transaction-base.container';
const middleware = [thunk];

setBackgroundConnection({
addPollingTokenToAppState: jest.fn(),
removePollingTokenFromAppState: jest.fn(),
gasFeeStartPollingByNetworkClientId: jest
.fn()
.mockResolvedValue('pollingToken'),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ import ConfirmTransaction from './confirm-transaction.component';
const middleware = [thunk];

setBackgroundConnection({
addPollingTokenToAppState: jest.fn(),
removePollingTokenFromAppState: jest.fn(),
getGasFeeTimeEstimate: jest.fn(),
getGasFeeEstimatesAndStartPolling: jest.fn(),
promisifiedBackground: jest.fn(),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`SendContent Component SendHexDataRow should not render the SendHexDataRow if props.showHexData is false 1`] = `<div />`;

exports[`SendContent Component render should match snapshot 1`] = `
<div>
<div
Expand Down Expand Up @@ -287,3 +289,5 @@ exports[`SendContent Component render should match snapshot 1`] = `
</div>
</div>
`;

exports[`SendContent Component render should match snapshot 2`] = `<div />`;
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ import { useIsOriginalNativeTokenSymbol } from '../../../../hooks/useIsOriginalN
import SendContent from '.';

jest.mock('../../../../store/actions', () => ({
addPollingTokenToAppState: jest.fn(),
removePollingTokenFromAppState: jest.fn(),
gasFeeStartPollingByNetworkClientId: jest
.fn()
.mockResolvedValue('pollingToken'),
Expand Down
2 changes: 2 additions & 0 deletions ui/pages/routes/routes.component.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ jest.mock('webextension-polyfill', () => ({

jest.mock('../../store/actions', () => ({
getGasFeeTimeEstimate: jest.fn().mockImplementation(() => Promise.resolve()),
addPollingTokenToAppState: jest.fn(),
removePollingTokenFromAppState: jest.fn(),
gasFeeStartPollingByNetworkClientId: jest
.fn()
.mockResolvedValue('pollingToken'),
Expand Down
2 changes: 2 additions & 0 deletions ui/pages/swaps/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ setBackgroundConnection({
setSwapsLiveness: jest.fn(() => true),
setSwapsTokens: jest.fn(),
setSwapsTxGasPrice: jest.fn(),
addPollingTokenToAppState: jest.fn(),
removePollingTokenFromAppState: jest.fn(),
gasFeeStartPollingByNetworkClientId: jest
.fn()
.mockResolvedValue('pollingToken'),
Expand Down

0 comments on commit 988285f

Please sign in to comment.