Skip to content

Commit

Permalink
Update tests assuming React.cache works on the client
Browse files Browse the repository at this point in the history
  • Loading branch information
eps1lon committed May 2, 2024
1 parent 9cf86c5 commit aa503da
Showing 1 changed file with 20 additions and 3 deletions.
23 changes: 20 additions & 3 deletions test/e2e/app-dir/app/index.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
import { nextTestSetup } from 'e2e-utils'
import { check, retry, waitFor } from 'next-test-utils'
import {
check,
getRedboxDescriptionWarning,
retry,
waitFor,
} from 'next-test-utils'
import cheerio from 'cheerio'
import stripAnsi from 'strip-ansi'

Expand Down Expand Up @@ -1424,7 +1429,13 @@ describe('app dir - basic', () => {
const browser = await next.browser('/react-cache/client-component')
const val1 = await browser.elementByCss('#value-1').text()
const val2 = await browser.elementByCss('#value-2').text()
expect(val1).toBe(val2)
// React.cache is not supported in client components.
expect(val1).not.toBe(val2)
if (isDev) {
await expect(getRedboxDescriptionWarning(browser)).resolves.toEqual(
"Hydration failed because the server rendered HTML didn't match the client."
)
}
})

it('client component client-navigation', async () => {
Expand All @@ -1436,7 +1447,13 @@ describe('app dir - basic', () => {
.waitForElementByCss('#value-1', 10000)
const val1 = await browser.elementByCss('#value-1').text()
const val2 = await browser.elementByCss('#value-2').text()
expect(val1).toBe(val2)
// React.cache is not supported in client components.
expect(val1).not.toBe(val2)
if (isDev) {
await expect(getRedboxDescriptionWarning(browser)).resolves.toEqual(
"Hydration failed because the server rendered HTML didn't match the client."
)
}
})

it('middleware overriding headers', async () => {
Expand Down

0 comments on commit aa503da

Please sign in to comment.