diff --git a/ui/components/app/transaction-breakdown/transaction-breakdown-row/__snapshots__/transaction-breakdown-row.component.test.js.snap b/ui/components/app/transaction-breakdown/transaction-breakdown-row/__snapshots__/transaction-breakdown-row.component.test.js.snap
new file mode 100644
index 000000000000..3796099b9be0
--- /dev/null
+++ b/ui/components/app/transaction-breakdown/transaction-breakdown-row/__snapshots__/transaction-breakdown-row.component.test.js.snap
@@ -0,0 +1,29 @@
+// Jest Snapshot v1, https://goo.gl/fbAQLP
+
+exports[`TransactionBreakdownRow Component should match snapshot 1`] = `
+
+
+
+ test
+
+
+
+
+
+
+`;
diff --git a/ui/components/app/transaction-breakdown/transaction-breakdown-row/transaction-breakdown-row.component.test.js b/ui/components/app/transaction-breakdown/transaction-breakdown-row/transaction-breakdown-row.component.test.js
index 45117b571483..0d0a8f3fc9b0 100644
--- a/ui/components/app/transaction-breakdown/transaction-breakdown-row/transaction-breakdown-row.component.test.js
+++ b/ui/components/app/transaction-breakdown/transaction-breakdown-row/transaction-breakdown-row.component.test.js
@@ -1,40 +1,21 @@
import React from 'react';
-import { shallow } from 'enzyme';
+import { renderWithProvider } from '../../../../../test/lib/render-helpers';
import Button from '../../../ui/button';
-import TransactionBreakdownRow from './transaction-breakdown-row.component';
+import TransactionBreakdownRow from '.';
describe('TransactionBreakdownRow Component', () => {
- it('should render text properly', () => {
- const wrapper = shallow(
-
- Test
- ,
- { context: { t: (str1, str2) => (str2 ? str1 + str2 : str1) } },
- );
-
- expect(wrapper.hasClass('transaction-breakdown-row')).toStrictEqual(true);
- expect(
- wrapper.find('.transaction-breakdown-row__title').text(),
- ).toStrictEqual('test');
- expect(
- wrapper.find('.transaction-breakdown-row__value').text(),
- ).toStrictEqual('Test');
- });
+ it('should match snapshot', () => {
+ const props = {
+ title: 'test',
+ className: 'test-class',
+ };
- it('should render components properly', () => {
- const wrapper = shallow(
-
+ const { container } = renderWithProvider(
+
,
- { context: { t: (str1, str2) => (str2 ? str1 + str2 : str1) } },
);
- expect(wrapper.hasClass('transaction-breakdown-row')).toStrictEqual(true);
- expect(
- wrapper.find('.transaction-breakdown-row__title').text(),
- ).toStrictEqual('test');
- expect(
- wrapper.find('.transaction-breakdown-row__value').find(Button),
- ).toHaveLength(1);
+ expect(container).toMatchSnapshot();
});
});
diff --git a/ui/components/app/transaction-status/__snapshots__/transaction-status.component.test.js.snap b/ui/components/app/transaction-status/__snapshots__/transaction-status.component.test.js.snap
new file mode 100644
index 000000000000..14e5eefaafaa
--- /dev/null
+++ b/ui/components/app/transaction-status/__snapshots__/transaction-status.component.test.js.snap
@@ -0,0 +1,60 @@
+// Jest Snapshot v1, https://goo.gl/fbAQLP
+
+exports[`TransactionStatus Component should render CONFIRMED properly 1`] = `
+
+`;
+
+exports[`TransactionStatus Component should render PENDING properly 1`] = `
+
+`;
+
+exports[`TransactionStatus Component should render PENDING properly when status is APPROVED 1`] = `
+
+`;
+
+exports[`TransactionStatus Component should render QUEUED properly 1`] = `
+
+`;
+
+exports[`TransactionStatus Component should render UNAPPROVED properly 1`] = `
+
+`;
diff --git a/ui/components/app/transaction-status/transaction-status.component.test.js b/ui/components/app/transaction-status/transaction-status.component.test.js
index 220d898ff209..068b47e25ce9 100644
--- a/ui/components/app/transaction-status/transaction-status.component.test.js
+++ b/ui/components/app/transaction-status/transaction-status.component.test.js
@@ -1,63 +1,62 @@
import React from 'react';
-import { mount } from 'enzyme';
-import sinon from 'sinon';
-import * as i18nHook from '../../../hooks/useI18nContext';
-import Tooltip from '../../ui/tooltip';
-import TransactionStatus from './transaction-status.component';
+import { renderWithProvider } from '../../../../test/lib/render-helpers';
+import TransactionStatus from '.';
describe('TransactionStatus Component', () => {
- beforeAll(() => {
- sinon.stub(i18nHook, 'useI18nContext').returns((str) => str.toUpperCase());
- });
-
- afterAll(() => {
- sinon.restore();
- });
-
it('should render CONFIRMED properly', () => {
- const wrapper = mount(
- ,
+ const confirmedProps = {
+ status: 'confirmed',
+ date: 'June 1',
+ };
+
+ const { container } = renderWithProvider(
+ ,
);
- expect(wrapper.find(TransactionStatus)).toHaveLength(1);
- expect(wrapper.text()).toStrictEqual('June 1');
+ expect(container).toMatchSnapshot();
});
it('should render PENDING properly when status is APPROVED', () => {
- const wrapper = mount(
- ,
- );
+ const props = {
+ status: 'approved',
+ isEarliestNonce: true,
+ error: { message: 'test-title' },
+ };
- expect(wrapper.text()).toStrictEqual('PENDING');
- expect(wrapper.find(Tooltip).props().title).toStrictEqual('test-title');
+ const { container } = renderWithProvider();
+
+ expect(container).toMatchSnapshot();
});
it('should render PENDING properly', () => {
- const wrapper = mount(
- ,
- );
+ const props = {
+ date: 'June 1',
+ status: 'submitted',
+ isEarliestNonce: true,
+ };
+
+ const { container } = renderWithProvider();
- expect(wrapper.find(TransactionStatus)).toHaveLength(1);
- expect(wrapper.text()).toStrictEqual('PENDING');
+ expect(container).toMatchSnapshot();
});
it('should render QUEUED properly', () => {
- const wrapper = mount();
+ const props = {
+ status: 'queued',
+ };
- expect(wrapper.find(TransactionStatus)).toHaveLength(1);
- expect(wrapper.find('.transaction-status--queued')).toHaveLength(1);
- expect(wrapper.text()).toStrictEqual('QUEUED');
+ const { container } = renderWithProvider();
+
+ expect(container).toMatchSnapshot();
});
it('should render UNAPPROVED properly', () => {
- const wrapper = mount();
+ const props = {
+ status: 'unapproved',
+ };
+
+ const { container } = renderWithProvider();
- expect(wrapper.find(TransactionStatus)).toHaveLength(1);
- expect(wrapper.find('.transaction-status--unapproved')).toHaveLength(1);
- expect(wrapper.text()).toStrictEqual('UNAPPROVED');
+ expect(container).toMatchSnapshot();
});
});
diff --git a/ui/components/app/user-preferenced-currency-display/__snapshots__/user-preferenced-currency-display.test.js.snap b/ui/components/app/user-preferenced-currency-display/__snapshots__/user-preferenced-currency-display.test.js.snap
new file mode 100644
index 000000000000..61224fdb0f06
--- /dev/null
+++ b/ui/components/app/user-preferenced-currency-display/__snapshots__/user-preferenced-currency-display.test.js.snap
@@ -0,0 +1,24 @@
+// Jest Snapshot v1, https://goo.gl/fbAQLP
+
+exports[`UserPreferencedCurrencyDisplay Component rendering should match snapshot 1`] = `
+
+
+
+
+ 0
+
+
+ ETH
+
+
+
+`;
diff --git a/ui/components/app/user-preferenced-currency-display/user-preferenced-currency-display.component.test.js b/ui/components/app/user-preferenced-currency-display/user-preferenced-currency-display.component.test.js
deleted file mode 100644
index 6c73d75768c6..000000000000
--- a/ui/components/app/user-preferenced-currency-display/user-preferenced-currency-display.component.test.js
+++ /dev/null
@@ -1,41 +0,0 @@
-import React from 'react';
-import { shallow } from 'enzyme';
-import sinon from 'sinon';
-import CurrencyDisplay from '../../ui/currency-display';
-import * as currencyHook from '../../../hooks/useCurrencyDisplay';
-import * as currencyPrefHook from '../../../hooks/useUserPreferencedCurrency';
-import UserPreferencedCurrencyDisplay from '.';
-
-describe('UserPreferencedCurrencyDisplay Component', () => {
- describe('rendering', () => {
- beforeEach(() => {
- sinon.stub(currencyHook, 'useCurrencyDisplay').returns(['1', {}]);
- sinon
- .stub(currencyPrefHook, 'useUserPreferencedCurrency')
- .returns({ currency: 'ETH', decimals: 6 });
- });
-
- afterEach(() => {
- sinon.restore();
- });
-
- it('should render properly', () => {
- const wrapper = shallow();
-
- expect(wrapper).toHaveLength(1);
- expect(wrapper.find(CurrencyDisplay)).toHaveLength(1);
- });
-
- it('should pass all props to the CurrencyDisplay child component', () => {
- const wrapper = shallow(
- ,
- );
-
- expect(wrapper).toHaveLength(1);
- expect(wrapper.find(CurrencyDisplay)).toHaveLength(1);
- expect(wrapper.find(CurrencyDisplay).props().prop1).toStrictEqual(true);
- expect(wrapper.find(CurrencyDisplay).props().prop2).toStrictEqual('test');
- expect(wrapper.find(CurrencyDisplay).props().prop3).toStrictEqual(1);
- });
- });
-});
diff --git a/ui/components/app/user-preferenced-currency-display/user-preferenced-currency-display.test.js b/ui/components/app/user-preferenced-currency-display/user-preferenced-currency-display.test.js
new file mode 100644
index 000000000000..046964bb3df6
--- /dev/null
+++ b/ui/components/app/user-preferenced-currency-display/user-preferenced-currency-display.test.js
@@ -0,0 +1,29 @@
+import React from 'react';
+import configureMockStore from 'redux-mock-store';
+import { renderWithProvider } from '../../../../test/lib/render-helpers';
+import UserPreferencedCurrencyDisplay from '.';
+
+describe('UserPreferencedCurrencyDisplay Component', () => {
+ describe('rendering', () => {
+ const mockState = {
+ metamask: {
+ provider: {
+ chainId: '0x99',
+ },
+ preferences: {
+ useNativeCurrencyAsPrimaryCurrency: true,
+ },
+ },
+ };
+ const mockStore = configureMockStore()(mockState);
+
+ it('should match snapshot', () => {
+ const { container } = renderWithProvider(
+ ,
+ mockStore,
+ );
+
+ expect(container).toMatchSnapshot();
+ });
+ });
+});
diff --git a/ui/components/app/user-preferenced-currency-input/__snapshots__/user-preferenced-currency-input.test.js.snap b/ui/components/app/user-preferenced-currency-input/__snapshots__/user-preferenced-currency-input.test.js.snap
new file mode 100644
index 000000000000..a2423f00b187
--- /dev/null
+++ b/ui/components/app/user-preferenced-currency-input/__snapshots__/user-preferenced-currency-input.test.js.snap
@@ -0,0 +1,45 @@
+// Jest Snapshot v1, https://goo.gl/fbAQLP
+
+exports[`UserPreferencedCurrencyInput Component rendering should match snapshot 1`] = `
+
+`;
diff --git a/ui/components/app/user-preferenced-currency-input/user-preferenced-currency-input.component.test.js b/ui/components/app/user-preferenced-currency-input/user-preferenced-currency-input.component.test.js
deleted file mode 100644
index 39c3bb736599..000000000000
--- a/ui/components/app/user-preferenced-currency-input/user-preferenced-currency-input.component.test.js
+++ /dev/null
@@ -1,31 +0,0 @@
-import React from 'react';
-import { shallow } from 'enzyme';
-import CurrencyInput from '../currency-input';
-import UserPreferencedCurrencyInput from './user-preferenced-currency-input.component';
-
-describe('UserPreferencedCurrencyInput Component', () => {
- describe('rendering', () => {
- it('should render properly', () => {
- const wrapper = shallow();
-
- expect(wrapper).toHaveLength(1);
- expect(wrapper.find(CurrencyInput)).toHaveLength(1);
- });
-
- it('should render featureSecondary for CurrencyInput based on preferences.useNativeCurrencyAsPrimaryCurrency', () => {
- const wrapper = shallow(
- ,
- );
-
- expect(wrapper).toHaveLength(1);
- expect(wrapper.find(CurrencyInput)).toHaveLength(1);
- expect(
- wrapper.find(CurrencyInput).props().featureSecondary,
- ).toStrictEqual(false);
- wrapper.setProps({ useNativeCurrencyAsPrimaryCurrency: false });
- expect(
- wrapper.find(CurrencyInput).props().featureSecondary,
- ).toStrictEqual(true);
- });
- });
-});
diff --git a/ui/components/app/user-preferenced-currency-input/user-preferenced-currency-input.container.test.js b/ui/components/app/user-preferenced-currency-input/user-preferenced-currency-input.container.test.js
deleted file mode 100644
index 93e3cb81b16c..000000000000
--- a/ui/components/app/user-preferenced-currency-input/user-preferenced-currency-input.container.test.js
+++ /dev/null
@@ -1,32 +0,0 @@
-/* eslint-disable import/unambiguous */
-let mapStateToProps;
-
-jest.mock('react-redux', () => ({
- connect: (ms) => {
- mapStateToProps = ms;
- return () => ({});
- },
-}));
-
-require('./user-preferenced-currency-input.container');
-
-describe('UserPreferencedCurrencyInput container', () => {
- describe('mapStateToProps()', () => {
- it('should return the correct props', () => {
- const mockState = {
- metamask: {
- preferences: {
- useNativeCurrencyAsPrimaryCurrency: true,
- },
- },
- appState: {
- sendInputCurrencySwitched: false,
- },
- };
- expect(mapStateToProps(mockState)).toStrictEqual({
- useNativeCurrencyAsPrimaryCurrency: true,
- sendInputCurrencySwitched: false,
- });
- });
- });
-});
diff --git a/ui/components/app/user-preferenced-currency-input/user-preferenced-currency-input.test.js b/ui/components/app/user-preferenced-currency-input/user-preferenced-currency-input.test.js
new file mode 100644
index 000000000000..fcf74fb529cd
--- /dev/null
+++ b/ui/components/app/user-preferenced-currency-input/user-preferenced-currency-input.test.js
@@ -0,0 +1,20 @@
+import React from 'react';
+import configureMockStore from 'redux-mock-store';
+import { renderWithProvider } from '../../../../test/lib/render-helpers';
+import mockState from '../../../../test/data/mock-state.json';
+import UserPreferencedCurrencyInput from '.';
+
+describe('UserPreferencedCurrencyInput Component', () => {
+ describe('rendering', () => {
+ it('should match snapshot', () => {
+ const mockStore = configureMockStore()(mockState);
+
+ const { container } = renderWithProvider(
+ ,
+ mockStore,
+ );
+
+ expect(container).toMatchSnapshot();
+ });
+ });
+});
diff --git a/ui/components/app/user-preferenced-token-input/__snapshots__/user-preferenced-token-input.test.js.snap b/ui/components/app/user-preferenced-token-input/__snapshots__/user-preferenced-token-input.test.js.snap
new file mode 100644
index 000000000000..ac57f21acd02
--- /dev/null
+++ b/ui/components/app/user-preferenced-token-input/__snapshots__/user-preferenced-token-input.test.js.snap
@@ -0,0 +1,31 @@
+// Jest Snapshot v1, https://goo.gl/fbAQLP
+
+exports[`UserPreferencedCurrencyInput Component rendering should match snapshot 1`] = `
+
+`;
diff --git a/ui/components/app/user-preferenced-token-input/user-preferenced-token-input.component.test.js b/ui/components/app/user-preferenced-token-input/user-preferenced-token-input.component.test.js
deleted file mode 100644
index 70e4ca0ebc14..000000000000
--- a/ui/components/app/user-preferenced-token-input/user-preferenced-token-input.component.test.js
+++ /dev/null
@@ -1,32 +0,0 @@
-import React from 'react';
-import { shallow } from 'enzyme';
-import TokenInput from '../../ui/token-input';
-import UserPreferencedTokenInput from './user-preferenced-token-input.component';
-
-describe('UserPreferencedCurrencyInput Component', () => {
- describe('rendering', () => {
- it('should render properly', () => {
- const wrapper = shallow(
- ,
- );
-
- expect(wrapper).toHaveLength(1);
- expect(wrapper.find(TokenInput)).toHaveLength(1);
- });
-
- it('should render showFiat for TokenInput based on preferences.useNativeCurrencyAsPrimaryCurrency', () => {
- const wrapper = shallow(
- ,
- );
-
- expect(wrapper).toHaveLength(1);
- expect(wrapper.find(TokenInput)).toHaveLength(1);
- expect(wrapper.find(TokenInput).props().showFiat).toStrictEqual(false);
- wrapper.setProps({ useNativeCurrencyAsPrimaryCurrency: false });
- expect(wrapper.find(TokenInput).props().showFiat).toStrictEqual(true);
- });
- });
-});
diff --git a/ui/components/app/user-preferenced-token-input/user-preferenced-token-input.container.test.js b/ui/components/app/user-preferenced-token-input/user-preferenced-token-input.container.test.js
deleted file mode 100644
index 8c94ffa446b4..000000000000
--- a/ui/components/app/user-preferenced-token-input/user-preferenced-token-input.container.test.js
+++ /dev/null
@@ -1,29 +0,0 @@
-// eslint-disable-next-line import/unambiguous
-let mapStateToProps;
-
-jest.mock('react-redux', () => ({
- connect: (ms) => {
- mapStateToProps = ms;
- return () => ({});
- },
-}));
-
-require('./user-preferenced-token-input.container');
-
-describe('UserPreferencedTokenInput container', () => {
- describe('mapStateToProps()', () => {
- it('should return the correct props', () => {
- const mockState = {
- metamask: {
- preferences: {
- useNativeCurrencyAsPrimaryCurrency: true,
- },
- },
- };
-
- expect(mapStateToProps(mockState)).toStrictEqual({
- useNativeCurrencyAsPrimaryCurrency: true,
- });
- });
- });
-});
diff --git a/ui/components/app/user-preferenced-token-input/user-preferenced-token-input.test.js b/ui/components/app/user-preferenced-token-input/user-preferenced-token-input.test.js
new file mode 100644
index 000000000000..b4c6387ffaef
--- /dev/null
+++ b/ui/components/app/user-preferenced-token-input/user-preferenced-token-input.test.js
@@ -0,0 +1,26 @@
+import React from 'react';
+import configureMockStore from 'redux-mock-store';
+import mockState from '../../../../test/data/mock-state.json';
+import { renderWithProvider } from '../../../../test/lib/render-helpers';
+import UserPreferencedTokenInput from '.';
+
+describe('UserPreferencedCurrencyInput Component', () => {
+ describe('rendering', () => {
+ const mockStore = configureMockStore()(mockState);
+
+ const props = {
+ token: {
+ address: '0xd8f6a2ffb0fc5952d16c9768b71cfd35b6399aa5',
+ },
+ };
+
+ it('should match snapshot', () => {
+ const { container } = renderWithProvider(
+ ,
+ mockStore,
+ );
+
+ expect(container).toMatchSnapshot();
+ });
+ });
+});