I use Jack as a fake JavaScript library. http://github.com/keronsen/jack . I also use qunit.
I have the following AJAX call in my javascript code that I am trying to write for a test.
$.ajax({
url: $('#advance_search_form').attr('action'),
type: 'post',
dataType: 'json',
data: parameterizedData,
success: function(json) {
APP.actOnResult.successCallback(json);
}
});
The following code works.
jack(function() {
jack.expect('$.ajax').exactly('1 time');
}
However, I want to check if all arguments are correctly presented. I tried to follow but did not work.
jack.expect('$.ajax').exactly('1 time').whereArgument(0).is(function(){
var args = arguments; ok (' http: // localhost: 3000 / users ', args.url, 'url must be valid'); // a similar test for many keys of an object});
I want to get arguments so that I can run a test battery.
source
share