refactor password param
This commit is contained in:
parent
8d53fa82ed
commit
2bc1945309
3 changed files with 5 additions and 2 deletions
|
|
@ -22,8 +22,10 @@ describe('Storage model', function() {
|
||||||
it('should fail when encrypting without a password', function() {
|
it('should fail when encrypting without a password', function() {
|
||||||
var s2 = new Storage(requireMock('FakeLocalStorage').storageParams);
|
var s2 = new Storage(requireMock('FakeLocalStorage').storageParams);
|
||||||
(function() {
|
(function() {
|
||||||
s2._write(fakeWallet + timeStamp, 1, function() {});
|
var params = _.clone(require('./mocks/FakeLocalStorage').storageParams);
|
||||||
}).should.throw('NOPASSPHRASE');
|
params.password = undefined;
|
||||||
|
new Storage(params);
|
||||||
|
}).should.throw('Illegal Argument');
|
||||||
});
|
});
|
||||||
it('should be able to encrypt and decrypt', function(done) {
|
it('should be able to encrypt and decrypt', function(done) {
|
||||||
s._write(fakeWallet + timeStamp, 'value', function() {
|
s._write(fakeWallet + timeStamp, 'value', function() {
|
||||||
|
|
|
||||||
|
|
@ -28,6 +28,7 @@ FakeLocalStorage.prototype.clear = function() {
|
||||||
module.exports = FakeLocalStorage;
|
module.exports = FakeLocalStorage;
|
||||||
|
|
||||||
module.exports.storageParams = {
|
module.exports.storageParams = {
|
||||||
|
password: '123',
|
||||||
storage: new FakeLocalStorage(),
|
storage: new FakeLocalStorage(),
|
||||||
sessionStorage: new FakeLocalStorage(),
|
sessionStorage: new FakeLocalStorage(),
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue