diff --git a/ui/components/ui/account-mismatch-warning/__snapshots__/acccount-mismatch-warning.component.test.js.snap b/ui/components/ui/account-mismatch-warning/__snapshots__/acccount-mismatch-warning.component.test.js.snap new file mode 100644 index 000000000..6225239f6 --- /dev/null +++ b/ui/components/ui/account-mismatch-warning/__snapshots__/acccount-mismatch-warning.component.test.js.snap @@ -0,0 +1,36 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AccountMismatchWarning should match snapshot of mismatch address warning 1`] = ` +
+
+ +
+
+`; + +exports[`AccountMismatchWarning should match snapshot of no warning with same address and selected address 1`] = `
`; diff --git a/ui/components/ui/account-mismatch-warning/acccount-mismatch-warning.component.test.js b/ui/components/ui/account-mismatch-warning/acccount-mismatch-warning.component.test.js index e06f8f875..d04cb9179 100644 --- a/ui/components/ui/account-mismatch-warning/acccount-mismatch-warning.component.test.js +++ b/ui/components/ui/account-mismatch-warning/acccount-mismatch-warning.component.test.js @@ -1,35 +1,35 @@ import React from 'react'; -import * as reactRedux from 'react-redux'; -import sinon from 'sinon'; -import { shallow } from 'enzyme'; -import InfoIcon from '../icon/info-icon.component'; -import { getSelectedAccount } from '../../../selectors'; +import configureMockStore from 'redux-mock-store'; +import { renderWithProvider } from '../../../../test/lib/render-helpers'; +import mockState from '../../../../test/data/mock-state.json'; import AccountMismatchWarning from './account-mismatch-warning.component'; describe('AccountMismatchWarning', () => { - beforeAll(() => { - sinon.stub(reactRedux, 'useSelector').callsFake((selector) => { - if (selector === getSelectedAccount) { - return { address: 'mockedAddress' }; - } - throw new Error( - `${selector.name} is not cared for in the AccountMismatchWarning test useSelector stub`, - ); - }); - }); + const mockStore = configureMockStore()(mockState); - afterAll(() => { - sinon.restore(); - }); + it('should match snapshot of no warning with same address and selected address', () => { + const props = { + address: '0x0dcd5d886577d5081b0c52e242ef29e70be3e7bc', + }; - it('renders nothing when the addresses match', () => { - const wrapper = shallow(); - expect(wrapper.find(InfoIcon)).toHaveLength(0); - }); - it('renders a warning info icon when addresses do not match', () => { - const wrapper = shallow( - , + const { container } = renderWithProvider( + , + mockStore, ); - expect(wrapper.find(InfoIcon)).toHaveLength(1); + + expect(container).toMatchSnapshot(); + }); + + it('should match snapshot of mismatch address warning', () => { + const props = { + address: '0xNotSelectedAddress', + }; + + const { container } = renderWithProvider( + , + mockStore, + ); + + expect(container).toMatchSnapshot(); }); }); diff --git a/ui/components/ui/breadcrumbs/__snapshots__/breadcrumbs.component.test.js.snap b/ui/components/ui/breadcrumbs/__snapshots__/breadcrumbs.component.test.js.snap new file mode 100644 index 000000000..ea31c0c26 --- /dev/null +++ b/ui/components/ui/breadcrumbs/__snapshots__/breadcrumbs.component.test.js.snap @@ -0,0 +1,19 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Breadcrumbs Component should match snapshot with multiple breakcumbs 1`] = ` +
+