How to unit test with a file upload in mocha

后端 未结 7 1199
走了就别回头了
走了就别回头了 2020-12-14 15:11

I have an app built on Express.js and I\'d like to test the file upload functionality. I\'m trying to reproduce the object parsed to req.files (when using express.bodyParser

7条回答
  •  太阳男子
    2020-12-14 15:42

    You might try using zombie.js https://github.com/assaf/zombie , it creates a virtual browser for testing with basic functionality. It can attach a file to a specific input field and supports cookies and sessions

    related gist : https://gist.github.com/764536

提交回复
热议问题