diff --git a/client/landing/stepper/declarative-flow/internals/hooks/use-sign-up-start-tracking/test/index.tsx b/client/landing/stepper/declarative-flow/internals/hooks/use-sign-up-start-tracking/test/index.tsx
index d3ed2a5de96b5f..94b5dbd5a167a3 100644
--- a/client/landing/stepper/declarative-flow/internals/hooks/use-sign-up-start-tracking/test/index.tsx
+++ b/client/landing/stepper/declarative-flow/internals/hooks/use-sign-up-start-tracking/test/index.tsx
@@ -43,11 +43,14 @@ const render = ( { flow, queryParams = {} } ) => {
flow,
} ),
{
- wrapper: ( { children } ) => (
-
- { children }
-
- ),
+ wrapper: ( { children } ) => {
+ // The hook depends on window.location.search to determine the query params.
+ Reflect.deleteProperty( global.window, 'location' );
+ window.location = new URL(
+ 'https://example.com/' + addQueryArgs( `/setup/${ flow.name }`, queryParams )
+ ) as unknown as Location;
+ return { children };
+ },
}
);
};