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
803659a8
Unverified
Commit
803659a8
authored
Nov 13, 2019
by
Joe Haddad
Committed by
GitHub
Nov 13, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Test static folder (#9395)
* Test for infinite loop * remove focus
parent
5d5af484
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
0 deletions
+12
-0
index.test.js
test/integration/serverless/test/index.test.js
+12
-0
No files found.
test/integration/serverless/test/index.test.js
View file @
803659a8
...
@@ -13,6 +13,7 @@ import {
...
@@ -13,6 +13,7 @@ import {
renderViaHTTP
,
renderViaHTTP
,
}
from
'next-test-utils'
}
from
'next-test-utils'
import
qs
from
'querystring'
import
qs
from
'querystring'
import
path
from
'path'
import
fetch
from
'node-fetch'
import
fetch
from
'node-fetch'
const
appDir
=
join
(
__dirname
,
'../'
)
const
appDir
=
join
(
__dirname
,
'../'
)
...
@@ -62,6 +63,17 @@ describe('Serverless', () => {
...
@@ -62,6 +63,17 @@ describe('Serverless', () => {
expect
(
legacy
).
toMatch
(
`new static folder`
)
expect
(
legacy
).
toMatch
(
`new static folder`
)
})
})
it
(
'should not infinity loop on a 404 static file'
,
async
()
=>
{
expect
.
assertions
(
2
)
// ensure top-level static does not exist (important for test)
// we expect /public/static, though.
expect
(
existsSync
(
path
.
join
(
appDir
,
'static'
))).
toBe
(
false
)
const
res
=
await
fetchViaHTTP
(
appPort
,
'/static/404'
)
expect
(
res
.
status
).
toBe
(
404
)
})
it
(
'should render the page with dynamic import'
,
async
()
=>
{
it
(
'should render the page with dynamic import'
,
async
()
=>
{
const
html
=
await
renderViaHTTP
(
appPort
,
'/dynamic'
)
const
html
=
await
renderViaHTTP
(
appPort
,
'/dynamic'
)
expect
(
html
).
toMatch
(
/Hello!/
)
expect
(
html
).
toMatch
(
/Hello!/
)
...
...
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