angularjs - how to test service property call -


here temp.js

angular.module('temp', [])     .service('tempfactory', function() {         this.a = 10;     })     .controller('tempctrl', function($scope, tempfactory) {         $scope.a = tempfactory.a;     }); 

and here temp.spec.js

describe('temp', function() {     var ctrl, scope;      beforeeach(function() {         module('temp');          inject(function($rootscope, $controller) {             scope = $rootscope.new();             ctrl = $controller('tempctrl', {$scope: scope});         });     }); }); 

i know test service method call necessary use spy. how test service property call(in code $scope.a = tempfactory.a;)? how can find out property of service called?

write spec tests value on scope. no spy needed. write effect of:

it('sets expected value service', function () {   expect(scope.a).tobe(10); }); 

Comments

Popular posts from this blog

facebook - android ACTION_SEND to share with specific application only -

python - Creating a new virtualenv gives a permissions error -

javascript - cocos2d-js draw circle not instantly -