@@ -4,12 +4,6 @@ import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
44
55import { useInternalNavFun } from '../useInternalNavFun' ;
66
7- let mockedPathname = '/' ;
8-
9- vi . mock ( 'next/navigation' , ( ) => ( {
10- usePathname : ( ) => mockedPathname ,
11- } ) ) ;
12-
137let currentNavigate : NavigationFunction | undefined ;
148
159const windowNav = window . history . pushState . bind ( window . history ) ;
@@ -34,7 +28,6 @@ const navigate = (to: string) => {
3428
3529describe ( 'useInternalNavFun' , ( ) => {
3630 beforeEach ( ( ) => {
37- mockedPathname = '/protected' ;
3831 currentNavigate = undefined ;
3932 window . __clerk_internal_navigations = { } ;
4033 vi . clearAllMocks ( ) ;
@@ -46,7 +39,7 @@ describe('useInternalNavFun', () => {
4639
4740 it ( 'dedupes duplicate in-flight pushes to the same destination' , async ( ) => {
4841 const routerNav = vi . fn ( ) ;
49- const view = render ( < Harness routerNav = { routerNav } /> ) ;
42+ render ( < Harness routerNav = { routerNav } /> ) ;
5043
5144 let firstPromise ! : Promise < void > ;
5245 let secondPromise ! : Promise < void > ;
@@ -60,10 +53,6 @@ describe('useInternalNavFun', () => {
6053 expect ( routerNav ) . toHaveBeenCalledTimes ( 1 ) ;
6154 } ) ;
6255
63- // Simulate route change completion so buffered resolvers flush.
64- mockedPathname = '/sign-in' ;
65- view . rerender ( < Harness routerNav = { routerNav } /> ) ;
66-
6756 await expect ( Promise . all ( [ firstPromise , secondPromise ] ) ) . resolves . toEqual ( [ undefined , undefined ] ) ;
6857 } ) ;
6958
@@ -86,7 +75,7 @@ describe('useInternalNavFun', () => {
8675
8776 it ( 'allows a fresh same-destination push after flush' , async ( ) => {
8877 const routerNav = vi . fn ( ) ;
89- const view = render ( < Harness routerNav = { routerNav } /> ) ;
78+ render ( < Harness routerNav = { routerNav } /> ) ;
9079
9180 let firstPromise ! : Promise < void > ;
9281 let secondPromise ! : Promise < void > ;
@@ -100,9 +89,6 @@ describe('useInternalNavFun', () => {
10089 expect ( routerNav ) . toHaveBeenCalledTimes ( 1 ) ;
10190 } ) ;
10291
103- mockedPathname = '/sign-in' ;
104- view . rerender ( < Harness routerNav = { routerNav } /> ) ;
105-
10692 await expect ( Promise . all ( [ firstPromise , secondPromise ] ) ) . resolves . toEqual ( [ undefined , undefined ] ) ;
10793
10894 act ( ( ) => {
0 commit comments