chore(deps-dev): bump eslint-plugin-jest from 26.9.0 to 27.0.1 (#37291)

* chore(deps-dev): bump eslint-plugin-jest from 26.9.0 to 27.0.1

Bumps [eslint-plugin-jest](https://github.com/jest-community/eslint-plugin-jest) from 26.9.0 to 27.0.1.
- [Release notes](https://github.com/jest-community/eslint-plugin-jest/releases)
- [Changelog](https://github.com/jest-community/eslint-plugin-jest/blob/main/CHANGELOG.md)
- [Commits](https://github.com/jest-community/eslint-plugin-jest/compare/v26.9.0...v27.0.1)

---
updated-dependencies:
- dependency-name: eslint-plugin-jest
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

* chore: fix eslint errors in test files

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: afc163 <afc163@gmail.com>
This commit is contained in:
dependabot[bot] 2022-08-30 10:57:13 +08:00 committed by GitHub
parent c740c9e263
commit 7e7c47509f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
21 changed files with 41 additions and 41 deletions

View File

@ -6,9 +6,9 @@ describe('Test ResponsiveObserve', () => {
const subscribeFunc = jest.fn();
const token = ResponsiveObserve.subscribe(subscribeFunc);
expect(ResponsiveObserve.matchHandlers[xs].mql.matches).toBeTruthy();
expect(subscribeFunc).toBeCalledTimes(1);
expect(subscribeFunc).toHaveBeenCalledTimes(1);
ResponsiveObserve.unsubscribe(token);
expect(ResponsiveObserve.matchHandlers[xs].mql.removeListener).toBeCalled();
expect(ResponsiveObserve.matchHandlers[xs].mql.removeListener).toHaveBeenCalled();
});
});

View File

@ -96,7 +96,7 @@ describe('Alert', () => {
it('ErrorBoundary', () => {
jest.spyOn(console, 'error').mockImplementation(() => undefined);
// eslint-disable-next-line no-console
expect(console.error).toBeCalledTimes(0);
expect(console.error).toHaveBeenCalledTimes(0);
// @ts-expect-error
// eslint-disable-next-line react/jsx-no-undef
const ThrowError = () => <NotExisted />;

View File

@ -84,7 +84,7 @@ describe('AutoComplete', () => {
jest.spyOn(console, 'warn').mockImplementation(() => undefined);
render(<AutoComplete placeholder="input here" allowClear />);
// eslint-disable-next-line no-console
expect(console.warn).not.toBeCalled();
expect(console.warn).not.toHaveBeenCalled();
// @ts-ignore
// eslint-disable-next-line no-console
console.warn.mockRestore();

View File

@ -425,6 +425,6 @@ describe('Calendar', () => {
/>,
);
wrapper.find('.bamboo').first().simulate('click');
expect(onClick).toBeCalled();
expect(onClick).toHaveBeenCalled();
});
});

View File

@ -448,6 +448,6 @@ describe('Calendar', () => {
/>,
);
fireEvent.click(container.querySelectorAll('.bamboo')[0]);
expect(onClick).toBeCalled();
expect(onClick).toHaveBeenCalled();
});
});

View File

@ -168,8 +168,8 @@ describe('DatePicker', () => {
const mouseDownEvent = () => {
fireEvent.mouseDown(container.querySelector('input')!);
};
expect(fuousEvent).not.toThrowError();
expect(mouseDownEvent).not.toThrowError();
expect(fuousEvent).not.toThrow();
expect(mouseDownEvent).not.toThrow();
});
it('12 hours', () => {

View File

@ -162,7 +162,7 @@ describe('Descriptions', () => {
<Descriptions.Item key="bamboo">1</Descriptions.Item>
</Descriptions>,
);
expect(jest.spyOn(document, 'createElement')).not.toBeCalled();
expect(jest.spyOn(document, 'createElement')).not.toHaveBeenCalled();
});
// https://github.com/ant-design/ant-design/issues/19887

View File

@ -115,7 +115,7 @@ describe('Drawer', () => {
});
fireEvent.animationEnd(container.querySelector('.ant-drawer-content-wrapper'));
expect(afterVisibleChange).toBeCalledTimes(1);
expect(afterVisibleChange).toHaveBeenCalledTimes(1);
});
it('should support children ref', () => {
@ -147,6 +147,6 @@ describe('Drawer', () => {
};
const { container } = render(<RefDemo />);
fireEvent.click(container.querySelector('a'));
expect(fn).toBeCalled();
expect(fn).toHaveBeenCalled();
});
});

View File

@ -23,11 +23,11 @@ describe('InputNumber', () => {
const onStep = jest.fn();
const { container } = render(<InputNumber defaultValue={1} onStep={onStep} />);
fireEvent.mouseDown(container.querySelector('.ant-input-number-handler-up'));
expect(onStep).toBeCalledTimes(1);
expect(onStep).toHaveBeenCalledTimes(1);
expect(onStep).toHaveBeenLastCalledWith(2, { offset: 1, type: 'up' });
fireEvent.mouseDown(container.querySelector('.ant-input-number-handler-down'));
expect(onStep).toBeCalledTimes(2);
expect(onStep).toHaveBeenCalledTimes(2);
expect(onStep).toHaveBeenLastCalledWith(1, { offset: 1, type: 'down' });
});

View File

@ -19,6 +19,6 @@ describe('prefix', () => {
const mockFocus = jest.spyOn(container.querySelector('input'), 'focus');
fireEvent.mouseUp(container.querySelector('i'));
expect(mockFocus).toBeCalled();
expect(mockFocus).toHaveBeenCalled();
});
});

View File

@ -380,7 +380,7 @@ describe('Input allowClear', () => {
fireEvent.mouseUp(container.querySelector('.ant-input-clear-icon')!);
fireEvent.focus(container.querySelector('.ant-input-clear-icon')!);
fireEvent.click(container.querySelector('.ant-input-clear-icon')!);
expect(onBlur).not.toBeCalled();
expect(onBlur).not.toHaveBeenCalled();
unmount();
});

View File

@ -512,7 +512,7 @@ describe('TextArea allowClear', () => {
fireEvent.mouseUp(container.querySelector('.ant-input-clear-icon'));
fireEvent.focus(container.querySelector('.ant-input-clear-icon'));
fireEvent.click(container.querySelector('.ant-input-clear-icon'));
expect(onBlur).not.toBeCalled();
expect(onBlur).not.toHaveBeenCalled();
unmount();
});

View File

@ -726,7 +726,7 @@ describe('Modal.confirm triggers callbacks correctly', () => {
});
expect($$(`.ant-modal-confirm-${type}`)).toHaveLength(0);
expect(mock).toBeCalledWith(expect.any(Function));
expect(mock).toHaveBeenCalledWith(expect.any(Function));
jest.useRealTimers();
});
@ -764,7 +764,7 @@ describe('Modal.confirm triggers callbacks correctly', () => {
});
expect($$(`.ant-modal-confirm-${type}`)).toHaveLength(0);
expect(mock).toBeCalledWith(expect.any(Function));
expect(mock).toHaveBeenCalledWith(expect.any(Function));
jest.useRealTimers();
});
@ -796,7 +796,7 @@ describe('Modal.confirm triggers callbacks correctly', () => {
});
expect($$(`.ant-modal-confirm-${type}`)).toHaveLength(0);
expect(mock).toBeCalledWith(expect.any(Function));
expect(mock).toHaveBeenCalledWith(expect.any(Function));
jest.useRealTimers();
});
@ -823,7 +823,7 @@ describe('Modal.confirm triggers callbacks correctly', () => {
await sleep();
});
expect(mock).toBeCalledWith(expect.any(Function));
expect(mock).toHaveBeenCalledWith(expect.any(Function));
jest.useRealTimers();
});

View File

@ -101,7 +101,7 @@ describe('Segmented', () => {
).toBeTruthy();
fireEvent.click(container.querySelectorAll(`.${prefixCls}-item-input`)[2]);
expect(handleValueChange).toBeCalledWith('Monthly');
expect(handleValueChange).toHaveBeenCalledWith('Monthly');
expectMatchChecked(container, [false, false, true]);
});
@ -115,7 +115,7 @@ describe('Segmented', () => {
expectMatchChecked(container, [true, false, false, false, false]);
fireEvent.click(container.querySelectorAll(`.${prefixCls}-item-input`)[4]);
expect(handleValueChange).toBeCalledWith(5);
expect(handleValueChange).toHaveBeenCalledWith(5);
expectMatchChecked(container, [false, false, false, false, true]);
});
@ -132,7 +132,7 @@ describe('Segmented', () => {
expectMatchChecked(container, [true, false, false]);
fireEvent.click(container.querySelectorAll(`.${prefixCls}-item-input`)[1]);
expect(handleValueChange).toBeCalledWith('Weekly');
expect(handleValueChange).toHaveBeenCalledWith('Weekly');
expectMatchChecked(container, [false, true, false]);
});
@ -154,13 +154,13 @@ describe('Segmented', () => {
expect(container.querySelectorAll(`.${prefixCls}-item-input`)[1]).toHaveAttribute('disabled');
fireEvent.click(container.querySelectorAll(`.${prefixCls}-item-input`)[1]);
expect(handleValueChange).not.toBeCalled();
expect(handleValueChange).not.toHaveBeenCalled();
expectMatchChecked(container, [true, false, false]);
fireEvent.click(container.querySelectorAll(`.${prefixCls}-item-input`)[2]);
expect(handleValueChange).toBeCalledWith('Monthly');
expect(handleValueChange).toBeCalledTimes(1);
expect(handleValueChange).toHaveBeenCalledWith('Monthly');
expect(handleValueChange).toHaveBeenCalledTimes(1);
expectMatchChecked(container, [false, false, true]);
});
@ -180,12 +180,12 @@ describe('Segmented', () => {
).toBeTruthy();
fireEvent.click(container.querySelectorAll(`.${prefixCls}-item-input`)[1]);
expect(handleValueChange).not.toBeCalled();
expect(handleValueChange).not.toHaveBeenCalled();
expectMatchChecked(container, [true, false, false]);
fireEvent.click(container.querySelectorAll(`.${prefixCls}-item-input`)[2]);
expect(handleValueChange).not.toBeCalled();
expect(handleValueChange).not.toHaveBeenCalled();
expectMatchChecked(container, [true, false, false]);
});
@ -284,7 +284,7 @@ describe('Segmented', () => {
).toBeTruthy();
fireEvent.click(container.querySelectorAll(`.${prefixCls}-item-input`)[2]);
expect(handleValueChange).toBeCalledWith('Satellite');
expect(handleValueChange).toHaveBeenCalledWith('Satellite');
expectMatchChecked(container, [false, false, true]);
@ -293,7 +293,7 @@ describe('Segmented', () => {
// change selection again
fireEvent.click(container.querySelectorAll(`.${prefixCls}-item-input`)[1]);
expect(handleValueChange).toBeCalledWith('Transit');
expect(handleValueChange).toHaveBeenCalledWith('Transit');
expectMatchChecked(container, [false, true, false]);

View File

@ -2400,7 +2400,7 @@ describe('Table.filter', () => {
data: tableData,
}),
);
expect(errorSpy).not.toBeCalled();
expect(errorSpy).not.toHaveBeenCalled();
errorSpy.mockReset();
columns[0].filteredValue = [];
render(
@ -2409,7 +2409,7 @@ describe('Table.filter', () => {
data: tableData,
}),
);
expect(errorSpy).toBeCalledWith(
expect(errorSpy).toHaveBeenCalledWith(
'Warning: [antd: Table] Columns should all contain `filteredValue` or not contain `filteredValue`.',
);
errorSpy.mockReset();
@ -2420,7 +2420,7 @@ describe('Table.filter', () => {
data: tableData,
}),
);
expect(errorSpy).not.toBeCalled();
expect(errorSpy).not.toHaveBeenCalled();
});
// Warning: An update to Item ran an effect, but was not wrapped in act(...).

View File

@ -540,7 +540,7 @@ describe('Table.pagination', () => {
);
fireEvent.mouseDown(container.querySelector('.ant-select-selector'));
fireEvent.click(container.querySelectorAll('.ant-select-item-option')[2]);
expect(onChange).toBeCalledTimes(1);
expect(onChange).toHaveBeenCalledTimes(1);
});
it('dynamic warning', () => {

View File

@ -248,7 +248,7 @@ describe('Table', () => {
},
];
render(<Table columns={columns} rowKey={(record, index) => record + index} />);
expect(warnSpy).toBeCalledWith(
expect(warnSpy).toHaveBeenCalledWith(
'Warning: [antd: Table] `index` parameter of `rowKey` function is deprecated. There is no guarantee that it will work as expected.',
);
});
@ -262,7 +262,7 @@ describe('Table', () => {
},
];
render(<Table columns={columns} rowKey={record => record.key} />);
expect(warnSpy).not.toBeCalled();
expect(warnSpy).not.toHaveBeenCalled();
});
it('should support ref', () => {
@ -279,6 +279,6 @@ describe('Table', () => {
return <Table ref={ref} columns={columns} />;
};
render(<Wrapper />);
expect(warnSpy).not.toBeCalled();
expect(warnSpy).not.toHaveBeenCalled();
});
});

View File

@ -214,7 +214,7 @@ describe('Directory Tree', () => {
const onDoubleClick = jest.fn();
const { container } = render(createTree({ onDoubleClick }));
fireEvent.doubleClick(container.querySelector('.ant-tree-node-content-wrapper'));
expect(onDoubleClick).toBeCalled();
expect(onDoubleClick).toHaveBeenCalled();
});
it('should not expand tree now when pressing ctrl', () => {

View File

@ -219,7 +219,7 @@ describe('Typography copy', () => {
</div>,
);
fireEvent.click(wrapper.querySelectorAll('.ant-typography-copy')[0]);
expect(onDivClick).not.toBeCalled();
expect(onDivClick).not.toHaveBeenCalled();
});
it('the first parameter of onCopy is the click event', () => {

View File

@ -824,7 +824,7 @@ describe('Upload List', () => {
const btn = wrapper.querySelector('.ant-btn');
expect(btn.getAttribute('title')).toBe('Download file');
fireEvent.click(btn);
expect(downloadFunc).toBeCalled();
expect(downloadFunc).toHaveBeenCalled();
unmount();
});

View File

@ -218,7 +218,7 @@
"eslint-plugin-babel": "^5.3.0",
"eslint-plugin-compat": "^4.0.0",
"eslint-plugin-import": "^2.21.1",
"eslint-plugin-jest": "^26.4.0",
"eslint-plugin-jest": "^27.0.1",
"eslint-plugin-jsx-a11y": "^6.2.1",
"eslint-plugin-markdown": "^3.0.0",
"eslint-plugin-react": "^7.28.0",