First test for the secureStorageService.
This commit is contained in:
parent
522a7cd3cf
commit
da9559433f
1 changed files with 49 additions and 0 deletions
49
src/js/services/secureStorageService.spec.js
Normal file
49
src/js/services/secureStorageService.spec.js
Normal file
|
|
@ -0,0 +1,49 @@
|
||||||
|
describe('secureStorageService on desktop', function(){
|
||||||
|
var desktopSss,
|
||||||
|
sss;
|
||||||
|
|
||||||
|
beforeEach(function(){
|
||||||
|
module('ngLodash');
|
||||||
|
module('copayApp.services');
|
||||||
|
|
||||||
|
desktopSss = {
|
||||||
|
get: jasmine.createSpy(),
|
||||||
|
set: jasmine.createSpy()
|
||||||
|
};
|
||||||
|
|
||||||
|
platformInfoStub = {
|
||||||
|
isNW: true
|
||||||
|
};
|
||||||
|
|
||||||
|
module(function($provide) {
|
||||||
|
$provide.value('desktopSecureStorageService', desktopSss);
|
||||||
|
//$provide.value('$log', log); // Handy for debugging test failures
|
||||||
|
$provide.value('platformInfo', platformInfoStub);
|
||||||
|
});
|
||||||
|
|
||||||
|
inject(function($injector){
|
||||||
|
sss = $injector.get('secureStorageService');
|
||||||
|
});
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
it('get succeeds', function() {
|
||||||
|
var error, key, result;
|
||||||
|
|
||||||
|
desktopSss.get.and.callFake(function(k, cb){
|
||||||
|
key = k;
|
||||||
|
cb(null, 'The result 1.');
|
||||||
|
});
|
||||||
|
|
||||||
|
sss.get('a123', function(e, res) {
|
||||||
|
error = e;
|
||||||
|
result = res;
|
||||||
|
});
|
||||||
|
|
||||||
|
expect(error).toBeFalsy();
|
||||||
|
expect(result).toBe('The result 1.');
|
||||||
|
expect(key).toBe('a123');
|
||||||
|
});
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue