When attempting to test a function that returns a promise, I encounter the following error:
"Error: Timeout - Async callback was not invoked within the timeout specified by jasmine.DEFAULT_TIMEOUT_INTERVAL.
"
The specification I am using is as follows:
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();
})
})
})
})
});
Please refer to the provided plunker link for the complete code sample. Plunker Link