Stub the busboy library `on` method using sinon, mocha, chai

Viewed 27

I am trying to stub the busboy on method using mocha, I am unable to find the way out.

"busboy": "^1.4.0" // busboy version used

const busBoy = busboy({ 
   headers: {"content:type":"multipart/form-data; boundary=----WebKitFormBoundaryHsAjApiShDrW2RCB"}
 });

busBoy.on("file",async (name, file, info)=>{ }); // want to stub this call

If possible please share me any other way of testing it.

0 Answers
Related