|
| 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