Skip to content

Commit

Permalink
other tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ijjk committed Feb 5, 2024
1 parent 8d02440 commit 64f5199
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 12 deletions.
8 changes: 6 additions & 2 deletions test/e2e/app-dir/ppr-full/ppr-full.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,9 @@ createNextDescribe(
expect(cacheControl).toEqual('no-store, must-revalidate')
} else if (dynamic === false || dynamic === 'force-static') {
expect(cacheControl).toEqual(
`s-maxage=${revalidate || '31536000'}, stale-while-revalidate`
`s-maxage=${
revalidate || '31536000'
}, stale-while-revalidate=31536000`
)
} else {
expect(cacheControl).toEqual(
Expand Down Expand Up @@ -272,7 +274,9 @@ createNextDescribe(
expect(cache).toEqual('public, max-age=0, must-revalidate')
} else {
expect(cache).toEqual(
`s-maxage=${revalidate || '31536000'}, stale-while-revalidate`
`s-maxage=${
revalidate || '31536000'
}, stale-while-revalidate=31536000`
)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -193,13 +193,13 @@ describe('required server files', () => {
case: 'redirect no revalidate',
path: '/optional-ssg/redirect-1',
dest: '/somewhere',
cacheControl: 's-maxage=31536000, stale-while-revalidate',
cacheControl: 's-maxage=31536000, stale-while-revalidate=31536000',
},
{
case: 'redirect with revalidate',
path: '/optional-ssg/redirect-2',
dest: '/somewhere-else',
cacheControl: 's-maxage=5, stale-while-revalidate',
cacheControl: 's-maxage=5, stale-while-revalidate=31536000',
},
])(
`should have correct cache-control for $case`,
Expand Down Expand Up @@ -234,13 +234,13 @@ describe('required server files', () => {
case: 'notFound no revalidate',
path: '/optional-ssg/not-found-1',
dest: '/somewhere',
cacheControl: 's-maxage=31536000, stale-while-revalidate',
cacheControl: 's-maxage=31536000, stale-while-revalidate=31536000',
},
{
case: 'notFound with revalidate',
path: '/optional-ssg/not-found-2',
dest: '/somewhere-else',
cacheControl: 's-maxage=5, stale-while-revalidate',
cacheControl: 's-maxage=5, stale-while-revalidate=31536000',
},
])(
`should have correct cache-control for $case`,
Expand All @@ -267,7 +267,7 @@ describe('required server files', () => {
const res = await fetchViaHTTP(appPort, '/optional-ssg/props-no-revalidate')
expect(res.status).toBe(200)
expect(res.headers.get('cache-control')).toBe(
's-maxage=31536000, stale-while-revalidate'
's-maxage=31536000, stale-while-revalidate=31536000'
)
const $ = cheerio.load(await res.text())
expect(JSON.parse($('#props').text()).params).toEqual({
Expand All @@ -281,7 +281,7 @@ describe('required server files', () => {
)
expect(dataRes.status).toBe(200)
expect(res.headers.get('cache-control')).toBe(
's-maxage=31536000, stale-while-revalidate'
's-maxage=31536000, stale-while-revalidate=31536000'
)
expect((await dataRes.json()).pageProps.params).toEqual({
rest: ['props-no-revalidate'],
Expand Down Expand Up @@ -449,7 +449,7 @@ describe('required server files', () => {
})
expect(res.status).toBe(200)
expect(res.headers.get('cache-control')).toBe(
's-maxage=1, stale-while-revalidate'
's-maxage=1, stale-while-revalidate=31536000'
)

await waitFor(2000)
Expand All @@ -460,7 +460,7 @@ describe('required server files', () => {
})
expect(res2.status).toBe(404)
expect(res2.headers.get('cache-control')).toBe(
's-maxage=1, stale-while-revalidate'
's-maxage=1, stale-while-revalidate=31536000'
)
})

Expand All @@ -472,7 +472,7 @@ describe('required server files', () => {
})
expect(res.status).toBe(200)
expect(res.headers.get('cache-control')).toBe(
's-maxage=1, stale-while-revalidate'
's-maxage=1, stale-while-revalidate=31536000'
)

await next.patchFile('standalone/data.txt', 'hide')
Expand All @@ -484,7 +484,7 @@ describe('required server files', () => {

expect(res2.status).toBe(404)
expect(res2.headers.get('cache-control')).toBe(
's-maxage=1, stale-while-revalidate'
's-maxage=1, stale-while-revalidate=31536000'
)
})

Expand Down

0 comments on commit 64f5199

Please sign in to comment.