Skip to content

Commit d53a11d

Browse files
committed
chore: update cypress tests
1 parent 36acbdb commit d53a11d

File tree

2 files changed

+68
-6
lines changed

2 files changed

+68
-6
lines changed

cypress/integration/default/dynamic-routes.spec.ts

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,6 @@ describe('Static Routing', () => {
2121
expect(res.body).to.contain('Dancing with the Stars')
2222
})
2323
})
24-
it('revalidates page via refresh hooks on a static route', () => {
25-
cy.request({ url: '/api/revalidate/' }).then((res) => {
26-
expect(res.status).to.eq(200)
27-
expect(res.body).to.equal({ code: 200, message: 'success' })
28-
})
29-
})
3024
})
3125

3226
describe('Dynamic Routing', () => {
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
describe('On-demand revalidation', () => {
2+
it('revalidates static ISR route with default locale', () => {
3+
cy.request({ url: '/api/revalidate/?select=0' }).then((res) => {
4+
expect(res.status).to.eq(200)
5+
expect(res.body).to.have.property('message', 'success')
6+
})
7+
})
8+
it('revalidates static ISR route with non-default locale', () => {
9+
cy.request({ url: '/api/revalidate/?select=1' }).then((res) => {
10+
expect(res.status).to.eq(200)
11+
expect(res.body).to.have.property('message', 'success')
12+
})
13+
})
14+
it('revalidates root static ISR route with default locale', () => {
15+
cy.request({ url: '/api/revalidate/?select=2' }).then((res) => {
16+
expect(res.status).to.eq(200)
17+
expect(res.body).to.have.property('message', 'success')
18+
})
19+
})
20+
it('revalidates root static ISR route with non-default locale', () => {
21+
cy.request({ url: '/api/revalidate/?select=3' }).then((res) => {
22+
expect(res.status).to.eq(200)
23+
expect(res.body).to.have.property('message', 'success')
24+
})
25+
})
26+
it('revalidates dynamic prerendered ISR route with default locale', () => {
27+
cy.request({ url: '/api/revalidate/?select=4' }).then((res) => {
28+
expect(res.status).to.eq(200)
29+
expect(res.body).to.have.property('message', 'success')
30+
})
31+
})
32+
it('fails to revalidate dynamic non-prerendered ISR route with fallback false', () => {
33+
cy.request({ url: '/api/revalidate/?select=5' }).then((res) => {
34+
expect(res.status).to.eq(500)
35+
expect(res.body).to.have.property('message', '404')
36+
})
37+
})
38+
it('revalidates dynamic non-prerendered ISR route with fallback blocking', () => {
39+
cy.request({ url: '/api/revalidate/?select=6' }).then((res) => {
40+
expect(res.status).to.eq(200)
41+
expect(res.body).to.have.property('message', 'success')
42+
})
43+
})
44+
it('revalidates dynamic non-prerendered ISR route with fallback blocking and non-default locale', () => {
45+
cy.request({ url: '/api/revalidate/?select=7' }).then((res) => {
46+
expect(res.status).to.eq(200)
47+
expect(res.body).to.have.property('message', 'success')
48+
})
49+
})
50+
it('revalidates dynamic prerendered appDir route', () => {
51+
cy.request({ url: '/api/revalidate/?select=8' }).then((res) => {
52+
expect(res.status).to.eq(200)
53+
expect(res.body).to.have.property('message', 'success')
54+
})
55+
})
56+
it('fails to revalidate dynamic non-prerendered appDir route', () => {
57+
cy.request({ url: '/api/revalidate/?select=9' }).then((res) => {
58+
expect(res.status).to.eq(500)
59+
expect(res.body).to.have.property('message', '404')
60+
})
61+
})
62+
it('revalidates dynamic prerendered appDir route with catch-all params', () => {
63+
cy.request({ url: '/api/revalidate/?select=10' }).then((res) => {
64+
expect(res.status).to.eq(200)
65+
expect(res.body).to.have.property('message', 'success')
66+
})
67+
})
68+
})

0 commit comments

Comments
 (0)