當我試圖測試,它返回一個承諾,我得到以下錯誤的函數:茉莉2.0測試angularjs工廠方法返回一個承諾
"Error: Timeout - Async callback was not invoked within timeout specified by jasmine.DEFAULT_TIMEOUT_INTERVAL.
「
我的規格如下:
describe('async promise test', function() {
beforeEach(module('app'));
beforeEach(function() {
jasmine.DEFAULT_TIMEOUT_INTERVAL = 6 * 1000;
})
it('should match the name', function (done) {
inject(function ($rootScope,promiseTest) {
$rootScope.$apply(function(){
var promise =promiseTest.checkPromise();
promise.then(function(data){
console.log(data);
done();
})
})
})
})
});
請檢查plunker鏈接的完整代碼plunker link
嘿卡爾,其實我試圖測試索引數據庫,它不按預期工作....鏈接:http://plnkr.co/edit/dSdapvqTgR7qPeZC0umT?p=preview – 2015-02-11 08:13:49