diff --git a/ui/pages/confirmations/hooks/alerts/transactions/usePendingTransactionAlerts.test.ts b/ui/pages/confirmations/hooks/alerts/transactions/usePendingTransactionAlerts.test.ts index 5fa57cf695cc..66a4972abdff 100644 --- a/ui/pages/confirmations/hooks/alerts/transactions/usePendingTransactionAlerts.test.ts +++ b/ui/pages/confirmations/hooks/alerts/transactions/usePendingTransactionAlerts.test.ts @@ -5,6 +5,7 @@ import { TransactionType, } from '@metamask/transaction-controller'; import { useSelector } from 'react-redux'; +import { useParams } from 'react-router-dom'; import { genUnapprovedContractInteractionConfirmation } from '../../../../../../test/data/confirmations/contract-interaction'; import { getMockConfirmState } from '../../../../../../test/data/confirmations/helper'; import { renderHookWithConfirmContextProvider } from '../../../../../../test/lib/confirmations/render-helpers'; @@ -26,6 +27,11 @@ jest.mock('./PendingTransactionAlertMessage', () => ({ PendingTransactionAlertMessage: () => 'PendingTransactionAlertMessage', })); +jest.mock('react-router-dom', () => ({ + ...jest.requireActual('react-router-dom'), + useParams: jest.fn().mockReturnValue({ id: 'mock-transaction-id' }), +})); + const ACCOUNT_ADDRESS = '0x0dcd5d886577d5081b0c52e242ef29e70be3e7bc'; const TRANSACTION_ID_MOCK = '123-456'; @@ -80,6 +86,8 @@ describe('usePendingTransactionAlerts', () => { beforeEach(() => { jest.resetAllMocks(); + + (useParams as jest.Mock).mockReturnValue({ id: 'mock-transaction-id' }); }); it('returns no alerts if no confirmation', () => { diff --git a/ui/pages/confirmations/hooks/syncConfirmPath.ts b/ui/pages/confirmations/hooks/syncConfirmPath.ts index 30b00906b37d..ec6df090bba8 100644 --- a/ui/pages/confirmations/hooks/syncConfirmPath.ts +++ b/ui/pages/confirmations/hooks/syncConfirmPath.ts @@ -13,9 +13,9 @@ const syncConfirmPath = (currentConfirmation?: Confirmation) => { if (!currentConfirmation) { return; } - // if (!paramsTransactionId) { - // history.replace(`${CONFIRM_TRANSACTION_ROUTE}/${currentConfirmation.id}`); - // } + if (!paramsTransactionId) { + history.replace(`${CONFIRM_TRANSACTION_ROUTE}/${currentConfirmation.id}`); + } }, [currentConfirmation, paramsTransactionId]); };