Skip to content

Commit 06e0a33

Browse files
committed
add tests
1 parent 18401ab commit 06e0a33

File tree

31 files changed

+493
-0
lines changed

31 files changed

+493
-0
lines changed
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import { ReactNode } from 'react'
2+
3+
export default function Root({ children }: { children: ReactNode }) {
4+
return (
5+
<html>
6+
<body>{children}</body>
7+
</html>
8+
)
9+
}
10+
11+
export async function generateStaticParams() {
12+
return [
13+
{ lang: 'en', locale: 'us' },
14+
{ lang: 'es', locale: 'es' },
15+
]
16+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
export default function Layout({ children }) {
2+
return <div>{children}</div>
3+
}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import { lang, locale } from 'next/root-params'
2+
import { Suspense } from 'react'
3+
4+
export default async function Page({ params }) {
5+
return (
6+
<main>
7+
<p id="root-params">
8+
{JSON.stringify({ lang: await lang(), locale: await locale() })}
9+
</p>
10+
<Suspense fallback="...">
11+
<DynamicParams params={params} />
12+
</Suspense>
13+
</main>
14+
)
15+
}
16+
17+
async function DynamicParams({
18+
params,
19+
}: {
20+
params: Promise<{ [key: string]: string }>
21+
}) {
22+
const { slug } = await params
23+
return <p id="dynamic-params">{slug}</p>
24+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
export default function Layout({ children }) {
2+
return <div>{children}</div>
3+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
export default function Page() {
2+
return <div>Other Page</div>
3+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import { lang, locale } from 'next/root-params'
2+
3+
export default async function Page() {
4+
return (
5+
<p>
6+
hello world{' '}
7+
{JSON.stringify({ lang: await lang(), locale: await locale() })}
8+
</p>
9+
)
10+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import type { NextConfig } from 'next'
2+
3+
const nextConfig: NextConfig = {
4+
experimental: {
5+
dynamicIO: true,
6+
},
7+
}
8+
9+
export default nextConfig
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import { id } from 'next/root-params'
2+
3+
export default async function Page() {
4+
return <p>hello world {JSON.stringify({ id: await id() })}</p>
5+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import { ReactNode } from 'react'
2+
3+
export default function Root({ children }: { children: ReactNode }) {
4+
return (
5+
<html>
6+
<body>Dashboard Root: {children}</body>
7+
</html>
8+
)
9+
}
10+
11+
export const revalidate = 0
12+
export async function generateStaticParams() {
13+
return [{ id: '1' }]
14+
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import { id } from 'next/root-params'
2+
3+
export default async function Page() {
4+
return <p>hello world {JSON.stringify({ id: await id() })}</p>
5+
}

0 commit comments

Comments
 (0)