diff --git a/test/unit/link-warnings.test.js b/test/unit/link-warnings.test.js index 9c48085132a3c..0db43b5ff6b3a 100644 --- a/test/unit/link-warnings.test.js +++ b/test/unit/link-warnings.test.js @@ -4,26 +4,26 @@ import { act, render } from '@testing-library/react' import Link from 'next/link' -describe('', () => { +describe('', () => { let spy beforeAll(() => { spy = jest.spyOn(console, 'error').mockImplementation(() => {}) }) - it('test a', () => {}) + it('test link with unmount', () => { + act(() => { + const { unmount } = render(hello) + unmount() + }) + + expect(spy).not.toHaveBeenCalled() + }) - it('test link', () => { - let result + it('test link without unmount', () => { act(() => { - result = render( -
-

Hello

- hello -
- ) + render(hello) }) - expect(result).toBeDefined() expect(spy).not.toHaveBeenCalled() })