Skip to content

Commit f7bf277

Browse files
committed
update test
1 parent 05e2ae1 commit f7bf277

File tree

1 file changed

+16
-8
lines changed

1 file changed

+16
-8
lines changed

test/integration/404-page/test/index.test.js

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ describe('404 Page Support', () => {
111111
runTests('serverless')
112112
})
113113

114-
it('should cache for custom 404 page on ssg without revalidate', async () => {
114+
it('should not cache for custom 404 page with gssp and revalidate disabled', async () => {
115115
await fs.move(pages404, `${pages404}.bak`)
116116
await fs.writeFile(
117117
pages404,
@@ -130,17 +130,21 @@ describe('404 Page Support', () => {
130130
await fs.move(`${pages404}.bak`, pages404)
131131
await killApp(app)
132132

133-
expect(cache404).toBe('s-maxage=31536000, stale-while-revalidate')
134-
expect(cacheNext).toBe('s-maxage=31536000, stale-while-revalidate')
133+
expect(cache404).toBe(
134+
'private, no-cache, no-store, max-age=0, must-revalidate'
135+
)
136+
expect(cacheNext).toBe(
137+
'private, no-cache, no-store, max-age=0, must-revalidate'
138+
)
135139
})
136140

137-
it('should not cache for custom 404 page on ssg with revalidate', async () => {
141+
it('should not cache for custom 404 page with gssp and revalidate enabled', async () => {
138142
await fs.move(pages404, `${pages404}.bak`)
139143
await fs.writeFile(
140144
pages404,
141145
`
142146
const page = () => 'custom 404 page'
143-
export async function getStaticProps() { return { props: {}, revalidate: 10 } }
147+
export async function getStaticProps() { return { props: {}, revalidate: 1 } }
144148
export default page
145149
`
146150
)
@@ -153,11 +157,15 @@ describe('404 Page Support', () => {
153157
await fs.move(`${pages404}.bak`, pages404)
154158
await killApp(app)
155159

156-
expect(cache404).toBe('s-maxage=10, stale-while-revalidate')
157-
expect(cacheNext).toBe('s-maxage=10, stale-while-revalidate')
160+
expect(cache404).toBe(
161+
'private, no-cache, no-store, max-age=0, must-revalidate'
162+
)
163+
expect(cacheNext).toBe(
164+
'private, no-cache, no-store, max-age=0, must-revalidate'
165+
)
158166
})
159167

160-
it('should not cache for custom 404 page on production mode', async () => {
168+
it('should not cache for custom 404 page without gssp', async () => {
161169
await nextBuild(appDir)
162170
appPort = await findPort()
163171
app = await nextStart(appDir, appPort)

0 commit comments

Comments
 (0)