You just need to load it into your module as follows:
describe('Session', function() {
var Session;
beforeEach(module('app'));
beforeEach(inject(function(_Session_){
Session = _Session_;
});
});
module('app')returns a function, which is then called before each. The way you use it in the OP, the function created is never called.
inject- same. It should be directly inside beforeEach.
EDIT:
The above code - the usual way of doing this, but it turns out that you can also define the functions moduleand injecthow to work OP.
plunker , , . , .
:
angular
.module('app')
.factory('Session', Session);
:
angular
.module('app', [])
.factory('Session', Session);
[] , , ( ). .