Skip to content

Commit

Permalink
add integration test for maxage header
Browse files Browse the repository at this point in the history
  • Loading branch information
AriFreyr committed Jan 11, 2021
1 parent 50a3105 commit 508cf2b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion test/integration/prerender/pages/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export async function getStaticProps() {
return {
props: { world: 'world', time: new Date().getTime() },
// bad-prop
revalidate: 1,
revalidate: 2,
}
}

Expand Down
7 changes: 7 additions & 0 deletions test/integration/prerender/test/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -521,6 +521,13 @@ const runTests = (dev = false, isEmulatedServerless = false) => {
expect(data.pageProps.post).toBe('post-3')
})

it('should use correct caching headers for a revalidate page', async () => {
const initialRes = await fetchViaHTTP(appPort, '/')
expect(initialRes.headers.get('cache-control')).toBe(
's-maxage=2, stale-while-revalidate'
)
})

it('should navigate to a normal page and back', async () => {
const browser = await webdriver(appPort, '/')
let text = await browser.elementByCss('p').text()
Expand Down

0 comments on commit 508cf2b

Please sign in to comment.