2015-12-12 20:08:48 +00:00
|
|
|
'use strict';
|
2015-06-29 22:51:29 +00:00
|
|
|
|
2015-12-12 20:08:48 +00:00
|
|
|
(function() {
|
|
|
|
describe('HeaderController', function() {
|
|
|
|
//Initialize global variables
|
|
|
|
var scope,
|
|
|
|
HeaderController;
|
2015-06-29 22:51:29 +00:00
|
|
|
|
2017-10-29 18:54:40 +00:00
|
|
|
var sampleUser = {
|
|
|
|
firstName: 'Full',
|
|
|
|
lastName: 'Name',
|
|
|
|
email: 'test@test.com',
|
|
|
|
username: 'test@test.com',
|
|
|
|
language: 'en',
|
|
|
|
password: 'password',
|
|
|
|
provider: 'local',
|
|
|
|
roles: ['user'],
|
|
|
|
_id: 'ed873933b1f1dea0ce12fab9'
|
|
|
|
};
|
|
|
|
|
2015-12-12 20:08:48 +00:00
|
|
|
// Load the main application module
|
|
|
|
beforeEach(module(ApplicationConfiguration.applicationModuleName));
|
2015-06-29 22:51:29 +00:00
|
|
|
|
2017-10-29 18:54:40 +00:00
|
|
|
//Mock Authentication Service
|
|
|
|
beforeEach(module(function($provide) {
|
|
|
|
$provide.service('Auth', function() {
|
|
|
|
return {
|
|
|
|
ensureHasCurrentUser: function() {
|
|
|
|
return sampleUser;
|
|
|
|
},
|
|
|
|
isAuthenticated: function() {
|
|
|
|
return true;
|
|
|
|
},
|
|
|
|
getUserState: function() {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
});
|
|
|
|
}));
|
|
|
|
|
2015-12-12 20:08:48 +00:00
|
|
|
beforeEach(inject(function($controller, $rootScope) {
|
|
|
|
scope = $rootScope.$new();
|
2015-06-29 22:51:29 +00:00
|
|
|
|
2015-12-12 20:08:48 +00:00
|
|
|
HeaderController = $controller('HeaderController', {
|
|
|
|
$scope: scope
|
|
|
|
});
|
|
|
|
}));
|
2015-06-29 22:51:29 +00:00
|
|
|
|
2015-12-12 20:08:48 +00:00
|
|
|
it('should expose the authentication service', function() {
|
|
|
|
expect(scope.authentication).toBeTruthy();
|
|
|
|
});
|
|
|
|
});
|
|
|
|
})();
|