diff --git a/src/components/new-safe/create/__tests__/useSyncSafeCreationStep.test.ts b/src/components/new-safe/create/__tests__/useSyncSafeCreationStep.test.ts index ba82ddc75a..64eea7d305 100644 --- a/src/components/new-safe/create/__tests__/useSyncSafeCreationStep.test.ts +++ b/src/components/new-safe/create/__tests__/useSyncSafeCreationStep.test.ts @@ -1,4 +1,3 @@ -import { type PendingSafeData } from '@/components/new-safe/create/types' import { renderHook } from '@/tests/test-utils' import useSyncSafeCreationStep from '@/components/new-safe/create/useSyncSafeCreationStep' import * as wallet from '@/hooks/wallets/useWallet' @@ -39,30 +38,22 @@ describe('useSyncSafeCreationStep', () => { expect(mockPushRoute).toHaveBeenCalledWith({ pathname: AppRoutes.welcome.index, query: undefined }) }) - it('should not go to the first step if no wallet is connected but there is a pending safe', async () => { - const mockPushRoute = jest.fn() - jest.spyOn(wallet, 'default').mockReturnValue(null) - jest.spyOn(usePendingSafe, 'usePendingSafe').mockReturnValue([{} as PendingSafeData, setPendingSafeSpy]) - jest.spyOn(useRouter, 'useRouter').mockReturnValue({ - push: mockPushRoute, - } as unknown as NextRouter) - const mockSetStep = jest.fn() - - renderHook(() => useSyncSafeCreationStep(mockSetStep)) - - expect(mockPushRoute).not.toHaveBeenCalled() - }) - it('should go to the fourth step if there is a pending safe', async () => { + const mockPushRoute = jest.fn() jest.spyOn(localStorage, 'default').mockReturnValue([{}, jest.fn()]) jest.spyOn(wallet, 'default').mockReturnValue({ address: '0x1' } as ConnectedWallet) jest.spyOn(usePendingSafe, 'usePendingSafe').mockReturnValue([mockPendingSafe, setPendingSafeSpy]) + jest.spyOn(useRouter, 'useRouter').mockReturnValue({ + push: mockPushRoute, + } as unknown as NextRouter) const mockSetStep = jest.fn() renderHook(() => useSyncSafeCreationStep(mockSetStep)) expect(mockSetStep).toHaveBeenCalledWith(3) + + expect(mockPushRoute).not.toHaveBeenCalled() }) it('should go to the second step if the wrong chain is connected', async () => { diff --git a/src/components/new-safe/create/useSyncSafeCreationStep.ts b/src/components/new-safe/create/useSyncSafeCreationStep.ts index aa4fc40594..90a32c0e7f 100644 --- a/src/components/new-safe/create/useSyncSafeCreationStep.ts +++ b/src/components/new-safe/create/useSyncSafeCreationStep.ts @@ -20,8 +20,8 @@ const useSyncSafeCreationStep = (setStep: StepRenderProps['setS return } - // Jump to the welcome page if there is no wallet and no pending Safe - if (!wallet && !pendingSafe) { + // Jump to the welcome page if there is no wallet + if (!wallet) { router.push({ pathname: AppRoutes.welcome.index, query: router.query }) }