I have this function :
viewModel.prototype.save = function(){
$.ajax({
url: "/vacation_booking/save",
//dataType: "json",
type: "POST",
data: "idUser=" + this.idUser() + "&name=" + this.name() + "&lastName=" + this.lastName() + "&age=" + this.age(),
success: function (data){
$('#info').html(data);
$('#info').show(function(){
$(this).fadeOut(5000);
});
},
failure: function(){
alert("Unsuccessful");
}
});
}
how can i test the success and error functions in this case?
i've seen some examples of callback testing with jasmine in other stackoverflow questions but in all the examples the function that they were testing received the callback function as a parameter as you can see here: