Last active
August 29, 2015 14:27
-
-
Save asci/128b2787af092d3acb68 to your computer and use it in GitHub Desktop.
angular $q is not working in test env
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var inject = angular.mock.inject; | |
var $q; | |
describe('$q is really strange', function (){ | |
beforeEach(inject(function ($injector){ | |
$q = $injector.get('$q'); | |
})); | |
it('should proof that q is working properly', function (done){ | |
var lastRequest = $q.defer(); | |
setTimeout(function (){ | |
lastRequest.resolve('my-value'); | |
}, 300); | |
lastRequest.promise | |
.then(iAmDone); | |
function iAmDone(val) { | |
console.log('======================resolved val======================'); | |
console.log(val); | |
done(); | |
} | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment