Skip to content

Commit

Permalink
add slug on dir test example
Browse files Browse the repository at this point in the history
  • Loading branch information
zetavg committed Feb 1, 2025
1 parent bcc7346 commit d35570b
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 2 deletions.
17 changes: 17 additions & 0 deletions tests/test/app/routes/directory-slug/[slugOnDir]/[slugOnFile].tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { useParams } from 'one'
import { Text } from 'react-native'

export async function generateStaticParams() {
return [
{
slugOnDir: 'foo',
slugOnFile: 'bar',
},
]
}

export default function DirectorySlugTest() {
const params = useParams()

return <Text testID="params-json">{JSON.stringify(params)}</Text>
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { useParams } from 'one'
import { Text } from 'react-native'

export async function generateStaticParams() {
return [
{
slugOnDir: 'foo',
slugOnFile: 'bar',
},
]
}

export default function DirectorySlugTest() {
const params = useParams()

return <Text testID="params-json">{JSON.stringify(params)}</Text>
}
4 changes: 2 additions & 2 deletions tests/test/routes.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ declare module 'one' {
export namespace OneRouter {
export interface __routes<T extends string = string> extends Record<string, unknown> {
StaticRoutes: `/` | `/(auth-guard)` | `/(auth-guard)/auth-guard` | `/(blog)` | `/(blog)/blog/my-first-post` | `/(marketing)/about` | `/(sub-page-group)` | `/(sub-page-group)/sub-page` | `/(sub-page-group)/sub-page/sub` | `/(sub-page-group)/sub-page/sub2` | `/_sitemap` | `/about` | `/auth-guard` | `/blog/my-first-post` | `/expo-video` | `/hooks` | `/hooks/contents` | `/hooks/contents/page-1` | `/hooks/contents/page-2` | `/loader` | `/loader/other` | `/middleware` | `/not-found/deep/test` | `/not-found/fallback/test` | `/not-found/test` | `/server-data` | `/sheet` | `/spa/spapage` | `/ssr/basic` | `/sub-page` | `/sub-page/sub` | `/sub-page/sub2` | `/web-extensions`
DynamicRoutes: `/not-found/+not-found` | `/not-found/deep/+not-found` | `/routes/subpath/${string}` | `/spa/${OneRouter.SingleRoutePart<T>}` | `/ssr/${OneRouter.SingleRoutePart<T>}` | `/ssr/${string}`
DynamicRouteTemplate: `/not-found/+not-found` | `/not-found/deep/+not-found` | `/routes/subpath/[...subpath]` | `/spa/[spaparams]` | `/ssr/[...rest]` | `/ssr/[param]`
DynamicRoutes: `/not-found/+not-found` | `/not-found/deep/+not-found` | `/routes/directory-slug/${OneRouter.SingleRoutePart<T>}/${OneRouter.SingleRoutePart<T>}` | `/routes/directory-slug/${OneRouter.SingleRoutePart<T>}/subdir/${OneRouter.SingleRoutePart<T>}` | `/routes/subpath/${string}` | `/spa/${OneRouter.SingleRoutePart<T>}` | `/ssr/${OneRouter.SingleRoutePart<T>}` | `/ssr/${string}`
DynamicRouteTemplate: `/not-found/+not-found` | `/not-found/deep/+not-found` | `/routes/directory-slug/[slugOnDir]/[slugOnFile]` | `/routes/directory-slug/[slugOnDir]/subdir/[slugOnFile]` | `/routes/subpath/[...subpath]` | `/spa/[spaparams]` | `/ssr/[...rest]` | `/ssr/[param]`
IsTyped: true
}
}
Expand Down

0 comments on commit d35570b

Please sign in to comment.