Mocking dependencies when unit testing AngularJS services with QUnit
e.g. I'm unsure when it's common to prefix variables with a $


A quick Google and I found a StackOverflow thread about this, 

The accepted answer had this to say:


  It's a common reference to a jQuery wrapped object. It makes reading the code easier to know which variables are jQuery wrapped.


I would say that you don't need to use $ prefix in your code at all, at least what you have posted.



If you were using $scope that would be different as noted by this answer


  $scope variables bind to the view where as var does not and is local to the function it was declared in!




also noted in the comments


  The $ prefix is used as a naming convention identifying native AngularJS services


▼▼▼


  Do not use $ to prepend your own object properties and service identifiers. Consider this style of naming reserved by AngularJS and jQuery.


From Google's AngularJS Style Guide