Add test for internal url handling in render (#9396)
This commit is contained in:
parent
553052f903
commit
8dd8fb8f2a
3 changed files with 10 additions and 0 deletions
|
@ -32,6 +32,10 @@ app.prepare().then(() => {
|
|||
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)
|
||||
})
|
||||
|
||||
|
|
1
test/integration/custom-server/static/hello.txt
Normal file
1
test/integration/custom-server/static/hello.txt
Normal file
|
@ -0,0 +1 @@
|
|||
hello world
|
|
@ -45,6 +45,11 @@ describe('Custom Server', () => {
|
|||
beforeAll(() => startServer())
|
||||
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 () => {
|
||||
expect(await renderViaHTTP(appPort, '/no-query')).toMatch(/"query":/)
|
||||
})
|
||||
|
|
Loading…
Reference in a new issue