Skip to content

Commit

Permalink
Updates cache tests to expect failure when using cache in client comp…
Browse files Browse the repository at this point in the history
…onents. React no longer caches functions in client contexts.
  • Loading branch information
gnoff committed Feb 5, 2024
1 parent a2cb0ef commit 6ce3738
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions test/e2e/app-dir/app/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1545,14 +1545,18 @@ createNextDescribe(
expect(val1).toBe(val2)
})

it('client component', async () => {
// Caching behavior for client components removed in https://github.com/facebook/react/pull/27977
it('[EXPECT FAILURE] client component', async () => {
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)
expect(() => {
expect(val1).toBe(val2)
}).toThrow()
})

it('client component client-navigation', async () => {
// Caching behavior for client components removed in https://github.com/facebook/react/pull/27977
it('[EXPECT FAILURE] client component client-navigation', async () => {
const browser = await next.browser('/react-cache')

await browser
Expand All @@ -1561,7 +1565,9 @@ createNextDescribe(
.waitForElementByCss('#value-1', 10000)
const val1 = await browser.elementByCss('#value-1').text()
const val2 = await browser.elementByCss('#value-2').text()
expect(val1).toBe(val2)
expect(() => {
expect(val1).toBe(val2)
}).toThrow()
})

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

0 comments on commit 6ce3738

Please sign in to comment.