Closed zjhou closed 3 years ago
Windows 10 & jsdom
jest 的测试用例中模拟图片上传,运行用例时报错。(cjs 目录下的工具函数 getUploadPlaceholder,uuid is not a function)
用例
it('should throw error after upload file if upload props is missing', () => { expect(() => { const onChange = jest.fn(); const wrapper = mount(<MarkdownEditor onChange={onChange} />); const file = new File([fileContents], 'test.png', { type: 'image/png'}) wrapper .find('.button-type-image > input') .simulate('change', { target: { files: [file] } }); }).toThrowError('uploadProps is not found'); });
报错信息
相关 bug:https://github.com/HarryChen0506/react-markdown-editor-lite/issues/230
fixed
OS and browser
Windows 10 & jsdom
Description
jest 的测试用例中模拟图片上传,运行用例时报错。(cjs 目录下的工具函数 getUploadPlaceholder,uuid is not a function)
用例
报错信息