Skip to content

Commit

Permalink
update test
Browse files Browse the repository at this point in the history
  • Loading branch information
Timer committed Feb 11, 2021
1 parent 514ef15 commit 05e52fd
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions test/unit/link-warnings.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,26 +4,26 @@
import { act, render } from '@testing-library/react'
import Link from 'next/link'

describe('<TestComponent/>', () => {
describe('<Link/>', () => {
let spy
beforeAll(() => {
spy = jest.spyOn(console, 'error').mockImplementation(() => {})
})

it('test a', () => {})
it('test link with unmount', () => {
act(() => {
const { unmount } = render(<Link href="/">hello</Link>)
unmount()
})

expect(spy).not.toHaveBeenCalled()
})

it('test link', () => {
let result
it('test link without unmount', () => {
act(() => {
result = render(
<div>
<p>Hello</p>
<Link href="nowhere">hello</Link>
</div>
)
render(<Link href="/">hello</Link>)
})

expect(result).toBeDefined()
expect(spy).not.toHaveBeenCalled()
})

Expand Down

0 comments on commit 05e52fd

Please sign in to comment.