@@ -47,8 +47,8 @@ import {
47
47
import { TelemetryProvider } from '@mongodb-js/compass-telemetry/provider' ;
48
48
import { CompassComponentsProvider } from '@mongodb-js/compass-components' ;
49
49
import {
50
+ TestEnvCurrentConnectionContext ,
50
51
ConnectionInfoProvider ,
51
- TEST_CONNECTION_INFO ,
52
52
} from '@mongodb-js/compass-connections/src/connection-info-provider' ;
53
53
import type { State } from '@mongodb-js/compass-connections/src/stores/connections-store-redux' ;
54
54
import { createDefaultConnectionInfo } from '@mongodb-js/compass-connections/src/stores/connections-store-redux' ;
@@ -231,6 +231,17 @@ const EmptyWrapper = ({ children }: { children: React.ReactElement }) => {
231
231
return < > { children } </ > ;
232
232
} ;
233
233
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
+
234
245
function createWrapper (
235
246
options : TestConnectionsOptions ,
236
247
// When using renderHook, anything that will try to call createPortal will
@@ -331,9 +342,13 @@ function createWrapper(
331
342
preloadStorageConnectionInfos = { options . connections }
332
343
>
333
344
< 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 >
337
352
</ StoreGetter >
338
353
</ CompassConnections >
339
354
</ ConnectFnProvider >
@@ -461,7 +476,7 @@ function createConnectionInfoWrapper(
461
476
462
477
async function renderWithActiveConnection (
463
478
ui : React . ReactElement ,
464
- connectionInfo : ConnectionInfo = TEST_CONNECTION_INFO ,
479
+ connectionInfo : ConnectionInfo = TEST_ENV_CURRENT_CONNECTION . info ,
465
480
{
466
481
connections,
467
482
wrapper : Wrapper = EmptyWrapper ,
@@ -483,7 +498,7 @@ async function renderWithActiveConnection(
483
498
484
499
async function renderHookWithActiveConnection < HookProps , HookResult > (
485
500
cb : ( props : HookProps ) => HookResult ,
486
- connectionInfo : ConnectionInfo = TEST_CONNECTION_INFO ,
501
+ connectionInfo : ConnectionInfo = TEST_ENV_CURRENT_CONNECTION . info ,
487
502
{
488
503
connections,
489
504
wrapper : Wrapper = EmptyWrapper ,
0 commit comments