@@ -7,7 +7,7 @@ import { TestRunAgainButton } from "../[clientId]/test/test-run-again-button";
77
88const mockPrepare = vi . hoisted ( ( ) => vi . fn ( ) . mockResolvedValue ( { data : { authorizationUrl : "https://auth.example.test" } } ) ) ;
99const mockToast = vi . hoisted ( ( ) => vi . fn ( ) ) ;
10- const mockPush = vi . hoisted ( ( ) => vi . fn ( ) ) ;
10+ const mockNavigate = vi . hoisted ( ( ) => vi . fn ( ) ) ;
1111
1212vi . mock ( "@/app/admin/actions" , ( ) => ( {
1313 prepareClientOauthTestAction : mockPrepare ,
@@ -17,15 +17,15 @@ vi.mock("@/components/ui/use-toast", () => ({
1717 useToast : ( ) => ( { toast : mockToast } ) ,
1818} ) ) ;
1919
20- vi . mock ( "next /navigation" , ( ) => ( {
21- useRouter : ( ) => ( { push : mockPush } ) ,
20+ vi . mock ( "@/app/admin/clients/[clientId]/test /navigation" , ( ) => ( {
21+ navigateTo : mockNavigate ,
2222} ) ) ;
2323
2424describe ( "TestRunAgainButton" , ( ) => {
2525 beforeEach ( ( ) => {
2626 mockPrepare . mockClear ( ) ;
2727 mockToast . mockClear ( ) ;
28- mockPush . mockClear ( ) ;
28+ mockNavigate . mockClear ( ) ;
2929 } ) ;
3030
3131 it ( "restarts the OAuth test using prior settings" , async ( ) => {
@@ -41,7 +41,7 @@ describe("TestRunAgainButton", () => {
4141 redirectUri : "https://admin.example.test/callback" ,
4242 promptLogin : false ,
4343 } ) ;
44- expect ( mockPush ) . toHaveBeenCalledWith ( "https://auth.example.test" ) ;
44+ expect ( mockNavigate ) . toHaveBeenCalledWith ( "https://auth.example.test" ) ;
4545 } ) ;
4646 } ) ;
4747
@@ -58,7 +58,7 @@ describe("TestRunAgainButton", () => {
5858 title : "Unable to restart test" ,
5959 description : "Client missing" ,
6060 } ) ;
61- expect ( mockPush ) . not . toHaveBeenCalled ( ) ;
61+ expect ( mockNavigate ) . not . toHaveBeenCalled ( ) ;
6262 } ) ;
6363 } ) ;
6464
@@ -75,7 +75,7 @@ describe("TestRunAgainButton", () => {
7575 title : "Unable to restart test" ,
7676 description : "Network down" ,
7777 } ) ;
78- expect ( mockPush ) . not . toHaveBeenCalled ( ) ;
78+ expect ( mockNavigate ) . not . toHaveBeenCalled ( ) ;
7979 } ) ;
8080 } ) ;
8181
@@ -91,7 +91,7 @@ describe("TestRunAgainButton", () => {
9191
9292 await waitFor ( ( ) => {
9393 expect ( mockPrepare ) . toHaveBeenCalled ( ) ;
94- expect ( mockPush ) . toHaveBeenCalledWith ( "https://auth.example.test" ) ;
94+ expect ( mockNavigate ) . toHaveBeenCalledWith ( "https://auth.example.test" ) ;
9595 } ) ;
9696 } ) ;
9797} ) ;
0 commit comments