Merge "Increase test coverage: Add unit tests to the login module part 1"
[dlux.git] / modules / common-login-resources / src / main / resources / login / login.spec.js
1 define(['common/login/login.controller'], function() {
2   describe('Login Module', function() {
3     var scope, state, controller, AuthMock;
4
5     beforeEach(module('ui.router'));
6     beforeEach(module('app.common.login', function($provide) {
7       AuthMock = jasmine.createSpyObj('AuthMock', ['isAuthed']);
8       $provide.value('Auth', AuthMock);
9     }));
10
11     beforeEach(inject( function($rootScope, $controller, $state) {
12       scope = $rootScope.$new();
13       controller = $controller;
14       state = $state;
15     }));
16
17     it('Should load the login state', function() {
18       var stateName = 'login';
19
20       controller('LoginCtrl', {$scope: scope, $state: state});
21       expect(state.href(stateName, {})).toBe('#/login');
22     });
23   });
24 });