1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-11-25 11:28:51 +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": "", "ipfsGateway": "",
"dismissSeedBackUpReminder": false, "dismissSeedBackUpReminder": false,
"usePhishDetect": true, "usePhishDetect": true,
"useMultiAccountBalanceChecker": false,
"participateInMetaMetrics": false, "participateInMetaMetrics": false,
"gasEstimateType": "fee-market", "gasEstimateType": "fee-market",
"showBetaHeader": false, "showBetaHeader": false,

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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