Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 934
Warwick Avatar asked Nov 03 '22 23:11

Warwick


1 Answers

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

like image 51
sethmcl Avatar answered Nov 09 '22 11:11

sethmcl