Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
N
next.js
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Alex
next.js
Commits
4ba6b324
Unverified
Commit
4ba6b324
authored
Sep 07, 2026
by
Hendrik Liebau
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[test] Use `@force-gate`
parent
a92d806a
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
260 additions
and
270 deletions
+260
-270
variants-cache-lifetime.test.ts
test/e2e/app-dir/variants/variants-cache-lifetime.test.ts
+82
-84
variants-empty-shell.test.ts
test/e2e/app-dir/variants/variants-empty-shell.test.ts
+40
-42
variants-fallback-upgrade.test.ts
test/e2e/app-dir/variants/variants-fallback-upgrade.test.ts
+49
-51
variants-middleware-file.test.ts
test/e2e/app-dir/variants/variants-middleware-file.test.ts
+32
-34
variants-on-demand-param.test.ts
test/e2e/app-dir/variants/variants-on-demand-param.test.ts
+57
-59
No files found.
test/e2e/app-dir/variants/variants-cache-lifetime.test.ts
View file @
4ba6b324
...
...
@@ -6,105 +6,103 @@ import { basePath, url } from './base-path'
// Variants are supported with Turbopack only, and enabling them rejects a
// webpack build, which `variants-webpack.test.ts` covers.
;(
process
.
env
.
IS_TURBOPACK_TEST
?
describe
:
describe
.
skip
)(
'variants with a cache lifetime per combination'
,
()
=>
{
const
{
next
,
skipped
}
=
nextTestSetup
({
files
:
__dirname
+
'/fixtures/cache-lifetime'
,
// TODO(variants): enable this for a deployment. A platform serves a
// combination from the routing rules the adapter emits, and those do not
// exist yet, so every assertion here is about a self-hosted server.
skipDeployment
:
true
,
// Handed to the build rather than read from `process.env` there, so that
// a deployed build receives it too: only what goes through here is
// forwarded to the remote build.
env
:
basePath
?
{
BASE_PATH
:
basePath
}
:
undefined
,
// @force-gate turbopack
describe
(
'variants with a cache lifetime per combination'
,
()
=>
{
const
{
next
,
skipped
}
=
nextTestSetup
({
files
:
__dirname
+
'/fixtures/cache-lifetime'
,
// TODO(variants): enable this for a deployment. A platform serves a
// combination from the routing rules the adapter emits, and those do not
// exist yet, so every assertion here is about a self-hosted server.
skipDeployment
:
true
,
// Handed to the build rather than read from `process.env` there, so that
// a deployed build receives it too: only what goes through here is
// forwarded to the remote build.
env
:
basePath
?
{
BASE_PATH
:
basePath
}
:
undefined
,
})
if
(
skipped
)
{
return
}
it
(
'should resolve a variant while revalidating a stale prerender'
,
async
()
=>
{
// A tag rather than the route's own lifetime, so the entry goes stale at
// once instead of after an hour.
const
before
=
await
next
.
render$
(
url
(
'/lifetime/r'
),
undefined
,
{
headers
:
{
cookie
:
'theme=dark'
},
})
if
(
skipped
)
{
return
}
expect
(
before
(
'#theme'
).
text
()).
toBe
(
'dark'
)
const
renderedAt
=
before
(
'#rendered-at'
).
text
()
expect
(
renderedAt
).
not
.
toBe
(
''
)
it
(
'should resolve a variant while revalidating a stale prerender'
,
async
()
=>
{
// A tag rather than the route's own lifetime, so the entry goes stale at
// once instead of after an hour.
const
before
=
await
next
.
render$
(
url
(
'/lifetime/r'
),
undefined
,
{
const
revalidateRes
=
await
next
.
fetch
(
url
(
'/revalidate?tag=lifetime-r'
))
expect
(
revalidateRes
.
status
).
toBe
(
200
)
// The stamp is what shows the entry was replaced. The variant reads
// `dark` before and after, so a response carrying the old stamp is the
// stale entry served while the revalidation runs behind it, and asserting
// on the variant alone would pass without that render happening.
await
retry
(
async
()
=>
{
const
after
=
await
next
.
render$
(
url
(
'/lifetime/r'
),
undefined
,
{
headers
:
{
cookie
:
'theme=dark'
},
})
expect
(
before
(
'#theme'
).
text
()).
toBe
(
'dark'
)
expect
(
after
(
'#rendered-at'
).
text
()).
not
.
toBe
(
renderedAt
)
expect
(
after
(
'#theme'
).
text
()).
toBe
(
'dark'
)
})
})
const
renderedAt
=
before
(
'#rendered-at'
).
text
()
expect
(
renderedAt
).
not
.
toBe
(
''
)
it
(
'should resolve the variant the cache lifetime is selected from'
,
async
()
=>
{
const
$
=
await
next
.
render$
(
url
(
'/lifetime/a'
),
undefined
,
{
headers
:
{
cookie
:
'theme=dark'
},
})
const
revalidateRes
=
await
next
.
fetch
(
url
(
'/revalidate?tag=lifetime-r'
)
)
expect
(
revalidateRes
.
status
).
toBe
(
200
)
expect
(
$
(
'#theme'
).
text
()).
toBe
(
'dark'
)
}
)
// The stamp is what shows the entry was replaced. The variant reads
// `dark` before and after, so a response carrying the old stamp is the
// stale entry served while the revalidation runs behind it, and asserting
// on the variant alone would pass without that render happening.
await
retry
(
async
()
=>
{
const
after
=
await
next
.
render$
(
url
(
'/lifetime/r'
),
undefined
,
{
headers
:
{
cookie
:
'theme=dark'
},
})
if
(
isNextStart
)
{
it
(
'should give each combination its own cache lifetime'
,
async
()
=>
{
const
darkResponse
=
await
next
.
fetch
(
url
(
'/lifetime/a'
),
{
headers
:
{
cookie
:
'theme=dark'
},
})
expect
(
after
(
'#rendered-at'
).
text
()).
not
.
toBe
(
renderedAt
)
expect
(
darkResponse
.
headers
.
get
(
'cache-control'
)).
toContain
(
's-maxage=3600'
)
expect
(
after
(
'#theme'
).
text
()).
toBe
(
'dark'
)
const
darkBrowser
=
await
next
.
browser
(
url
(
'/lifetime/a'
),
{
async
beforePageLoad
(
page
:
Playwright
.
Page
)
{
await
page
.
context
()
.
addCookies
([{
name
:
'theme'
,
value
:
'dark'
,
url
:
next
.
url
}])
},
})
})
it
(
'should resolve the variant the cache lifetime is selected from'
,
async
()
=>
{
const
$
=
await
next
.
render$
(
url
(
'/lifetime/a'
),
undefined
,
{
headers
:
{
cookie
:
'theme=dark'
},
await
retry
(
async
()
=>
{
expect
(
await
darkBrowser
.
elementByCss
(
'#theme'
).
text
()).
toBe
(
'dark'
)
})
expect
(
$
(
'#theme'
).
text
()).
toBe
(
'dark'
)
})
const
lightResponse
=
await
next
.
fetch
(
url
(
'/lifetime/a'
),
{
headers
:
{
cookie
:
'theme=light'
},
})
if
(
isNextStart
)
{
it
(
'should give each combination its own cache lifetime'
,
async
()
=>
{
const
darkResponse
=
await
next
.
fetch
(
url
(
'/lifetime/a'
),
{
headers
:
{
cookie
:
'theme=dark'
},
})
expect
(
darkResponse
.
headers
.
get
(
'cache-control'
)).
toContain
(
's-maxage=3600'
)
const
darkBrowser
=
await
next
.
browser
(
url
(
'/lifetime/a'
),
{
async
beforePageLoad
(
page
:
Playwright
.
Page
)
{
await
page
.
context
()
.
addCookies
([{
name
:
'theme'
,
value
:
'dark'
,
url
:
next
.
url
}])
},
})
await
retry
(
async
()
=>
{
expect
(
await
darkBrowser
.
elementByCss
(
'#theme'
).
text
()).
toBe
(
'dark'
)
})
const
lightResponse
=
await
next
.
fetch
(
url
(
'/lifetime/a'
),
{
headers
:
{
cookie
:
'theme=light'
},
})
expect
(
lightResponse
.
headers
.
get
(
'cache-control'
)).
toContain
(
's-maxage=60'
)
const
lightBrowser
=
await
next
.
browser
(
url
(
'/lifetime/a'
),
{
async
beforePageLoad
(
page
:
Playwright
.
Page
)
{
await
page
.
context
()
.
addCookies
([{
name
:
'theme'
,
value
:
'light'
,
url
:
next
.
url
}])
},
})
await
retry
(
async
()
=>
{
expect
(
await
lightBrowser
.
elementByCss
(
'#theme'
).
text
()).
toBe
(
'light'
)
})
expect
(
lightResponse
.
headers
.
get
(
'cache-control'
)).
toContain
(
's-maxage=60'
)
const
lightBrowser
=
await
next
.
browser
(
url
(
'/lifetime/a'
),
{
async
beforePageLoad
(
page
:
Playwright
.
Page
)
{
await
page
.
context
()
.
addCookies
([{
name
:
'theme'
,
value
:
'light'
,
url
:
next
.
url
}])
},
})
}
await
retry
(
async
()
=>
{
expect
(
await
lightBrowser
.
elementByCss
(
'#theme'
).
text
()).
toBe
(
'light'
)
})
})
}
)
}
)
test/e2e/app-dir/variants/variants-empty-shell.test.ts
View file @
4ba6b324
...
...
@@ -2,29 +2,28 @@ import { isNextDev, nextTestSetup } from 'e2e-utils'
// Variants are supported with Turbopack only, and enabling them rejects a
// webpack build, which `variants-webpack.test.ts` covers.
;(
process
.
env
.
IS_TURBOPACK_TEST
?
describe
:
describe
.
skip
)(
'variants with a variant read above every boundary'
,
()
=>
{
const
{
next
,
skipped
}
=
nextTestSetup
({
files
:
__dirname
+
'/fixtures/empty-shell'
,
// Every route of this fixture exists to fail the build, so the harness
// must not build or start it. Both modes below drive Next.js by hand, and
// a deployment cannot run a build that fails.
skipStart
:
true
,
skipDeployment
:
true
,
})
if
(
skipped
)
{
return
}
// @force-gate turbopack
describe
(
'variants with a variant read above every boundary'
,
()
=>
{
const
{
next
,
skipped
}
=
nextTestSetup
({
files
:
__dirname
+
'/fixtures/empty-shell'
,
// Every route of this fixture exists to fail the build, so the harness
// must not build or start it. Both modes below drive Next.js by hand, and
// a deployment cannot run a build that fails.
skipStart
:
true
,
skipDeployment
:
true
,
})
if
(
skipped
)
{
return
}
if
(
isNextDev
)
{
it
(
'should report the read above a Suspense boundary in the dev overlay'
,
async
()
=>
{
await
next
.
start
()
if
(
isNextDev
)
{
it
(
'should report the read above a Suspense boundary in the dev overlay'
,
async
()
=>
{
await
next
.
start
()
const
browser
=
await
next
.
browser
(
'/above-boundary'
)
const
browser
=
await
next
.
browser
(
'/above-boundary'
)
await
expect
(
browser
).
toDisplayCollapsedRedbox
(
`
await
expect
(
browser
).
toDisplayCollapsedRedbox
(
`
{
"description": "Next.js encountered runtime data during prerendering.",
"environmentLabel": "Server",
...
...
@@ -37,28 +36,27 @@ import { isNextDev, nextTestSetup } from 'e2e-utils'
],
}
`
)
})
})
return
}
return
}
// Each route is built on its own, because a build of both stops at
// whichever fails first.
it
.
each
([[
'above-boundary'
],
[
'runtime-above-boundary'
]])(
'should fail the build for %s'
,
async
(
route
)
=>
{
const
{
exitCode
,
cliOutput
}
=
await
next
.
build
({
args
:
[
'--debug-build-paths'
,
`app/
${
route
}
/page.tsx`
],
})
// Each route is built on its own, because a build of both stops at
// whichever fails first.
it
.
each
([[
'above-boundary'
],
[
'runtime-above-boundary'
]])(
'should fail the build for %s'
,
async
(
route
)
=>
{
const
{
exitCode
,
cliOutput
}
=
await
next
.
build
({
args
:
[
'--debug-build-paths'
,
`app/
${
route
}
/page.tsx`
],
})
expect
(
exitCode
).
toBe
(
1
)
expect
(
cliOutput
).
toContain
(
`Error occurred prerendering page "/
${
route
}
"`
)
expect
(
cliOutput
).
toContain
(
'Next.js encountered uncached or runtime data during prerendering'
)
}
)
}
)
expect
(
exitCode
).
toBe
(
1
)
expect
(
cliOutput
).
toContain
(
`Error occurred prerendering page "/
${
route
}
"`
)
expect
(
cliOutput
).
toContain
(
'Next.js encountered uncached or runtime data during prerendering'
)
}
)
})
test/e2e/app-dir/variants/variants-fallback-upgrade.test.ts
View file @
4ba6b324
...
...
@@ -3,61 +3,59 @@ import { retry } from 'next-test-utils'
// Variants are supported with Turbopack only, and enabling them rejects a
// webpack build, which `variants-webpack.test.ts` covers.
;(
process
.
env
.
IS_TURBOPACK_TEST
?
describe
:
describe
.
skip
)(
'variants on an upgraded fallback shell'
,
()
=>
{
const
{
next
,
skipped
}
=
nextTestSetup
({
files
:
__dirname
+
'/fixtures/fallback-upgrade'
,
// TODO(variants): enable this for a deployment. A platform serves a
// combination from the routing rules the adapter emits, and those do not
// exist yet, so every assertion here is about a self-hosted server.
skipDeployment
:
true
,
})
// @force-gate turbopack
describe
(
'variants on an upgraded fallback shell'
,
()
=>
{
const
{
next
,
skipped
}
=
nextTestSetup
({
files
:
__dirname
+
'/fixtures/fallback-upgrade'
,
// TODO(variants): enable this for a deployment. A platform serves a
// combination from the routing rules the adapter emits, and those do not
// exist yet, so every assertion here is about a self-hosted server.
skipDeployment
:
true
,
})
if
(
skipped
)
{
return
}
if
(
skipped
)
{
return
}
if
(
isNextDev
)
{
// Dev prerenders nothing, so it has no fallback shell to upgrade.
it
.
skip
(
'upgrades the shell of each combination separately'
,
()
=>
{})
return
}
if
(
isNextDev
)
{
// Dev prerenders nothing, so it has no fallback shell to upgrade.
it
.
skip
(
'upgrades the shell of each combination separately'
,
()
=>
{})
return
}
it
(
'should upgrade the shell of each combination separately'
,
async
()
=>
{
// `generateStaticParams` names `b` alone, so `/prefix/c` is served a
// fallback shell where the param is a hole. That request triggers an
// upgrade in the background, and a later one is served a shell built for
// `c`. Partial Prefetching is what enables the upgrade, and nothing else
// in this suite turns it on.
//
// The upgraded shell is rendered for one combination and bakes its theme,
// so each combination needs an upgraded shell of its own. That is what
// the prefix on the cache key provides. Without it the second combination
// reads the first one's shell and is answered with its theme.
for
(
const
theme
of
[
'dark'
,
'light'
])
{
const
fallback
=
await
next
.
render$
(
'/prefix/c'
,
undefined
,
{
headers
:
{
cookie
:
`theme=
${
theme
}
`
},
})
// `first()`, because a fallback shell emits the placeholder and the
// resume then emits the value, so both elements carry this id.
expect
({
theme
:
fallback
(
'#theme'
).
first
().
text
(),
one
:
fallback
(
'#one'
).
first
().
text
(),
}).
toEqual
({
theme
,
one
:
'pending'
})
it
(
'should upgrade the shell of each combination separately'
,
async
()
=>
{
// `generateStaticParams` names `b` alone, so `/prefix/c` is served a
// fallback shell where the param is a hole. That request triggers an
// upgrade in the background, and a later one is served a shell built for
// `c`. Partial Prefetching is what enables the upgrade, and nothing else
// in this suite turns it on.
//
// The upgraded shell is rendered for one combination and bakes its theme,
// so each combination needs an upgraded shell of its own. That is what
// the prefix on the cache key provides. Without it the second combination
// reads the first one's shell and is answered with its theme.
for
(
const
theme
of
[
'dark'
,
'light'
])
{
const
fallback
=
await
next
.
render$
(
'/prefix/c'
,
undefined
,
{
await
retry
(
async
()
=>
{
const
upgraded
=
await
next
.
render$
(
'/prefix/c'
,
undefined
,
{
headers
:
{
cookie
:
`theme=
${
theme
}
`
},
})
// `first()`, because a fallback shell emits the placeholder and the
// resume then emits the value, so both elements carry this id.
expect
({
theme
:
fallback
(
'#theme'
).
first
().
text
(),
one
:
fallback
(
'#one'
).
first
().
text
(),
}).
toEqual
({
theme
,
one
:
'pending'
})
await
retry
(
async
()
=>
{
const
upgraded
=
await
next
.
render$
(
'/prefix/c'
,
undefined
,
{
headers
:
{
cookie
:
`theme=
${
theme
}
`
},
})
expect
({
theme
:
upgraded
(
'#theme'
).
first
().
text
(),
one
:
upgraded
(
'#one'
).
first
().
text
(),
}).
toEqual
({
theme
,
one
:
'c'
})
})
}
})
}
)
theme
:
upgraded
(
'#theme'
).
first
().
text
(),
one
:
upgraded
(
'#one'
).
first
().
text
(),
}).
toEqual
({
theme
,
one
:
'c'
})
})
}
})
})
test/e2e/app-dir/variants/variants-middleware-file.test.ts
View file @
4ba6b324
...
...
@@ -6,44 +6,42 @@ const expectedError =
// Variants are supported with Turbopack only, so a webpack build rejects the
// config of this fixture before it reads the middleware file.
;(
process
.
env
.
IS_TURBOPACK_TEST
?
describe
:
describe
.
skip
)(
'variants in a middleware file'
,
()
=>
{
const
{
next
,
skipped
}
=
nextTestSetup
({
files
:
__dirname
+
'/fixtures/middleware-file'
,
// The fixture exists to fail, so the harness must not build or start it.
// Both modes below drive Next.js by hand instead.
skipStart
:
true
,
skipDeployment
:
true
,
})
if
(
skipped
)
{
return
}
// @force-gate turbopack
describe
(
'variants in a middleware file'
,
()
=>
{
const
{
next
,
skipped
}
=
nextTestSetup
({
files
:
__dirname
+
'/fixtures/middleware-file'
,
// The fixture exists to fail, so the harness must not build or start it.
// Both modes below drive Next.js by hand instead.
skipStart
:
true
,
skipDeployment
:
true
,
})
if
(
skipped
)
{
return
}
if
(
isNextDev
)
{
beforeAll
(
async
()
=>
{
await
next
.
start
()
})
if
(
isNextDev
)
{
beforeAll
(
async
()
=>
{
await
next
.
start
()
})
it
(
'should report the middleware file and keep the dev server up'
,
async
()
=>
{
// Renaming the file has to recover without a restart, so the dev server
// reports the error and carries on rather than failing the route.
const
response
=
await
next
.
fetch
(
'/'
)
it
(
'should report the middleware file and keep the dev server up'
,
async
()
=>
{
// Renaming the file has to recover without a restart, so the dev server
// reports the error and carries on rather than failing the route.
const
response
=
await
next
.
fetch
(
'/'
)
expect
(
response
.
status
).
toBe
(
200
)
expect
(
response
.
status
).
toBe
(
200
)
await
retry
(
async
()
=>
{
expect
(
next
.
cliOutput
).
toContain
(
expectedError
)
})
await
retry
(
async
()
=>
{
expect
(
next
.
cliOutput
).
toContain
(
expectedError
)
})
}
else
{
it
(
'should fail the build'
,
async
()
=>
{
const
{
exitCode
,
cliOutput
}
=
await
next
.
build
()
})
}
else
{
it
(
'should fail the build'
,
async
()
=>
{
const
{
exitCode
,
cliOutput
}
=
await
next
.
build
()
expect
(
exitCode
).
toBe
(
1
)
expect
(
cliOutput
).
toContain
(
expectedError
)
})
}
expect
(
exitCode
).
toBe
(
1
)
expect
(
cliOutput
).
toContain
(
expectedError
)
})
}
)
}
)
test/e2e/app-dir/variants/variants-on-demand-param.test.ts
View file @
4ba6b324
...
...
@@ -5,69 +5,67 @@ const DECLARED = '/declared'
// Variants are supported with Turbopack only, and enabling them rejects a
// webpack build, which `variants-webpack.test.ts` covers.
;(
process
.
env
.
IS_TURBOPACK_TEST
?
describe
:
describe
.
skip
)(
'variants with a param the build did not name'
,
()
=>
{
const
{
next
,
skipped
}
=
nextTestSetup
({
files
:
__dirname
+
'/fixtures/on-demand-param'
,
// TODO(variants): enable this for a deployment. A platform serves a
// combination from the routing rules the adapter emits, and those do not
// exist yet, so every assertion here is about a self-hosted server.
skipDeployment
:
true
,
})
// @force-gate turbopack
describe
(
'variants with a param the build did not name'
,
()
=>
{
const
{
next
,
skipped
}
=
nextTestSetup
({
files
:
__dirname
+
'/fixtures/on-demand-param'
,
// TODO(variants): enable this for a deployment. A platform serves a
// combination from the routing rules the adapter emits, and those do not
// exist yet, so every assertion here is about a self-hosted server.
skipDeployment
:
true
,
})
if
(
skipped
)
{
return
}
if
(
skipped
)
{
return
}
if
(
isNextDev
)
{
// Dev prerenders nothing, so it has no entry to keep and no shell to
// resume. The second test therefore cannot hold here at all. The first
// would pass, but only because a dev render and an on-demand prerender
// report the same sentinel, so it would prove nothing.
it
.
skip
(
'prerenders a param the build did not name'
,
()
=>
{})
return
}
if
(
isNextDev
)
{
// Dev prerenders nothing, so it has no entry to keep and no shell to
// resume. The second test therefore cannot hold here at all. The first
// would pass, but only because a dev render and an on-demand prerender
// report the same sentinel, so it would prove nothing.
it
.
skip
(
'prerenders a param the build did not name'
,
()
=>
{})
return
}
it
(
'should prerender a param the build did not name for the request that asks'
,
async
()
=>
{
// `/control/[slug]` has the same shape and declares no combinations. If
// both routes behave alike, the combinations are not the cause.
//
// The sentinel reports which render filled the entry, not which render
// reads it. A request that resumes the empty shell replays what the build
// wrote, and reports `buildtime`. The markup cannot report this, because
// the page looks the same either way. The cache state cannot either,
// because resuming a shell looks like serving a prerender.
//
// Two params are asked for, because there must be one prerender per
// param. A single entry that ignored the param would answer for both, and
// would serve one param's page under the other's URL. So each response's
// own param is asserted too.
for
(
const
route
of
[
CONTROL
,
DECLARED
])
{
for
(
const
slug
of
[
'unnamed-one'
,
'unnamed-two'
])
{
const
$
=
await
next
.
render$
(
`
${
route
}
/
${
slug
}
`
,
undefined
,
{
headers
:
{
cookie
:
'theme=dark'
},
})
it
(
'should prerender a param the build did not name for the request that asks'
,
async
()
=>
{
// `/control/[slug]` has the same shape and declares no combinations. If
// both routes behave alike, the combinations are not the cause.
//
// The sentinel reports which render filled the entry, not which render
// reads it. A request that resumes the empty shell replays what the build
// wrote, and reports `buildtime`. The markup cannot report this, because
// the page looks the same either way. The cache state cannot either,
// because resuming a shell looks like serving a prerender.
//
// Two params are asked for, because there must be one prerender per
// param. A single entry that ignored the param would answer for both, and
// would serve one param's page under the other's URL. So each response's
// own param is asserted too.
for
(
const
route
of
[
CONTROL
,
DECLARED
])
{
for
(
const
slug
of
[
'unnamed-one'
,
'unnamed-two'
])
{
const
$
=
await
next
.
render$
(
`
${
route
}
/
${
slug
}
`
,
undefined
,
{
headers
:
{
cookie
:
'theme=dark'
},
})
expect
({
route
,
slug
:
$
(
'#slug'
).
text
(),
cachedSentinel
:
$
(
'#cached-sentinel'
).
text
(),
}).
toEqual
({
route
,
slug
,
cachedSentinel
:
'runtime'
})
}
expect
({
route
,
slug
:
$
(
'#slug'
).
text
(),
cachedSentinel
:
$
(
'#cached-sentinel'
).
text
(),
}).
toEqual
({
route
,
slug
,
cachedSentinel
:
'runtime'
})
}
})
it
(
'should serve a param the build named from the prerender of its combination'
,
async
()
=>
{
const
$
=
await
next
.
render$
(
`
${
DECLARED
}
/built`
,
undefined
,
{
headers
:
{
cookie
:
'theme=dark'
},
})
}
})
expect
({
slug
:
$
(
'#slug'
).
text
(),
theme
:
$
(
'#theme'
).
text
(),
cachedSentinel
:
$
(
'#cached-sentinel'
).
text
(),
}).
toEqual
({
slug
:
'built'
,
theme
:
'dark'
,
cachedSentinel
:
'buildtime'
})
it
(
'should serve a param the build named from the prerender of its combination'
,
async
()
=>
{
const
$
=
await
next
.
render$
(
`
${
DECLARED
}
/built`
,
undefined
,
{
headers
:
{
cookie
:
'theme=dark'
},
})
}
)
expect
({
slug
:
$
(
'#slug'
).
text
(),
theme
:
$
(
'#theme'
).
text
(),
cachedSentinel
:
$
(
'#cached-sentinel'
).
text
(),
}).
toEqual
({
slug
:
'built'
,
theme
:
'dark'
,
cachedSentinel
:
'buildtime'
})
})
})
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment