0
angular.module('conceptSet')
      .directive('conceptSet', ['contextChangeHandler',function(){
         var object=new Concept();
         var init = function () {
              return  conceptService.getConcept({
                    name: conceptName
                }).then(function (response) {
                 $scope.obs=$scope.set?object.method():null;

        }

      }]);

I want mock "object" variable in jasmine or mock the new instance of Concept.how to mock this or is there any passible mock or stub on object.method?

salauddin
  • 113
  • 8
  • 1
    Possible duplicate of [How do I mock local variable for a function in a service? Jasmine/Karma tests](http://stackoverflow.com/questions/26938842/how-do-i-mock-local-variable-for-a-function-in-a-service-jasmine-karma-tests) – Thalaivar Nov 02 '16 at 11:46
  • As the dupe suggests, no you can't do that. It follows logically, as well - a _local_ property shouldn't really be reachable from the outside so "mocking it" is nonsensical. If you _have_ to do that it suggest either the test is not scoped correctly and it tests the wrong thing or that the design is incorrect. – VLAZ Nov 02 '16 at 11:50
  • After update: the answer is still "no". Refer to my previous comment, it still applies. – VLAZ Nov 02 '16 at 11:55

0 Answers0