For Jasmine unit testing when I call processDeviceConversionReq(), Internally it will call three ajax call and further process on these three responses(ie. jsp1,jsp2,jsonResponse).
So, how can I stub the responses in this condition.
I have the instance of ajax as :
spyOn($,"ajax").and.callFake(function(e) {
});
function processDeviceConversionReq(lrdSkuMap){
.
.
$.when(getsubmitProgressBarJsp(), getDeviceConvertCompleteJsp(), initiateDeviceConversionService(serviceUrl,header,conversionPayload,"POST")).done(function(jsp1,jsp2,jsonResponse){…}
.
.
}
1. function getsubmitProgressBarJsp()
{
return $.ajax({
type : "POST",
url : "submitProgressBar",
timeout : 1000 * 60 * 5,
cache : false,
error : function() {
},
success : function(jsp1) {
return true;
}
});
}
2. function getDeviceConvertCompleteJsp()
{
return $.ajax({
type : "POST",
url : "getDeviceConvertComplete",
timeout : 1000 * 60 * 5,
cache : false,
error : function() {
},
success : function(jsp2) {
return true;
}
});
}
3. function initiateDeviceConversionService(serviceUrl,header,conversionPayload,methodType)
{
return $.ajax({
url:serviceUrl,
type:methodType,
contentType:'application/json',
headers:header,
data:JSON.stringify(conversionPayload),
dataType:'json',
error : function() {
},
success : function(responseData)
{
return true;
}
});
}
--
You received this message because you are subscribed to the Google Groups "Jasmine" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jasmine-js+...@googlegroups.com.
To post to this group, send email to jasmi...@googlegroups.com.
Visit this group at https://groups.google.com/group/jasmine-js.
For more options, visit https://groups.google.com/d/optout.
To unsubscribe from this group and stop receiving emails from it, send an email to jasmine-js+unsubscribe@googlegroups.com.