@@ -47,8 +47,8 @@ import {
4747import { TelemetryProvider } from '@mongodb-js/compass-telemetry/provider' ;
4848import { CompassComponentsProvider } from '@mongodb-js/compass-components' ;
4949import {
50+ TestEnvCurrentConnectionContext ,
5051 ConnectionInfoProvider ,
51- TEST_CONNECTION_INFO ,
5252} from '@mongodb-js/compass-connections/src/connection-info-provider' ;
5353import type { State } from '@mongodb-js/compass-connections/src/stores/connections-store-redux' ;
5454import { createDefaultConnectionInfo } from '@mongodb-js/compass-connections/src/stores/connections-store-redux' ;
@@ -231,6 +231,17 @@ const EmptyWrapper = ({ children }: { children: React.ReactElement }) => {
231231 return < > { children } </ > ;
232232} ;
233233
234+ const TEST_ENV_CURRENT_CONNECTION = {
235+ info : {
236+ id : 'TEST' ,
237+ connectionOptions : {
238+ connectionString : 'mongodb://localhost:27020' ,
239+ } ,
240+ } ,
241+ status : 'connected' as const ,
242+ error : null ,
243+ } ;
244+
234245function createWrapper (
235246 options : TestConnectionsOptions ,
236247 // When using renderHook, anything that will try to call createPortal will
@@ -331,9 +342,13 @@ function createWrapper(
331342 preloadStorageConnectionInfos = { options . connections }
332343 >
333344 < StoreGetter >
334- < TestingLibraryWrapper { ...props } >
335- { children }
336- </ TestingLibraryWrapper >
345+ < TestEnvCurrentConnectionContext . Provider
346+ value = { TEST_ENV_CURRENT_CONNECTION }
347+ >
348+ < TestingLibraryWrapper { ...props } >
349+ { children }
350+ </ TestingLibraryWrapper >
351+ </ TestEnvCurrentConnectionContext . Provider >
337352 </ StoreGetter >
338353 </ CompassConnections >
339354 </ ConnectFnProvider >
@@ -461,7 +476,7 @@ function createConnectionInfoWrapper(
461476
462477async function renderWithActiveConnection (
463478 ui : React . ReactElement ,
464- connectionInfo : ConnectionInfo = TEST_CONNECTION_INFO ,
479+ connectionInfo : ConnectionInfo = TEST_ENV_CURRENT_CONNECTION . info ,
465480 {
466481 connections,
467482 wrapper : Wrapper = EmptyWrapper ,
@@ -483,7 +498,7 @@ async function renderWithActiveConnection(
483498
484499async function renderHookWithActiveConnection < HookProps , HookResult > (
485500 cb : ( props : HookProps ) => HookResult ,
486- connectionInfo : ConnectionInfo = TEST_CONNECTION_INFO ,
501+ connectionInfo : ConnectionInfo = TEST_ENV_CURRENT_CONNECTION . info ,
487502 {
488503 connections,
489504 wrapper : Wrapper = EmptyWrapper ,
0 commit comments