rsnext/test/unit/link-rendering.unit.test.js
2020-11-10 12:25:50 -05:00

20 lines
540 B
JavaScript

/* 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',
},
React.createElement('a', {}, 'to another page')
)
const html = ReactDOM.renderToString(element)
expect(html).toMatchInlineSnapshot(
`"<a href=\\"/my-path\\" data-reactroot=\\"\\">to another page</a>"`
)
})
})