test: fix codecov 100% (#28892)

This commit is contained in:
偏右 2021-01-16 18:06:26 +08:00 committed by GitHub
parent 005627e4a4
commit 9daf50f3a9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 5 additions and 7 deletions

View File

@ -1,4 +1,4 @@
name: test
name: test
on: [push, pull_request]

View File

@ -183,17 +183,13 @@ const InternalUpload: React.ForwardRefRenderFunction<unknown, UploadProps> = (pr
if (removedFileList) {
currentFile = { ...file, status: 'removed' };
fileList?.some(item => {
fileList?.forEach(item => {
const matchKey = currentFile.uid !== undefined ? 'uid' : 'name';
if (item[matchKey] === currentFile[matchKey]) {
item.status = 'removed';
return true;
}
return false;
});
if (upload.current) {
upload.current.abort(currentFile);
}
upload.current?.abort(currentFile);
onInternalChange({
file: currentFile,

View File

@ -350,6 +350,7 @@ describe('Upload', () => {
const targetItem = removeFileItem(file, fileList);
expect(targetItem).toEqual(fileList.slice(0, 2));
});
it('should not be able to remove fileItem', () => {
const file = { uid: '-3', name: 'item.jpg' };
const fileList = [

View File

@ -494,6 +494,7 @@ describe('Upload List', () => {
);
expect(wrapper.render()).toMatchSnapshot();
});
it('should support custom onClick in custom icon', async () => {
const handleRemove = jest.fn();
const handleChange = jest.fn();