Skip to content

Commit 11de231

Browse files
committed
[Cache Components] test labels when caching is disabled
1 parent 1c26c3c commit 11de231

File tree

1 file changed

+20
-10
lines changed

1 file changed

+20
-10
lines changed

test/development/app-dir/react-performance-track/react-performance-track.test.ts

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,23 @@
11
import { nextTestSetup } from 'e2e-utils'
22

3-
describe('react-performance-track', () => {
3+
describe.each([
4+
{
5+
description: 'caching enabled',
6+
enableCache: true,
7+
},
8+
{
9+
description: 'caching disabled',
10+
enableCache: false,
11+
},
12+
])('react-performance-track - $description', ({ enableCache }) => {
413
// false is the default when visiting pages as an ordinary user.
514
// true is the default when having Chrome DevTools open.
615
// Hardcoded for now since most of the actual behavior is not intended.
7-
const disableCache = false
8-
const extraHTTPHeaders = disableCache
9-
? { 'Cache-Control': 'no-cache' }
10-
: undefined
16+
const extraHTTPHeaders = enableCache
17+
? undefined
18+
: { 'Cache-Control': 'no-cache' }
19+
20+
const PREFETCHABLE = enableCache ? 'Prefetchable' : 'Server'
1121

1222
const { next } = nextTestSetup({
1323
files: __dirname,
@@ -61,7 +71,7 @@ describe('react-performance-track', () => {
6171
expect(track).toEqual(
6272
expect.arrayContaining([
6373
{
64-
name: '\u200bparams [Prefetchable]',
74+
name: `\u200bparams [${PREFETCHABLE}]`,
6575
properties: [],
6676
},
6777
])
@@ -80,7 +90,7 @@ describe('react-performance-track', () => {
8090
expect(track).toEqual(
8191
expect.arrayContaining([
8292
{
83-
name: '\u200bsearchParams [Prefetchable]',
93+
name: `\u200bsearchParams [${PREFETCHABLE}]`,
8494
properties: [],
8595
},
8696
])
@@ -97,7 +107,7 @@ describe('react-performance-track', () => {
97107
expect(track).toEqual(
98108
expect.arrayContaining([
99109
{
100-
name: '\u200bcookies [Prefetchable]',
110+
name: `\u200bcookies [${PREFETCHABLE}]`,
101111
properties: [],
102112
},
103113
// TODO: The error message makes this seem like it shouldn't pop up here.
@@ -123,7 +133,7 @@ describe('react-performance-track', () => {
123133
})
124134

125135
const track = await browser.eval('window.reactServerRequests.getSnapshot()')
126-
// TODO: Should include "draftMode [Prefetchable]".
136+
// draftMode should not show up as IO.
127137
expect(track).toEqual([
128138
{
129139
name: '\u200b',
@@ -142,7 +152,7 @@ describe('react-performance-track', () => {
142152
expect(track).toEqual(
143153
expect.arrayContaining([
144154
{
145-
name: '\u200bheaders [Prefetchable]',
155+
name: `\u200bheaders [${PREFETCHABLE}]`,
146156
properties: [],
147157
},
148158
// TODO: The error message makes this seem like it shouldn't pop up here.

0 commit comments

Comments
 (0)