1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-12-01 21:57:06 +01:00
metamask-extension/ui/pages/send/send-content/send-row-wrapper/send-row-error-message/send-row-error-message.test.js
Thomas Huang 119219b5d2
Continue converting tests from enzyme to @testing-library/react (#16458)
* 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
2022-11-29 07:42:59 -08:00

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();
});
});
});