diff --git a/test/fixtures/HelloWorld.tsx b/test/fixtures/HelloWorld.tsx index 204fff0..365a35e 100644 --- a/test/fixtures/HelloWorld.tsx +++ b/test/fixtures/HelloWorld.tsx @@ -1,3 +1,7 @@ -export function HelloWorld(): React.ReactElement { - return
Hello World
+export function HelloWorld({ + name = 'World', +}: { + name?: string +}): React.ReactElement { + return
{`Hello ${name}`}
} diff --git a/test/render.test.tsx b/test/render.test.tsx index 0d2f451..a2a0e16 100644 --- a/test/render.test.tsx +++ b/test/render.test.tsx @@ -1,3 +1,4 @@ +import { Suspense } from 'react' import { expect, test } from 'vitest' import { page } from '@vitest/browser/context' import { render } from '../src/index' @@ -17,3 +18,12 @@ test('renders counter', async () => { await screen.getByRole('button', { name: 'Increment' }).click() await expect.element(screen.getByText('Count is 2')).toBeVisible() }) + +test('renders a suspended component', async () => { + const { getByText } = await render(, { + wrapper: ({ children }) => ( + Suspended!}>{children} + ), + }) + await expect.element(getByText('Hello Vitest')).toBeInTheDocument() +})