1
有人可以幫我理解爲什麼這不起作用嗎?我正在使用Jasmine的both
函數來等待promise.then函數也被調用併發出一個斷言。但它在被調用之前超時。
describe('greeting', function(){
var greeting = 'hello';
it('should call promise.then', function(done) {
inject(function ($q) {
var deferred = $q.defer();
deferred.resolve(greeting);
deferred.promise.then(function (greeting) {
expect(greeting).toEqual('hello');
done();
});
});
});
});
的then
功能不被調用和Jasmine超時此消息:
Error: Timeout - Async callback was not invoked within timeout specified by jasmine.DEFAULT_TIMEOUT_INTERVAL.
謝謝!這解決了這個問題。 – 2achary