1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-12-12 12:47:14 +01:00
metamask-extension/ui/pages/send/send-content/send-row-wrapper/send-row-error-message/send-row-error-message.test.js

56 lines
1.5 KiB
JavaScript
Raw Normal View History

import React from 'react';
import configureMockStore from 'redux-mock-store';
import { INSUFFICIENT_FUNDS_ERROR_KEY } from '../../../../../helpers/constants/error-keys';
import { renderWithProvider } from '../../../../../../test/lib/render-helpers';
import SendRowErrorMessage from '.';
describe('SendRowErrorMessage Component', () => {
describe('render', () => {
it('should match snapshot with no error', () => {
const mockState = {
send: {
draftTransactions: {},
},
};
const mockStore = configureMockStore()(mockState);
const { container } = renderWithProvider(
<SendRowErrorMessage />,
mockStore,
);
expect(container).toMatchSnapshot();
});
it('should render an error message if the passed errors contain an error of errorType', () => {
const props = {
errorType: 'amount',
};
const sendErrorState = {
send: {
currentTransactionUUID: '1-tx',
draftTransactions: {
'1-tx': {
gas: {
error: INSUFFICIENT_FUNDS_ERROR_KEY,
},
amount: {
error: INSUFFICIENT_FUNDS_ERROR_KEY,
},
},
},
},
};
const mockStore = configureMockStore()(sendErrorState);
const { container } = renderWithProvider(
<SendRowErrorMessage {...props} />,
mockStore,
);
expect(container).toMatchSnapshot();
});
});
});