Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
pedronfigueiredo committed Nov 29, 2024
1 parent 3bfb59b commit 363b9d8
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand All @@ -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';

Expand Down Expand Up @@ -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', () => {
Expand Down
6 changes: 3 additions & 3 deletions ui/pages/confirmations/hooks/syncConfirmPath.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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]);
};

Expand Down

0 comments on commit 363b9d8

Please sign in to comment.