Unverified Commit 803659a8 authored by Joe Haddad's avatar Joe Haddad Committed by GitHub

Test static folder (#9395)

* Test for infinite loop

* remove focus
parent 5d5af484
...@@ -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!/)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment