mirror of
https://github.com/ant-design/ant-design.git
synced 2024-11-28 13:09:40 +08:00
test: add mockRestore to fix incorrect test case (#38454)
This commit is contained in:
parent
fe9ac7b936
commit
b36f013e2a
@ -131,16 +131,18 @@ describe('DropdownButton', () => {
|
||||
'ant-btn',
|
||||
);
|
||||
});
|
||||
it('should throw Error then `overlay` in props', () => {
|
||||
it('should console Error then `overlay` in props', () => {
|
||||
const errSpy = jest.spyOn(console, 'error').mockImplementation(() => {});
|
||||
render(<DropdownButton overlay={<div>test</div>} />);
|
||||
expect(errSpy).toHaveBeenCalledWith(
|
||||
'Warning: [antd: Dropdown] `overlay` is deprecated. Please use `menu` instead.',
|
||||
);
|
||||
errSpy.mockRestore();
|
||||
});
|
||||
it('should not throw Error then `overlay` not in props', () => {
|
||||
it('should not console Error then `overlay` not in props', () => {
|
||||
const errSpy = jest.spyOn(console, 'error').mockImplementation(() => {});
|
||||
render(<DropdownButton />);
|
||||
expect(errSpy).toHaveBeenCalled();
|
||||
expect(errSpy).not.toHaveBeenCalled();
|
||||
errSpy.mockRestore();
|
||||
});
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user