Skip to content

Commit c75b3ea

Browse files
committed
test: api route calling res.revalidate on path returning notFound: true is not cacheable
1 parent bb6b015 commit c75b3ea

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

tests/e2e/page-router.test.ts

+9
Original file line numberDiff line numberDiff line change
@@ -590,6 +590,15 @@ test.describe('Simple Page Router (no basePath, no i18n)', () => {
590590
'getStaticProps duration should not be longer than 10 seconds',
591591
).toBeLessThan(10_000)
592592
})
593+
594+
test('API route calling res.revalidate() is not cacheable', async ({ page, pageRouter }) => {
595+
const response = await page.goto(
596+
new URL('/api/revalidate?path=/static/not-found', pageRouter.url).href,
597+
)
598+
599+
expect(response?.status()).toEqual(200)
600+
expect(response?.headers()['netlify-cdn-cache-control']).not.toMatch(/(s-maxage|max-age)/)
601+
})
593602
})
594603

595604
test.describe('Page Router with basePath and i18n', () => {

0 commit comments

Comments
 (0)