I'm trying to test out my API using FrisbyJS (which sits on top of Jasmine for Node). I was wondering if anyone knew how to submit/send an image using Jasmine?
My current code is...
var frisby = require('frisby');
var URL = 'http://localhost/api';
frisby.globalSetup({
request: {
headers: {
'Content-Type': 'application/x-www-form-urlencoded',
'Accept': 'application/json',
'api': 'key'
}
},
timeout: (30 * 1000)
});
frisby.create('submit an image')
.post(URL + 'image', {images: '@test.jpg'}, {method: 'POST'})
.expectStatus(200)
.afterJSON(function(cart){
console.log('made it!');
})
}).toss();
And I get the following error:
1) Frisby Test: submit an image
[ POST http://localhost/api ]
Message:
timeout: timed out after 30000 msec waiting for HTTP Request timed out before completing
Stacktrace:
undefined
Finished in 31.458 seconds
And yes, the image test.jpg does exist in the same folder :) as the spec file and where I'm executing the spec itself (jasmine-node .).