Hi everybody,

I'm in a process of building my first Angular application.

In most of my controllers I have a seperation between 2 kinds of data:
I put data & functions that get accessed from the HTML and other 
controllers on the $scope.
On the other hand when I declare function and data that is being used only 
inside the controller itself I use the var keyword because it seems 
unnecessary to keep this data on the scope.

My main problem is that I can't unit test the data that was declared with 
VAR inside of a controller.

*Sample Controller:*

function myController($scope)
{

var arrElements = {};

function insideFunction() { ... } ;

}

I'm using Jasmine for unit testing and I want to know what is the best 
practise to test "private" variables inside of the controller.
The only solution that we thought about is to put all the "private" data on 
the $scope or on the this. object but it seems kind of weird to hold 
temporary data on some object just for the sake of unit testing.

I would like to know if you have some suggestions that may help me solve 
the unit testing problems.

Thanks,
Misha.

-- 
You received this message because you are subscribed to the Google Groups 
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to