MCPcopy Index your code
hub / github.com/simstudioai/sim / renderProvider

Function renderProvider

apps/sim/app/_shell/providers/session-provider.test.tsx:79–108  ·  view source on GitHub ↗

* Mounts SessionProvider in a real React 19 root under jsdom with a real * QueryClient, capturing the live context value via a probe consumer.

()

Source from the content-addressed store, hash-verified

77 * QueryClient, capturing the live context value via a probe consumer.
78 */
79function renderProvider(): Harness {
80 ;(globalThis as { IS_REACT_ACT_ENVIRONMENT?: boolean }).IS_REACT_ACT_ENVIRONMENT = true
81 const container = document.createElement('div')
82 const root: Root = createRoot(container)
83 const queryClient = new QueryClient({
84 defaultOptions: { queries: { retry: false } },
85 })
86
87 let latest: SessionHookResult | null = null
88 function Probe() {
89 latest = useContext(SessionContext)
90 return null
91 }
92
93 act(() => {
94 root.render(
95 <QueryClientProvider client={queryClient}>
96 <SessionProvider>
97 <Probe />
98 </SessionProvider>
99 </QueryClientProvider>
100 )
101 })
102
103 return {
104 ctx: () => latest,
105 queryClient,
106 unmount: () => act(() => root.unmount()),
107 }
108}
109
110/**
111 * Flush pending work inside an act() boundary. Drains the microtask queue and

Callers 1

Calls 2

unmountMethod · 0.80
renderMethod · 0.45

Tested by

no test coverage detected