Skip to content

Commit 47ca397

Browse files
committed
test: add e2e test
1 parent ce6c963 commit 47ca397

File tree

2 files changed

+25
-0
lines changed

2 files changed

+25
-0
lines changed
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
describe('appDir', () => {
2+
it('renders appdir pages using SSR', () => {
3+
cy.request('/blog/erica/first-post/').then((response) => {
4+
expect(response.headers).to.have.property('x-nf-render-mode', 'ssr')
5+
expect(response.headers).to.have.property('context-type', 'text/html; charset=utf-8')
6+
})
7+
})
8+
9+
it('returns RSC data for RSC requests', () => {
10+
cy.request('/blog/erica/first-post/', {
11+
Headers: {
12+
RSC: '1',
13+
},
14+
}).then((response) => {
15+
expect(response.headers).to.have.property('x-nf-render-mode', 'ssr')
16+
expect(response.headers).to.have.property('context-type', 'application/octet-stream')
17+
})
18+
})
19+
})

demos/default/pages/index.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,12 @@ const Index = ({ shows, nodeEnv }) => {
158158
<Link href="/rewriteToStatic">Rewrite to static (should show getStaticProps/1)</Link>
159159
</li>
160160
</ul>
161+
<h4>appDir</h4>
162+
<ul>
163+
<li>
164+
<Link href="/blog/erica">app dir page</Link>
165+
</li>
166+
</ul>
161167
<h4>Preview mode</h4>
162168
<p>Preview mode: </p>
163169
<ul>

0 commit comments

Comments
 (0)