Skip to content

Commit

Permalink
add more tests
Browse files Browse the repository at this point in the history
  • Loading branch information
shuding committed Mar 11, 2022
1 parent 5d243fb commit 9f8b3d0
Show file tree
Hide file tree
Showing 5 changed files with 132 additions and 0 deletions.
@@ -0,0 +1,26 @@
import getRuntime from '../utils/runtime'
import getTime from '../utils/time'

export default function Page({ type }) {
return (
<div>
This is a {type} RSC page.
<br />
{'Runtime: ' + getRuntime()}
<br />
{'Time: ' + getTime()}
</div>
)
}

export function getStaticProps() {
return {
props: {
type: 'SSG',
},
}
}

export const config = {
runtime: 'nodejs',
}
@@ -0,0 +1,26 @@
import getRuntime from '../utils/runtime'
import getTime from '../utils/time'

export default function Page({ type }) {
return (
<div>
This is a {type} RSC page.
<br />
{'Runtime: ' + getRuntime()}
<br />
{'Time: ' + getTime()}
</div>
)
}

export function getServerSideProps() {
return {
props: {
type: 'SSR',
},
}
}

export const config = {
runtime: 'nodejs',
}
@@ -0,0 +1,26 @@
import getRuntime from '../utils/runtime'
import getTime from '../utils/time'

export default function Page({ type }) {
return (
<div>
This is a {type} page.
<br />
{'Runtime: ' + getRuntime()}
<br />
{'Time: ' + getTime()}
</div>
)
}

export function getStaticProps() {
return {
props: {
type: 'SSG',
},
}
}

export const config = {
runtime: 'nodejs',
}
@@ -0,0 +1,26 @@
import getRuntime from '../utils/runtime'
import getTime from '../utils/time'

export default function Page({ type }) {
return (
<div>
This is a {type} page.
<br />
{'Runtime: ' + getRuntime()}
<br />
{'Time: ' + getTime()}
</div>
)
}

export function getServerSideProps() {
return {
props: {
type: 'SSR',
},
}
}

export const config = {
runtime: 'nodejs',
}
Expand Up @@ -78,13 +78,41 @@ describe('Without global runtime configuration', () => {
})
})

it('should build /node-ssr as a dynamic page with the nodejs runtime', async () => {
await testRoute(context.appPort, '/node-ssr', {
isStatic: false,
isEdge: false,
})
})

it('should build /node-ssg as a static page with the nodejs runtime', async () => {
await testRoute(context.appPort, '/node-ssg', {
isStatic: true,
isEdge: false,
})
})

it('should build /node-rsc as a static page with the nodejs runtime', async () => {
await testRoute(context.appPort, '/node-rsc', {
isStatic: true,
isEdge: false,
})
})

it('should build /node-rsc-ssr as a dynamic page with the nodejs runtime', async () => {
await testRoute(context.appPort, '/node-rsc-ssr', {
isStatic: false,
isEdge: false,
})
})

it('should build /node-rsc-ssg as a static page with the nodejs runtime', async () => {
await testRoute(context.appPort, '/node-rsc-ssg', {
isStatic: true,
isEdge: false,
})
})

it('should build /edge as a dynamic page with the edge runtime', async () => {
await testRoute(context.appPort, '/edge', {
isStatic: false,
Expand Down

0 comments on commit 9f8b3d0

Please sign in to comment.