How to unit test for upload component #9010
Unanswered
swimhiking
asked this question in
Q&A
Replies: 2 comments
-
@swimhiking |
Beta Was this translation helpful? Give feedback.
0 replies
-
Same here, my test coverage for upload component is 91.3% i just need to assert the CustomRequest and action props. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi there,
I have an ant upload component with customRequest in upload props , unit test haven't run this part. How to do the unit test with react test library? below is code example, code runs as expected, only stuck on the unit test part.
const customProps = {
name:'test',
action:'http://api/url/',
customRequest: async (option: UploadRequestOption)=>{
retrun customized-function(option.action, {
name:"testname"}).then(option.onSuccess(data)).catch(err=>err)
},
beforeUpload: (file:RcFile)=>{ //check specific file},
onChange: ()=>{//change function}
}
<Upload {...customProps}>
so how to test above customProps code part? Thank you very much!
Allen
Allen
Beta Was this translation helpful? Give feedback.
All reactions