rsnext/test/integration/getserversideprops/pages/index.js
Joe Haddad 8443a809f3
Verify GS(S)P Serializability (#10857)
* Verify GS(S)P Serializability

* Add support for cyclic refs

* Add unit tests

* Test for error in development mode

* Fix prerender preview tests

* Fix gssp preview tests

* fix 2x test cases

* Add desired test

* fix some more tests

* Fix route manifest expect

* Fix test expects

* Test that `getServerSideProps` does not error in production

* Test that getStaticProps is not checked in production

* Test serialization check during build

* Fix export detection for serverless

* Update test/unit/is-serializable-props.test.js

Co-Authored-By: JJ Kasper <jj@jjsweb.site>

Co-authored-by: JJ Kasper <jj@jjsweb.site>
2020-03-09 13:30:44 -04:00

50 lines
1.2 KiB
JavaScript

import Link from 'next/link'
export async function getServerSideProps() {
return {
props: {
world: 'world',
time: new Date().getTime(),
},
}
}
const Page = ({ world, time }) => {
return (
<>
<p>hello {world}</p>
<span>time: {time}</span>
<Link href="/non-json">
<a id="non-json">to non-json</a>
</Link>
<br />
<Link href="/another">
<a id="another">to another</a>
</Link>
<br />
<Link href="/something">
<a id="something">to something</a>
</Link>
<br />
<Link href="/normal">
<a id="normal">to normal</a>
</Link>
<br />
<Link href="/blog/[post]" as="/blog/post-1">
<a id="post-1">to dynamic</a>
</Link>
<Link href="/blog/[post]" as="/blog/post-100">
<a id="broken-post">to broken</a>
</Link>
<br />
<Link href="/blog/[post]/[comment]" as="/blog/post-1/comment-1">
<a id="comment-1">to another dynamic</a>
</Link>
<Link href="/something?another=thing">
<a id="something-query">to something?another=thing</a>
</Link>
</>
)
}
export default Page