I am trying to figure out how to test this javascript function aduequately using qunit and mockjax
My javascript is set up with the revealing module pattern, im new to unit testing so this is kind of driving me up a wall
my.someMethod = function (someId, completedHandler) {
$.ajax({
dataType: "json",
url: my.someUrl,
traditional: true,
data: {
someId : someId
},
success: function () {
if (completedHandler !== undefined) {
completedHandler();
}
}
});
};
Like i want to test if the correct url is being used, if the id being passed in is the right one, making sure the ajax is being called etc.