rsnext/test/unit/link-rendering.test.ts
Valentin Hervieu 30c9627133
Update next/link default legacyBehavior (#42623)
## Bug
Fixes #42621

- [x] Related issues linked using `fixes #number`
- [x] Integration tests added
- [ ] Errors have a helpful link attached, see `contributing.md`

Co-authored-by: JJ Kasper <jj@jjsweb.site>
2022-11-30 20:01:29 -08:00

20 lines
488 B
TypeScript

/* eslint-env jest */
import React from 'react'
import ReactDOM from 'react-dom/server'
import Link from 'next/link'
describe('Link rendering', () => {
it('should render Link on its own', async () => {
const element = React.createElement(
Link,
{
href: '/my-path',
},
'to another page'
)
const html = ReactDOM.renderToString(element)
expect(html).toMatchInlineSnapshot(
`"<a href=\\"/my-path\\">to another page</a>"`
)
})
})