Added VaultServiceMock

Signed-off-by: fnuesse <felix.nuesse@t-online.de>
This commit is contained in:
fnuesse 2018-11-20 20:39:42 +01:00
parent 7fedb24b9c
commit da37e56e53
No known key found for this signature in database
GPG key ID: 2089A3431243E819
2 changed files with 20 additions and 1 deletions

View file

@ -1,12 +1,14 @@
describe('MenuCtrl', function() {
beforeEach(module('passmanApp'));
beforeEach(module('LocalStorageModule'));
beforeEach(module('mock.vaultService'));
var $controller;
var $scope;
beforeEach(inject(function(_$controller_){
beforeEach(inject(function(_$controller_, _VaultService_){
// The injector unwraps the underscores (_) from around the parameter names when matching
$controller = _$controller_;
//$controller.VaultService= _VaultService_;
}));
beforeEach(inject(function($rootScope) {
$scope = $rootScope.$new();

View file

@ -0,0 +1,17 @@
angular.module('mock.vaultService', []).
service('VaultService', function($q) {
var vaultService = {};
var settings = {};
vaultService.getVaultSetting = function (key, default_value) {
if (settings[key]) {
return $q.when(settings[key]);
} else {
return $q.when(default_value);
}
};
vaultService.setVaultSetting = function (key, value) {
settings[key]=value;
};
return vaultService;
});