How to mock $xhr with Jack?
I have a function like:
function Aoeu($xhr) {
$xhr('GET', '/url', function(code, response) {});
};
How do I crea开发者_开发技巧te with Jack a $xhr mock that's to be passed into Aoeu()?
The following says that the mock is an object, not a function (which makes sense):
AoeuTest.prototype.testAoeu = function() {
jack(function() {
var xhrStub = jack.create('$xhr', ['']);
// jack.expect('$xhr');
var aoeu = new Aoeu(xhrStub);
});
};
精彩评论