0
我的JS文件:
case "launch": helper.urlLaunch("http://www.google.com").then(function(){start();});
urlLaunch的定义
urlLaunch: function (url) {
//...
return $q.when();
},
单元测试
it("should test helper launch url", function() {
spyOn(helper, "urlLaunch").and.callFake(function(){});
mySvc.purchase(Url: PURCHASE_URL }); //this calls the "launch" case given above
$httpBackend.flush();
expect(helper.urlLaunch).toHaveBeenCalled();
});
但是,这给了我一个错误“键入e rror:plan.apply不是函数“
任何想法我在这里错过了什么?
奏效!谢谢 –