MCPcopy Create free account
hub / github.com/MaterializeInc/materialize / setFakeEnvironment

Function setFakeEnvironment

console/src/test/utils.tsx:112–125  ·  view source on GitHub ↗
(
  set: Setter,
  regionId: string,
  environment: LoadedEnvironment,
)

Source from the content-addressed store, hash-verified

110};
111
112export const setFakeEnvironment = async (
113 set: Setter,
114 regionId: string,
115 environment: LoadedEnvironment,
116) => {
117 const environments = new Map<string, LoadedEnvironment>([
118 [regionId, environment],
119 ] as const);
120 set(currentRegionIdAtom, regionId);
121 set(environmentsWithHealth, environments);
122 // This prevents components from suspending when the get the environment, unfortunately
123 // it's not clear why this works.
124 await getStore().get(currentEnvironmentState);
125};
126
127export type InitializeStateFn = (store: Store) => Promise<void> | void;
128

Calls 3

getStoreFunction · 0.90
setFunction · 0.50
getMethod · 0.45

Tested by

no test coverage detected