1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-11-22 01:47:00 +01:00

fix: fix non-critical warning in tests (#17567)

This commit is contained in:
Danica Shen 2023-02-02 20:37:53 +00:00 committed by GitHub
parent 794f3039f1
commit f3c00c65d0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 28 additions and 7 deletions

View File

@ -25,6 +25,7 @@
"ipfsGateway": "",
"dismissSeedBackUpReminder": false,
"usePhishDetect": true,
"useMultiAccountBalanceChecker": false,
"participateInMetaMetrics": false,
"gasEstimateType": "fee-market",
"showBetaHeader": false,

View File

@ -38,6 +38,10 @@ const render = () => {
},
allAreSelected: () => true,
nativeCurrency: 'USD',
selectNewAccountViaModal: jest.fn(),
deselectAll: jest.fn(),
selectAll: jest.fn(),
handleAccountClick: jest.fn(),
};
return renderWithProvider(<AccountList {...args} />, store);
};

View File

@ -130,13 +130,13 @@ export default function Notifications() {
}
NotificationItem.propTypes = {
notification: {
notification: PropTypes.exact({
id: PropTypes.string.isRequired,
message: PropTypes.string.isRequired,
origin: PropTypes.string.isRequired,
createdDate: PropTypes.number.isRequired,
readDate: PropTypes.number.isRequired,
},
readDate: PropTypes.number,
}),
snaps: PropTypes.array.isRequired,
onItemClick: PropTypes.func.isRequired,
};

View File

@ -42,6 +42,8 @@ describe('Onboarding Flow', () => {
},
};
process.env.METAMASK_BUILD_TYPE = 'main';
const store = configureMockStore()(mockState);
it('should route to the default route when completedOnboarding and seedPhraseBackedUp is true', () => {

View File

@ -108,7 +108,7 @@ RecoveryPhraseChips.propTypes = {
phraseRevealed: PropTypes.bool,
confirmPhase: PropTypes.bool,
setInputValue: PropTypes.func,
inputValue: PropTypes.string,
inputValue: PropTypes.object,
indicesToCheck: PropTypes.array,
hiddenPhrase: PropTypes.bool,
};

View File

@ -29,6 +29,7 @@ jest.mock('../../../store/actions.js', () => ({
describe('SendFooter Component', () => {
const props = {
disabled: false,
history: {
push: jest.fn(),
},
@ -119,10 +120,15 @@ describe('SendFooter Component', () => {
describe('Component Update', () => {
it('should match snapshot when component updated with errors', () => {
const { container, rerender } = renderWithProvider(
<SendFooter.WrappedComponent />,
<SendFooter.WrappedComponent
disabled={false}
mostRecentOverviewPage="text"
/>,
);
const sendErrorProps = {
disabled: false,
mostRecentOverviewPage: 'text',
sendErrors: {
gasFee: 'gas fee error',
amount: 'amount error',

View File

@ -39,6 +39,8 @@ setBackgroundConnection({
});
describe('AwaitingSwap', () => {
process.env.METAMASK_BUILD_TYPE = 'main';
it('renders the component with initial props', () => {
const store = configureMockStore()(createSwapsMockStore());
const { getByText, getByTestId } = renderWithProvider(

View File

@ -40,13 +40,15 @@ jest.mock('../../../ducks/swaps/swaps', () => {
});
describe('CreateNewSwap', () => {
const props = createProps({ sensitiveTrackingProperties: {} });
beforeEach(() => {
jest.clearAllMocks();
});
it('renders the component with initial props', () => {
const store = configureMockStore()(createSwapsMockStore());
const props = createProps();
const { getByText } = renderWithProvider(
<CreateNewSwap {...props} />,
store,
@ -68,7 +70,7 @@ describe('CreateNewSwap', () => {
});
navigateBackToBuildQuote.mockImplementation(navigateBackToBuildQuoteMock);
const store = configureMockStore(middleware)(createSwapsMockStore());
const props = createProps();
const { getByText } = renderWithProvider(
<CreateNewSwap {...props} />,
store,

View File

@ -28,6 +28,7 @@ const createProps = (customProps = {}) => {
};
describe('LoadingSwapsQuotes', () => {
process.env.METAMASK_BUILD_TYPE = 'main';
it('renders the component with initial props', () => {
const store = configureMockStore()(createSwapsMockStore());
const { getByText } = renderWithProvider(

View File

@ -5,6 +5,7 @@ import ViewOnBlockExplorer from '.';
const createProps = (customProps = {}) => {
return {
sensitiveTrackingProperties: {},
txHash:
'0x58e5a0fc7fbc849eddc100d44e86276168a8c7baaa5604e44ba6f5eb8ba1b7eb',
blockExplorerUrl: 'https://etherscan.io',

View File

@ -24,6 +24,8 @@ jest.mock('@metamask/logo', () => () => {
});
describe('Unlock Page', () => {
process.env.METAMASK_BUILD_TYPE = 'main';
const mockState = {
metamask: {},
};