开发者

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);
    });
};
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜