Open History to see the last commit
1// Shared row type and SSR render host for the descriptor query binding tests.
2// The law is owned by descriptor-query-binding-oracle.test.tsx.
3import { renderToString } from 'react-dom/server'
4import { vi } from 'vitest'
5import type { ReactNode } from 'react'
6
7export type Row = { id: string; value: string }
8
9// React's server renderer runs in this jsdom test process. Remove the browser
10// global only for that host call; hydrateRoot retains the real browser globals.
11export function renderSsr(node: ReactNode): string {
12 const browserWindow = globalThis.window
13 vi.stubGlobal(`window`, undefined)
14 try {
15 return renderToString(node)
16 } finally {
17 vi.stubGlobal(`window`, browserWindow)
18 }
19}