How to test file upload with Jasmine BDD
I'm using jQuery file upload plugin for managing image file uploads. What will be the right way to test image submission with Jasmine. I would take a look at using the helper library Sinon.js. You can mock the XMLHttpRequest object to intercept the post request, and verify that your plugin code is submitting images correctly. In particular, take a look at this part of the Sinon.js documentation: http://sinonjs.org/docs/#server 来源: https://stackoverflow.com/questions/10673001/how-to-test-file-upload-with-jasmine-bdd