未验证 提交 803659a8 编写于 作者: J Joe Haddad 提交者: GitHub

Test static folder (#9395)

* Test for infinite loop

* remove focus
上级 5d5af484
......@@ -13,6 +13,7 @@ import {
renderViaHTTP,
} from 'next-test-utils'
import qs from 'querystring'
import path from 'path'
import fetch from 'node-fetch'
const appDir = join(__dirname, '../')
......@@ -62,6 +63,17 @@ describe('Serverless', () => {
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 () => {
const html = await renderViaHTTP(appPort, '/dynamic')
expect(html).toMatch(/Hello!/)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册