my function in the service is
listo: function () {
var deferred = $q.defer();
setTimeout(function () {
deferred.resolve(true);
}, 2000);
return deferred.promise;
}
in jasmine test I have
describe("testeando local storage", function () {
var bd;
beforeEach(module('modulo'));
beforeEach(inject(function (bds) {
bd = bds;
}));
beforeEach(function () {
expect(bd).toBeDefined();
});
var valor;
it("prueba",function(done){
bd.listo().then(function(res) {
valor = res;
done();
})
});
it("pruebita", function(done) {
expect(valor).toBe(true);
done();
});
});
I got the following error:
Error: Timeout - Async callback was not invoked within timeout specified by jasmine.DEFAULT_TIMEOUT_INTERVAL.
PhantomJS 2.1.1 (Linux 0.0.0) testeando local storage should support async execution of test preparation and expectations FAILED Expected undefined to be true.