mirror of
https://github.com/nextcloud/passman.git
synced 2024-09-20 14:56:21 +08:00
Added VaultServiceMock
Signed-off-by: fnuesse <felix.nuesse@t-online.de>
This commit is contained in:
parent
7fedb24b9c
commit
da37e56e53
|
@ -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();
|
||||
|
|
17
tests/unit/js/mocks/VaultService.js
Normal file
17
tests/unit/js/mocks/VaultService.js
Normal 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;
|
||||
});
|
Loading…
Reference in a new issue