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
39e00a3f
Unverified
Commit
39e00a3f
authored
Aug 14, 2020
by
JJ Kasper
Committed by
GitHub
Aug 14, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add test case for preloading buildManifest (#16183)
parent
4e813ae0
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
34 additions
and
0 deletions
+34
-0
index.test.js
test/integration/dynamic-routing/test/index.test.js
+34
-0
No files found.
test/integration/dynamic-routing/test/index.test.js
View file @
39e00a3f
...
@@ -561,6 +561,40 @@ function runTests(dev) {
...
@@ -561,6 +561,40 @@ function runTests(dev) {
expect
(
res
.
status
).
toBe
(
400
)
expect
(
res
.
status
).
toBe
(
400
)
})
})
it
(
'should preload buildManifest for auto-export dynamic pages'
,
async
()
=>
{
const
html
=
await
renderViaHTTP
(
appPort
,
'/on-mount/hello'
)
const
$
=
cheerio
.
load
(
html
)
let
found
=
0
for
(
const
el
of
Array
.
from
(
$
(
'link[rel="preload"]'
)))
{
const
{
href
}
=
el
.
attribs
if
(
href
.
includes
(
'_buildManifest.js'
)
||
href
.
includes
(
'_buildManifest.module.js'
)
)
{
found
++
}
}
expect
(
found
).
toBe
(
dev
?
2
:
1
)
})
it
(
'should not preload buildManifest for non-auto export dynamic pages'
,
async
()
=>
{
const
html
=
await
renderViaHTTP
(
appPort
,
'/hello'
)
const
$
=
cheerio
.
load
(
html
)
let
found
=
0
for
(
const
el
of
Array
.
from
(
$
(
'link[rel="preload"]'
)))
{
const
{
href
}
=
el
.
attribs
if
(
href
.
includes
(
'_buildManifest.js'
)
||
href
.
includes
(
'_buildManifest.module.js'
)
)
{
found
++
}
}
expect
(
found
).
toBe
(
0
)
})
if
(
dev
)
{
if
(
dev
)
{
it
(
'should resolve dynamic route href for page added later'
,
async
()
=>
{
it
(
'should resolve dynamic route href for page added later'
,
async
()
=>
{
const
browser
=
await
webdriver
(
appPort
,
'/'
)
const
browser
=
await
webdriver
(
appPort
,
'/'
)
...
...
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