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