Skip to content

Instantly share code, notes, and snippets.

@lukasz-kaniowski
Last active December 16, 2015 08:09
Show Gist options
  • Save lukasz-kaniowski/5403633 to your computer and use it in GitHub Desktop.
Save lukasz-kaniowski/5403633 to your computer and use it in GitHub Desktop.
angular js testing promises
// incject
inject(function(_$rootScope_, _$controller_, _$q_, _$injector_) {...}
// when
when(function(){
deferred.resolve({model: 'balba'});
$rootScope.$digest();
})
function MockService() {
return {
get: function() {
deferred = $q.defer();
return deferred.promise;
}
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment