|
| 1 | +describe('appDir', () => { |
| 2 | + it('renders ISR appdir pages as HTML by default', () => { |
| 3 | + cy.request({ url: '/blog/erica/', followRedirect: false }).then((response) => { |
| 4 | + expect(response.headers['content-type']).to.match(/^text\/html/) |
| 5 | + }) |
| 6 | + }) |
| 7 | + |
| 8 | + it('renders static appdir pages as HTML by default', () => { |
| 9 | + cy.request({ url: '/blog/erica/first-post/', followRedirect: false }).then((response) => { |
| 10 | + expect(response.headers['content-type']).to.match(/^text\/html/) |
| 11 | + }) |
| 12 | + }) |
| 13 | + |
| 14 | + it('renders dynamic appdir pages as HTML by default', () => { |
| 15 | + cy.request({ url: '/blog/erica/random-post/', followRedirect: false }).then((response) => { |
| 16 | + expect(response.headers['content-type']).to.match(/^text\/html/) |
| 17 | + }) |
| 18 | + }) |
| 19 | + |
| 20 | + it('returns RSC data for RSC requests to ISR pages', () => { |
| 21 | + cy.request({ |
| 22 | + url: '/blog/erica/', |
| 23 | + headers: { |
| 24 | + RSC: '1', |
| 25 | + }, |
| 26 | + followRedirect: false, |
| 27 | + }).then((response) => { |
| 28 | + expect(response.headers).to.have.property('content-type', 'application/octet-stream') |
| 29 | + }) |
| 30 | + }) |
| 31 | + |
| 32 | + it('returns RSC data for RSC requests to static pages', () => { |
| 33 | + cy.request({ |
| 34 | + url: '/blog/erica/first-post/', |
| 35 | + headers: { |
| 36 | + RSC: '1', |
| 37 | + }, |
| 38 | + followRedirect: false, |
| 39 | + }).then((response) => { |
| 40 | + expect(response.headers).to.have.property('content-type', 'application/octet-stream') |
| 41 | + }) |
| 42 | + }) |
| 43 | + |
| 44 | + it('returns RSC data for RSC requests to dynamic pages', () => { |
| 45 | + cy.request({ |
| 46 | + url: '/blog/erica/random-post/', |
| 47 | + headers: { |
| 48 | + RSC: '1', |
| 49 | + }, |
| 50 | + followRedirect: false, |
| 51 | + }).then((response) => { |
| 52 | + expect(response.headers).to.have.property('content-type', 'application/octet-stream') |
| 53 | + }) |
| 54 | + }) |
| 55 | + |
| 56 | + it('correctly redirects HTML requests for ISR pages', () => { |
| 57 | + cy.request({ url: '/blog/erica', followRedirect: false }).then((response) => { |
| 58 | + expect(response.status).to.equal(308) |
| 59 | + expect(response.headers).to.have.property('location', '/blog/erica/') |
| 60 | + }) |
| 61 | + }) |
| 62 | + |
| 63 | + // This needs trailing slash handling to be fixed |
| 64 | + it.skip('correctly redirects HTML requests for static pages', () => { |
| 65 | + cy.request({ url: '/blog/erica/first-post', followRedirect: false }).then((response) => { |
| 66 | + expect(response.status).to.equal(308) |
| 67 | + expect(response.headers).to.have.property('location', '/blog/erica/first-post/') |
| 68 | + }) |
| 69 | + }) |
| 70 | + |
| 71 | + it('correctly redirects HTML requests for dynamic pages', () => { |
| 72 | + cy.request({ url: '/blog/erica/random-post', followRedirect: false }).then((response) => { |
| 73 | + expect(response.status).to.equal(308) |
| 74 | + expect(response.headers).to.have.property('location', '/blog/erica/random-post/') |
| 75 | + }) |
| 76 | + }) |
| 77 | +}) |
0 commit comments