mirror of
https://github.com/zhigang1992/react.git
synced 2026-04-29 20:55:46 +08:00
test(link): add testcase for deprecate warning
This commit is contained in:
@@ -41,5 +41,13 @@ describe('Link', () => {
|
|||||||
expect(errorSpy).not.toHaveBeenCalled()
|
expect(errorSpy).not.toHaveBeenCalled()
|
||||||
expect(ref.current).not.toBeNull()
|
expect(ref.current).not.toBeNull()
|
||||||
expect(() => wrapper.unmount()).not.toThrow()
|
expect(() => wrapper.unmount()).not.toThrow()
|
||||||
|
errorSpy.mockRestore()
|
||||||
|
})
|
||||||
|
|
||||||
|
it('an warning should be thrown when using the pure prop', () => {
|
||||||
|
const errorSpy = jest.spyOn(console, 'error').mockImplementation(() => {})
|
||||||
|
mount(<Link pure />)
|
||||||
|
expect(errorSpy).toHaveBeenCalled()
|
||||||
|
errorSpy.mockRestore()
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user