forked from vercel/next.js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.test.js
30 lines (27 loc) · 787 Bytes
/
index.test.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
/**
* @jest-environment jsdom
*/
import { render, screen } from '@testing-library/react'
import Link from 'next/link'
test('single child', () => {
render(<Link href="https://nextjs.org/blog/next-13">Hello world</Link>)
expect(screen.getByRole('link')).not.toBeNull()
})
test('multiple child with default legacyBehavior', () => {
render(
<Link href="https://nextjs.org/blog/next-13">
<span>Hello world</span>
<span>!</span>
</Link>
)
expect(screen.getByRole('link')).not.toBeNull()
})
test('multiple child with forced legacyBehavior=false', () => {
render(
<Link href="https://nextjs.org/blog/next-13" legacyBehavior={false}>
<span>Hello world</span>
<span>!</span>
</Link>
)
expect(screen.getByRole('link')).not.toBeNull()
})