Skip to content

Commit

Permalink
fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
ztanner committed Sep 16, 2023
1 parent 161c886 commit 22337f4
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 12 deletions.
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { findDOMNode, flushSync, unstable_batchedUpdates } from 'react-dom'

import {
experimental_useOptimistic as useOptimistic,
experimental_useFormStatus,
experimental_useFormState,
} from 'react-dom'

export default function () {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { findDOMNode, flushSync, unstable_batchedUpdates } from 'react-dom';
import { experimental_useOptimistic as useOptimistic, experimental_useFormStatus } from 'react-dom';
import { experimental_useFormStatus, experimental_useFormState } from 'react-dom';

export default function() {
return null;
}
13 changes: 3 additions & 10 deletions test/development/acceptance-app/server-components.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -258,19 +258,12 @@ describe('Error Overlay for server components', () => {
)

await check(async () => {
expect(
await browser
.waitForElementByCss('#nextjs__container_errors_desc')
.text()
).toContain(
'experimental_useOptimistic only works in Client Components. Add the "use client" directive at the top of the file to use it. Read more: https://nextjs.org/docs/messages/react-client-hook-in-server-component'
)
const html = await browser.eval('document.documentElement.innerHTML')
expect(html).toContain('experimental_useOptimistic')
return 'success'
}, 'success')

expect(next.cliOutput).toContain(
'experimental_useOptimistic only works in Client Components. Add the "use client" directive at the top of the file to use it. Read more: https://nextjs.org/docs/messages/react-client-hook-in-server-component'
)
expect(next.cliOutput).toContain('experimental_useOptimistic')

await cleanup()
})
Expand Down

0 comments on commit 22337f4

Please sign in to comment.