import { Suspense, use } from 'react'; import { Preview } from '../shared/utils/testing/preview'; import { Template } from '../shared/utils/testing/template'; import { render } from './render'; type Import = typeof import('react-dom/server') & { default: typeof import('react-dom/server'); }; describe('render on the edge', () => { it('converts a React component into HTML with Next 14 error stubs', async () => { vi.mock('react-dom/server', async () => { const ReactDOMServer = await vi.importActual('react-dom/server'); const ERROR_MESSAGE = 'Internal Error: do not use legacy react-dom/server APIs. If you encountered this error, please open an issue on the Next.js repo.'; return { ...ReactDOMServer, default: { ...ReactDOMServer.default, renderToString() { throw new Error(ERROR_MESSAGE); }, renderToStaticMarkup() { throw new Error(ERROR_MESSAGE); }, }, renderToString() { throw new Error(ERROR_MESSAGE); }, renderToStaticMarkup() { throw new Error(ERROR_MESSAGE); }, }; }); const actualOutput = await render(