Skip to content

Commit

Permalink
Fix existing tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Timer committed Feb 26, 2020
1 parent 7c9e457 commit 5479302
Show file tree
Hide file tree
Showing 12 changed files with 13 additions and 6 deletions.
3 changes: 2 additions & 1 deletion errors/invalid-getstaticpaths-value.md
Expand Up @@ -11,7 +11,8 @@ Make sure to return the following shape from `unstable_getStaticPaths`:
```js
export async function unstable_getStaticPaths() {
return {
paths: Array<string | { params: { [key: string]: string } }>
paths: Array<string | { params: { [key: string]: string } }>,
fallback: boolean
}
}
```
@@ -1,5 +1,5 @@
export async function unstable_getStaticPaths() {
return { paths: ['/hello', '/world'] }
return { paths: ['/hello', '/world'], fallback: true }
}

export default () => <p>something is missing 🤔</p>
Expand Up @@ -9,6 +9,7 @@ export function unstable_getStaticProps({ params }) {
export function unstable_getStaticPaths() {
return {
paths: [],
fallback: true,
}
}

Expand Down
Expand Up @@ -15,6 +15,7 @@ export function unstable_getStaticProps({ params }) {
export function unstable_getStaticPaths() {
return {
paths: [],
fallback: true,
}
}

Expand Down
Expand Up @@ -12,6 +12,7 @@ export function unstable_getStaticPaths() {
`/p1/p2/predefined-ssg/one-level`,
`/p1/p2/predefined-ssg/1st-level/2nd-level`,
],
fallback: true,
}
}

Expand Down
@@ -1,6 +1,6 @@
export const unstable_getStaticPaths = async () => {
return {
props: { world: 'world' }
props: { world: 'world' }, fallback: true
}
}

Expand Down
Expand Up @@ -2,7 +2,7 @@ import React from 'react'

// eslint-disable-next-line camelcase
export async function unstable_getStaticPaths() {
return { paths: [{ params: { slug: 'hello' } }] }
return { paths: [{ params: { slug: 'hello' } }], fallback: true }
}

// eslint-disable-next-line camelcase
Expand Down
Expand Up @@ -2,7 +2,7 @@ import React from 'react'

// eslint-disable-next-line camelcase
export async function unstable_getStaticPaths() {
return { paths: [{ foo: 'bad', baz: 'herro' }] }
return { paths: [{ foo: 'bad', baz: 'herro' }], fallback: true }
}

// eslint-disable-next-line camelcase
Expand Down
1 change: 1 addition & 0 deletions test/integration/prerender/pages/blog/[post]/[comment].js
Expand Up @@ -8,6 +8,7 @@ export async function unstable_getStaticPaths() {
'/blog/post-1/comment-1',
{ params: { post: 'post-2', comment: 'comment-2' } },
],
fallback: true,
}
}

Expand Down
1 change: 1 addition & 0 deletions test/integration/prerender/pages/blog/[post]/index.js
Expand Up @@ -13,6 +13,7 @@ export async function unstable_getStaticPaths() {
'/blog/post.1',
'/blog/post.1', // handle duplicates
],
fallback: true,
}
}

Expand Down
1 change: 1 addition & 0 deletions test/integration/prerender/pages/catchall/[...slug].js
Expand Up @@ -21,6 +21,7 @@ export async function unstable_getStaticPaths() {
{ params: { slug: ['another', 'value'] } },
'/catchall/hello/another',
],
fallback: true,
}
}

Expand Down
2 changes: 1 addition & 1 deletion test/integration/prerender/pages/user/[user]/profile.js
Expand Up @@ -3,7 +3,7 @@ import Link from 'next/link'

// eslint-disable-next-line camelcase
export async function unstable_getStaticPaths() {
return { paths: [] }
return { paths: [], fallback: true }
}

// eslint-disable-next-line camelcase
Expand Down

0 comments on commit 5479302

Please sign in to comment.