Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions ui/pages/multi-srp/import-srp/import-srp.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -374,6 +374,7 @@ export const ImportSrp = () => {
flexDirection={FlexDirection.Row}
alignItems={AlignItems.center}
width={BlockSize.Full}
paddingRight={2}
>
<TextField
id={id}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@ import {
MOCK_ACCOUNT_EOA,
MOCK_ACCOUNT_SOLANA_MAINNET,
} from '../../../../test/data/mock-accounts';
import { ACCOUNT_DETAILS_QR_CODE_ROUTE } from '../../../helpers/constants/routes';
import {
ACCOUNT_DETAILS_QR_CODE_ROUTE,
DEFAULT_ROUTE,
} from '../../../helpers/constants/routes';
import { KeyringType } from '../../../../shared/constants/keyring';
import { BaseAccountDetails } from './base-account-details';

Expand All @@ -17,12 +20,10 @@ const mockStore = configureMockStore(middleware);

// Mock the useHistory hook
const mockPush = jest.fn();
const mockGoBack = jest.fn();
jest.mock('react-router-dom', () => ({
...jest.requireActual('react-router-dom'),
useHistory: () => ({
push: mockPush,
goBack: mockGoBack,
}),
}));

Expand Down Expand Up @@ -134,7 +135,6 @@ const createMockState = (
describe('BaseAccountDetails', () => {
beforeEach(() => {
mockPush.mockClear();
mockGoBack.mockClear();
});

describe('Component Rendering', () => {
Expand Down Expand Up @@ -216,7 +216,7 @@ describe('BaseAccountDetails', () => {
});

describe('Navigation', () => {
it('should go back when back button is clicked', () => {
it('should navigate to default route when back button is clicked', () => {
const state = createMockState(MOCK_ACCOUNT_EOA.address);
const store = mockStore(state);

Expand All @@ -233,7 +233,7 @@ describe('BaseAccountDetails', () => {
const backButton = screen.getByLabelText('Back');
fireEvent.click(backButton);

expect(mockGoBack).toHaveBeenCalledTimes(1);
expect(mockPush).toHaveBeenCalledWith(DEFAULT_ROUTE);
});

it('should navigate to QR code route when address row is clicked', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ export const BaseAccountDetails = ({

const handleNavigation = useCallback(() => {
dispatch(setAccountDetailsAddress(''));
history.goBack();
history.push(DEFAULT_ROUTE);
}, [history, dispatch]);

// we can never have a scenario where an account is not associated with a wallet.
Expand Down
Loading