Unverified Commit 27017925 authored by JJ Kasper's avatar JJ Kasper Committed by GitHub

Update more flakey API support checks (#45373)

x-ref: https://github.com/vercel/next.js/actions/runs/4033048662/jobs/6933337411
parent 09f235d9
...@@ -308,16 +308,24 @@ function runTests(dev = false) { ...@@ -308,16 +308,24 @@ function runTests(dev = false) {
it('should show friendly error for invalid redirect', async () => { it('should show friendly error for invalid redirect', async () => {
await fetchViaHTTP(appPort, '/api/redirect-error', null, {}) await fetchViaHTTP(appPort, '/api/redirect-error', null, {})
expect(stderr).toContain(
`Invalid redirect arguments. Please use a single argument URL, e.g. res.redirect('/destination') or use a status code and URL, e.g. res.redirect(307, '/destination').` await check(() => {
) expect(stderr).toContain(
`Invalid redirect arguments. Please use a single argument URL, e.g. res.redirect('/destination') or use a status code and URL, e.g. res.redirect(307, '/destination').`
)
return 'yes'
}, 'yes')
}) })
it('should show friendly error in case of passing null as first argument redirect', async () => { it('should show friendly error in case of passing null as first argument redirect', async () => {
await fetchViaHTTP(appPort, '/api/redirect-null', null, {}) await fetchViaHTTP(appPort, '/api/redirect-null', null, {})
expect(stderr).toContain(
`Invalid redirect arguments. Please use a single argument URL, e.g. res.redirect('/destination') or use a status code and URL, e.g. res.redirect(307, '/destination').` check(() => {
) expect(stderr).toContain(
`Invalid redirect arguments. Please use a single argument URL, e.g. res.redirect('/destination') or use a status code and URL, e.g. res.redirect(307, '/destination').`
)
return 'yes'
}, 'yes')
}) })
it('should redirect with status code 307', async () => { it('should redirect with status code 307', async () => {
...@@ -547,10 +555,14 @@ function runTests(dev = false) { ...@@ -547,10 +555,14 @@ function runTests(dev = false) {
it('should show false positive warning if not using externalResolver flag', async () => { it('should show false positive warning if not using externalResolver flag', async () => {
const apiURL = '/api/external-resolver-false-positive' const apiURL = '/api/external-resolver-false-positive'
const req = await fetchViaHTTP(appPort, apiURL) const req = await fetchViaHTTP(appPort, apiURL)
expect(stderr).toContain(
`API resolved without sending a response for ${apiURL}, this may result in stalled requests.`
)
expect(await req.text()).toBe('hello world') expect(await req.text()).toBe('hello world')
check(() => {
expect(stderr).toContain(
`API resolved without sending a response for ${apiURL}, this may result in stalled requests.`
)
return 'yes'
}, 'yes')
}) })
it('should not show warning if using externalResolver flag', async () => { it('should not show warning if using externalResolver flag', async () => {
......
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