diff --git a/ui/pages/confirmations/confirm/__snapshots__/confirm.test.tsx.snap b/ui/pages/confirmations/confirm/__snapshots__/confirm.test.tsx.snap index 64eed06931de..abc6eeb408ce 100644 --- a/ui/pages/confirmations/confirm/__snapshots__/confirm.test.tsx.snap +++ b/ui/pages/confirmations/confirm/__snapshots__/confirm.test.tsx.snap @@ -1669,7 +1669,7 @@ exports[`Confirm should match snapshot for signature - typed sign - permit 1`] =
- 3,000 + 30

diff --git a/ui/pages/confirmations/confirm/confirm.test.tsx b/ui/pages/confirmations/confirm/confirm.test.tsx index e91ff2777792..008c6dd5204f 100644 --- a/ui/pages/confirmations/confirm/confirm.test.tsx +++ b/ui/pages/confirmations/confirm/confirm.test.tsx @@ -2,6 +2,7 @@ import React from 'react'; import configureMockStore from 'redux-mock-store'; import thunk from 'redux-thunk'; +import { act } from '@testing-library/react'; import { unapprovedPersonalSignMsg } from '../../../../test/data/confirmations/personal_sign'; import { orderSignatureMsg, @@ -10,6 +11,7 @@ import { } from '../../../../test/data/confirmations/typed_sign'; import mockState from '../../../../test/data/mock-state.json'; import { renderWithProvider } from '../../../../test/lib/render-helpers'; +import * as actions from '../../../store/actions'; import Confirm from './confirm'; @@ -23,13 +25,17 @@ jest.mock('react-router-dom', () => ({ const middleware = [thunk]; describe('Confirm', () => { + afterEach(() => { + jest.resetAllMocks(); + }); + it('should render', () => { const mockStore = configureMockStore(middleware)(mockState); const { container } = renderWithProvider(, mockStore); expect(container).toBeDefined(); }); - it('should match snapshot for signature - typed sign - permit', () => { + it('should match snapshot for signature - typed sign - permit', async () => { const mockStateTypedSign = { ...mockState, metamask: { @@ -37,8 +43,23 @@ describe('Confirm', () => { }, confirm: { currentConfirmation: permitSignatureMsg }, }; + + jest.spyOn(actions, 'getTokenStandardAndDetails').mockResolvedValue({ + decimals: '2', + standard: 'erc20', + }); + const mockStore = configureMockStore(middleware)(mockStateTypedSign); - const { container } = renderWithProvider(, mockStore); + let container; + + await act(async () => { + const { container: renderContainer } = renderWithProvider( + , + mockStore, + ); + container = renderContainer; + }); + expect(container).toMatchSnapshot(); }); @@ -55,7 +76,7 @@ describe('Confirm', () => { expect(container).toMatchSnapshot(); }); - it('should match snapshot signature - typed sign - order', () => { + it('should match snapshot signature - typed sign - order', async () => { const mockStateTypedSign = { ...mockState, metamask: { @@ -63,8 +84,23 @@ describe('Confirm', () => { }, confirm: { currentConfirmation: orderSignatureMsg }, }; + + jest.spyOn(actions, 'getTokenStandardAndDetails').mockResolvedValue({ + decimals: '2', + standard: 'erc20', + }); + const mockStore = configureMockStore(middleware)(mockStateTypedSign); - const { container } = renderWithProvider(, mockStore); + let container; + + await act(async () => { + const { container: renderContainer } = renderWithProvider( + , + mockStore, + ); + container = renderContainer; + }); + expect(container).toMatchSnapshot(); });