Slide 159
Slide 159 text
[...]
testOnSuccessCallback: function(){! !
var server = sinon.useFakeServer();
server.respondWith("GET", "/art/12/comments.json",
[200, {"Content-Type":"application/json"},
"[{ id:12, text:'Hello'}]"]);
! ! var spy = sinon.spy();
! ! myLib.getCommentsFor("/art/12", spy);
! ! server.respond();
! ! assert(spy.calledWith([{ id:12, text:"Hello"}]));
! },
[...]
AJAX CALL