fix revalidate-reason deploy test (#66830)
Since `next.cliOutput` won't have access to runtime logs we can refactor this test to render text on the page instead.
This commit is contained in:
parent
258726e42b
commit
96d6370572
4 changed files with 10 additions and 15 deletions
|
@ -50,7 +50,6 @@
|
||||||
"test/e2e/new-link-behavior/stitches.test.ts",
|
"test/e2e/new-link-behavior/stitches.test.ts",
|
||||||
"test/e2e/next-image-forward-ref/index.test.ts",
|
"test/e2e/next-image-forward-ref/index.test.ts",
|
||||||
"test/e2e/react-compiler/react-compiler.test.ts",
|
"test/e2e/react-compiler/react-compiler.test.ts",
|
||||||
"test/e2e/revalidate-reason/revalidate-reason.test.ts",
|
|
||||||
"test/e2e/app-dir/actions/app-action.test.ts",
|
"test/e2e/app-dir/actions/app-action.test.ts",
|
||||||
"test/e2e/app-dir/i18n-hybrid/i18n-hybrid.test.js",
|
"test/e2e/app-dir/i18n-hybrid/i18n-hybrid.test.js",
|
||||||
"test/e2e/app-dir/metadata/metadata.test.ts",
|
"test/e2e/app-dir/metadata/metadata.test.ts",
|
||||||
|
|
|
@ -7,11 +7,11 @@ export async function getStaticProps({ params, revalidateReason }) {
|
||||||
)
|
)
|
||||||
return {
|
return {
|
||||||
props: {
|
props: {
|
||||||
hello: 'world',
|
reason: revalidateReason,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export default ({ hello }) => {
|
export default ({ reason }) => {
|
||||||
return <p>hello: {hello}</p>
|
return <p id="reason">revalidate reason: {reason}</p>
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,12 +7,12 @@ export async function getStaticProps({ params, revalidateReason }) {
|
||||||
)
|
)
|
||||||
return {
|
return {
|
||||||
props: {
|
props: {
|
||||||
hello: 'world',
|
reason: revalidateReason,
|
||||||
},
|
},
|
||||||
revalidate: 5,
|
revalidate: 5,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export default ({ hello }) => {
|
export default ({ reason }) => {
|
||||||
return <p>hello: {hello}</p>
|
return <p id="reason">revalidate reason: {reason}</p>
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,9 +38,8 @@ describe('revalidate-reason', () => {
|
||||||
|
|
||||||
expect(res.status).toBe(200)
|
expect(res.status).toBe(200)
|
||||||
|
|
||||||
expect(next.cliOutput).toContain(
|
const $ = await next.render$('/')
|
||||||
'revalidate-reason/pages/index.tsx revalidateReason: on-demand'
|
expect($('#reason').text()).toBe('revalidate reason: on-demand')
|
||||||
)
|
|
||||||
})
|
})
|
||||||
|
|
||||||
it('should support revalidateReason: "stale"', async () => {
|
it('should support revalidateReason: "stale"', async () => {
|
||||||
|
@ -51,11 +50,8 @@ describe('revalidate-reason', () => {
|
||||||
await waitFor(5000)
|
await waitFor(5000)
|
||||||
|
|
||||||
await retry(async () => {
|
await retry(async () => {
|
||||||
await next.fetch('/stale')
|
const $ = await next.render$('/stale')
|
||||||
|
expect($('#reason').text()).toBe('revalidate reason: stale')
|
||||||
expect(next.cliOutput).toContain(
|
|
||||||
'revalidate-reason/pages/stale.tsx revalidateReason: stale'
|
|
||||||
)
|
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in a new issue