mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-02 06:07:06 +01:00
119219b5d2
* Add transaction activity log component * Remove duplicate tx activity log snapshot. * Convert Advanced Tab to tlr. * Lint fix * Convert Settings Tab test to tlr. * Convert Send Amount Row test to tlr. * Convert Send Row Error Message test to tlr. * Add Mock Send State json file. * Lint fix * Use proper testid for jazz icon for settings e2e * Update Send Amount Row snapshot
56 lines
1.5 KiB
JavaScript
56 lines
1.5 KiB
JavaScript
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();
|
|
});
|
|
});
|
|
});
|