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
8dd8fb8f
Commit
8dd8fb8f
authored
Nov 13, 2019
by
JJ Kasper
Committed by
Joe Haddad
Nov 13, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add test for internal url handling in render (#9396)
parent
553052f9
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
10 additions
and
0 deletions
+10
-0
server.js
test/integration/custom-server/server.js
+4
-0
hello.txt
test/integration/custom-server/static/hello.txt
+1
-0
index.test.js
test/integration/custom-server/test/index.test.js
+5
-0
No files found.
test/integration/custom-server/server.js
View file @
8dd8fb8f
...
@@ -32,6 +32,10 @@ app.prepare().then(() => {
...
@@ -32,6 +32,10 @@ app.prepare().then(() => {
return
app
.
render
(
req
,
res
,
'/dashboard/index'
)
return
app
.
render
(
req
,
res
,
'/dashboard/index'
)
}
}
if
(
/static
\/
hello
\.
text/
.
test
(
req
.
url
))
{
return
app
.
render
(
req
,
res
,
'/static/hello.text'
)
}
handleNextRequests
(
req
,
res
)
handleNextRequests
(
req
,
res
)
})
})
...
...
test/integration/custom-server/static/hello.txt
0 → 100644
View file @
8dd8fb8f
hello world
\ No newline at end of file
test/integration/custom-server/test/index.test.js
View file @
8dd8fb8f
...
@@ -45,6 +45,11 @@ describe('Custom Server', () => {
...
@@ -45,6 +45,11 @@ describe('Custom Server', () => {
beforeAll
(()
=>
startServer
())
beforeAll
(()
=>
startServer
())
afterAll
(()
=>
killApp
(
server
))
afterAll
(()
=>
killApp
(
server
))
it
(
'should serve internal file from render'
,
async
()
=>
{
const
data
=
await
renderViaHTTP
(
appPort
,
'/static/hello.txt'
)
expect
(
data
).
toMatch
(
/hello world/
)
})
it
(
'should handle render with undefined query'
,
async
()
=>
{
it
(
'should handle render with undefined query'
,
async
()
=>
{
expect
(
await
renderViaHTTP
(
appPort
,
'/no-query'
)).
toMatch
(
/"query":/
)
expect
(
await
renderViaHTTP
(
appPort
,
'/no-query'
)).
toMatch
(
/"query":/
)
})
})
...
...
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