I have hit a strange thing when trying to test a service returning ordinary $q promise. No promise I try in any test is actually being ever resolved/rejected (more specifically handlers from then
are not called, code inside promise runs just fine). I even tried forcing digest on a root scope, as some other answers on SO suggested, without any luck.
Here is a small self-contained example:
describe('promise', function(){
jasmine.DEFAULT_TIMEOUT_INTERVAL = 500;
let q;
beforeEach(inject(function($q){
q = $q;
}));
it('finishes', function(done){
expect(q).toBeDefined();
const promise = q.resolve();
console.log(promise);
promise.then(
() => done(),
() => done.fail()
);
});
});
What do I have to do to get the promise work as expected?