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不是函數「
任何想法我在這裏錯過了什麼?
奏效!謝謝 –