mirror of https://github.com/BTCPrivate/copay.git
Merge pull request #685 from matiu/feature/deleteWallet
Feature/delete wallet
This commit is contained in:
commit
107414ec7e
|
@ -219,7 +219,6 @@ small.has-error {
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
.totalAmount {
|
.totalAmount {
|
||||||
line-height: 120%;
|
line-height: 120%;
|
||||||
margin-top:2px;
|
margin-top:2px;
|
||||||
|
|
|
@ -727,6 +727,9 @@
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="row text-center small" style="margin-top:20px">
|
||||||
|
<div class="button radius warning" ng-really-message="Are you sure to delete this wallet from this computer?" ng-really-click="deleteWallet()">Delete this wallet from this computer</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
angular.module('copayApp.controllers').controller('BackupController',
|
angular.module('copayApp.controllers').controller('BackupController',
|
||||||
function($scope, $rootScope, $location, $window, $timeout, $modal, backupService) {
|
function($scope, $rootScope, $location, $window, $timeout, $modal, backupService, walletFactory, controllerUtils) {
|
||||||
$scope.title = 'Backup';
|
$scope.title = 'Backup';
|
||||||
|
|
||||||
$scope.download = function() {
|
$scope.download = function() {
|
||||||
|
@ -19,6 +19,14 @@ angular.module('copayApp.controllers').controller('BackupController',
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
$scope.deleteWallet = function() {
|
||||||
|
var w = $rootScope.wallet;
|
||||||
|
w.disconnect();
|
||||||
|
walletFactory.delete(w.id, function() {
|
||||||
|
controllerUtils.logout();
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
var ModalInstanceCtrl = function($scope, $modalInstance) {
|
var ModalInstanceCtrl = function($scope, $modalInstance) {
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
angular.module('copayApp.controllers').controller('HeaderController',
|
angular.module('copayApp.controllers').controller('HeaderController',
|
||||||
function($scope, $rootScope, $location, $notification, $http, walletFactory, controllerUtils) {
|
function($scope, $rootScope, $location, $notification, $http, controllerUtils) {
|
||||||
$scope.menu = [
|
$scope.menu = [
|
||||||
{
|
{
|
||||||
'title': 'Addresses',
|
'title': 'Addresses',
|
||||||
|
|
|
@ -202,4 +202,23 @@ angular.module('copayApp.directives')
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
})
|
||||||
|
// From https://gist.github.com/asafge/7430497
|
||||||
|
.directive('ngReallyClick', [
|
||||||
|
|
||||||
|
function() {
|
||||||
|
return {
|
||||||
|
restrict: 'A',
|
||||||
|
link: function(scope, element, attrs) {
|
||||||
|
element.bind('click', function() {
|
||||||
|
var message = attrs.ngReallyMessage;
|
||||||
|
if (message && confirm(message)) {
|
||||||
|
scope.$apply(attrs.ngReallyClick);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
])
|
||||||
|
|
||||||
|
;
|
||||||
|
|
|
@ -98,7 +98,9 @@ WalletFactory.prototype.create = function(opts) {
|
||||||
(opts.privateKey ? ' USING PrivateKey: ' + opts.privateKey.getId() : ' NEW PrivateKey')
|
(opts.privateKey ? ' USING PrivateKey: ' + opts.privateKey.getId() : ' NEW PrivateKey')
|
||||||
);
|
);
|
||||||
|
|
||||||
opts.privateKey = opts.privateKey || new PrivateKey({ networkName: this.networkName });
|
opts.privateKey = opts.privateKey || new PrivateKey({
|
||||||
|
networkName: this.networkName
|
||||||
|
});
|
||||||
|
|
||||||
var requiredCopayers = opts.requiredCopayers || this.walletDefaults.requiredCopayers;
|
var requiredCopayers = opts.requiredCopayers || this.walletDefaults.requiredCopayers;
|
||||||
var totalCopayers = opts.totalCopayers || this.walletDefaults.totalCopayers;
|
var totalCopayers = opts.totalCopayers || this.walletDefaults.totalCopayers;
|
||||||
|
@ -154,17 +156,10 @@ WalletFactory.prototype._checkVersion = function(inVersion) {
|
||||||
|
|
||||||
WalletFactory.prototype._checkNetwork = function(inNetworkName) {
|
WalletFactory.prototype._checkNetwork = function(inNetworkName) {
|
||||||
if (this.networkName !== inNetworkName) {
|
if (this.networkName !== inNetworkName) {
|
||||||
throw new Error('This Wallet is configured for '
|
throw new Error('This Wallet is configured for ' + inNetworkName + ' while currently Copay is configured for: ' + this.networkName + '. Check your settings.');
|
||||||
+ inNetworkName
|
|
||||||
+ ' while currently Copay is configured for: '
|
|
||||||
+ this.networkName
|
|
||||||
+ '. Check your settings.'
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
WalletFactory.prototype.open = function(walletId, opts) {
|
WalletFactory.prototype.open = function(walletId, opts) {
|
||||||
opts = opts || {};
|
opts = opts || {};
|
||||||
opts.id = walletId;
|
opts.id = walletId;
|
||||||
|
@ -186,9 +181,11 @@ WalletFactory.prototype.getWallets = function() {
|
||||||
return ret;
|
return ret;
|
||||||
};
|
};
|
||||||
|
|
||||||
WalletFactory.prototype.remove = function(walletId) {
|
WalletFactory.prototype.delete = function(walletId, cb) {
|
||||||
// TODO remove wallet contents
|
var s = this.storage;
|
||||||
this.log('TODO: remove wallet contents');
|
this.log('## DELETING WALLET ID:' + walletId); //TODO
|
||||||
|
s.deleteWallet(walletId);
|
||||||
|
return cb();
|
||||||
};
|
};
|
||||||
|
|
||||||
WalletFactory.prototype.decodeSecret = function(secret) {
|
WalletFactory.prototype.decodeSecret = function(secret) {
|
||||||
|
@ -206,7 +203,9 @@ WalletFactory.prototype.joinCreateSession = function(secret, nickname, passphras
|
||||||
if (!s) return cb('badSecret');
|
if (!s) return cb('badSecret');
|
||||||
|
|
||||||
//Create our PrivateK
|
//Create our PrivateK
|
||||||
var privateKey = new PrivateKey({ networkName: this.networkName });
|
var privateKey = new PrivateKey({
|
||||||
|
networkName: this.networkName
|
||||||
|
});
|
||||||
this.log('\t### PrivateKey Initialized');
|
this.log('\t### PrivateKey Initialized');
|
||||||
var opts = {
|
var opts = {
|
||||||
copayerId: privateKey.getId(),
|
copayerId: privateKey.getId(),
|
||||||
|
|
|
@ -135,7 +135,6 @@ Storage.prototype.getWalletIds = function() {
|
||||||
|
|
||||||
Storage.prototype.getWallets = function() {
|
Storage.prototype.getWallets = function() {
|
||||||
var wallets = [];
|
var wallets = [];
|
||||||
var uniq = {};
|
|
||||||
var ids = this.getWalletIds();
|
var ids = this.getWalletIds();
|
||||||
|
|
||||||
for (var i in ids) {
|
for (var i in ids) {
|
||||||
|
@ -147,6 +146,23 @@ Storage.prototype.getWallets = function() {
|
||||||
return wallets;
|
return wallets;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Storage.prototype.deleteWallet = function(walletId) {
|
||||||
|
var toDelete = {};
|
||||||
|
toDelete['nameFor::' + walletId] = 1;
|
||||||
|
|
||||||
|
for (var i = 0; i < localStorage.length; i++) {
|
||||||
|
var key = localStorage.key(i);
|
||||||
|
var split = key.split('::');
|
||||||
|
if (split.length == 2 && split[0] === walletId) {
|
||||||
|
toDelete[key] = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (var i in toDelete) {
|
||||||
|
this.removeGlobal(i);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
//obj contains keys to be set
|
//obj contains keys to be set
|
||||||
Storage.prototype.setFromObj = function(walletId, obj) {
|
Storage.prototype.setFromObj = function(walletId, obj) {
|
||||||
for (var k in obj) {
|
for (var k in obj) {
|
||||||
|
|
|
@ -57,6 +57,7 @@
|
||||||
"cli-color": "0.3.2"
|
"cli-color": "0.3.2"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"mocha": "^1.18.2"
|
"mocha": "^1.18.2",
|
||||||
|
"mocha-lcov-reporter": "0.0.1"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,9 @@
|
||||||
|
|
||||||
var FakeStorage = function() {
|
var FakeStorage = function() {
|
||||||
|
this.reset();
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
FakeStorage.prototype.reset = function(password) {
|
||||||
this.storage = {};
|
this.storage = {};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -13,28 +17,87 @@ FakeStorage.prototype.setGlobal = function (id, payload) {
|
||||||
|
|
||||||
FakeStorage.prototype.getGlobal = function(id) {
|
FakeStorage.prototype.getGlobal = function(id) {
|
||||||
return this.storage[id];
|
return this.storage[id];
|
||||||
}
|
};
|
||||||
|
|
||||||
|
|
||||||
|
FakeStorage.prototype.removeGlobal = function(id) {
|
||||||
|
delete this.storage[id];
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
FakeStorage.prototype.set = function(wid, id, payload) {
|
FakeStorage.prototype.set = function(wid, id, payload) {
|
||||||
this.storage[wid + '-' + id] = payload;
|
this.storage[wid + '::' + id] = payload;
|
||||||
};
|
};
|
||||||
|
|
||||||
FakeStorage.prototype.get = function(wid, id) {
|
FakeStorage.prototype.get = function(wid, id) {
|
||||||
return this.storage[wid + '-' +id];
|
return this.storage[wid + '::' + id];
|
||||||
}
|
};
|
||||||
|
|
||||||
FakeStorage.prototype.clear = function() {
|
FakeStorage.prototype.clear = function() {
|
||||||
delete this['storage'];
|
delete this['storage'];
|
||||||
|
};
|
||||||
|
|
||||||
|
FakeStorage.prototype.getWalletIds = function() {
|
||||||
|
var walletIds = [];
|
||||||
|
var uniq = {};
|
||||||
|
|
||||||
|
for (var ii in this.storage) {
|
||||||
|
var split = ii.split('::');
|
||||||
|
if (split.length == 2) {
|
||||||
|
var walletId = split[0];
|
||||||
|
if (walletId !== 'nameFor' && typeof uniq[walletId] === 'undefined') {
|
||||||
|
walletIds.push(walletId);
|
||||||
|
uniq[walletId] = 1;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return walletIds;
|
||||||
|
};
|
||||||
|
|
||||||
|
FakeStorage.prototype.deleteWallet = function(walletId) {
|
||||||
|
var toDelete = {};
|
||||||
|
toDelete['nameFor::' + walletId] = 1;
|
||||||
|
|
||||||
|
for (var key in this.storage) {
|
||||||
|
var split = key.split('::');
|
||||||
|
if (split.length == 2 && split[0] === walletId) {
|
||||||
|
toDelete[key] = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (var i in toDelete) {
|
||||||
|
this.removeGlobal(i);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
FakeStorage.prototype.getName = function(walletId) {
|
||||||
|
return this.getGlobal('nameFor::' + walletId);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
FakeStorage.prototype.setName = function(walletId, name) {
|
||||||
|
this.setGlobal('nameFor::' + walletId, name);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
FakeStorage.prototype.getWallets = function() {
|
FakeStorage.prototype.getWallets = function() {
|
||||||
return [];
|
var wallets = [];
|
||||||
|
var ids = this.getWalletIds();
|
||||||
|
|
||||||
|
for (var i in ids) {
|
||||||
|
wallets.push({
|
||||||
|
id: ids[i],
|
||||||
|
name: this.getName(ids[i]),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
return wallets;
|
||||||
};
|
};
|
||||||
|
|
||||||
FakeStorage.prototype.setFromObj = function(walletId, obj) {
|
FakeStorage.prototype.setFromObj = function(walletId, obj) {
|
||||||
for (var i in obj) {
|
for (var k in obj) {
|
||||||
this.storage[walletId + '-' + i] = obj[i];
|
this.set(walletId, k, obj[k]);
|
||||||
};
|
}
|
||||||
|
this.setName(walletId, obj.opts.name);
|
||||||
};
|
};
|
||||||
|
|
||||||
module.exports = require('soop')(FakeStorage);
|
module.exports = require('soop')(FakeStorage);
|
||||||
|
|
|
@ -1,8 +1,10 @@
|
||||||
|
|
||||||
var FakeWallet = function() {
|
var FakeWallet = function() {
|
||||||
|
this.id = 'testID';
|
||||||
this.balance = 10000;
|
this.balance = 10000;
|
||||||
this.safeBalance = 1000;
|
this.safeBalance = 1000;
|
||||||
this.balanceByAddr={'1CjPR7Z5ZSyWk6WtXvSFgkptmpoi4UM9BC': 1000};
|
this.balanceByAddr = {
|
||||||
|
'1CjPR7Z5ZSyWk6WtXvSFgkptmpoi4UM9BC': 1000
|
||||||
|
};
|
||||||
this.name = 'myTESTwullet';
|
this.name = 'myTESTwullet';
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -29,9 +31,16 @@ FakeWallet.prototype.getBalance=function(cb){
|
||||||
return cb(null, this.balance, this.balanceByAddr, this.safeBalance);
|
return cb(null, this.balance, this.balanceByAddr, this.safeBalance);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
FakeWallet.prototype.setEnc = function(enc) {
|
||||||
|
this.enc = enc;
|
||||||
|
};
|
||||||
|
|
||||||
FakeWallet.prototype.toEncryptedObj = function() {
|
FakeWallet.prototype.toEncryptedObj = function() {
|
||||||
return 'SUPERENCRYPTEDSICRITSTUFF';
|
return this.enc;
|
||||||
|
};
|
||||||
|
|
||||||
|
FakeWallet.prototype.disconnect = function() {
|
||||||
|
this.disconnectCalled = 1;
|
||||||
};
|
};
|
||||||
|
|
||||||
// This mock is meant for karma, module.exports is not necesary.
|
// This mock is meant for karma, module.exports is not necesary.
|
||||||
|
|
|
@ -3,27 +3,17 @@
|
||||||
var chai = chai || require('chai');
|
var chai = chai || require('chai');
|
||||||
var should = chai.should();
|
var should = chai.should();
|
||||||
|
|
||||||
|
var copay = copay || require('../copay');
|
||||||
|
var sinon = require('sinon');
|
||||||
var FakeNetwork = require('./mocks/FakeNetwork');
|
var FakeNetwork = require('./mocks/FakeNetwork');
|
||||||
var Insight = require('../js/models/blockchain/Insight');
|
var FakeBlockchain = require('./mocks/FakeBlockchain');
|
||||||
var FakeStorage = require('./mocks/FakeStorage');
|
var FakeStorage = require('./mocks/FakeStorage');
|
||||||
|
|
||||||
try {
|
|
||||||
var copay = require('copay'); //browser
|
|
||||||
} catch (e) {
|
|
||||||
var copay = require('../copay'); //node
|
|
||||||
}
|
|
||||||
var WalletFactory = require('../js/models/core/WalletFactory');
|
var WalletFactory = require('../js/models/core/WalletFactory');
|
||||||
|
|
||||||
var addCopayers = function(w) {
|
|
||||||
for (var i = 0; i < 4; i++) {
|
|
||||||
w.publicKeyRing.addCopayer();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
describe('WalletFactory model', function() {
|
describe('WalletFactory model', function() {
|
||||||
var config = {
|
var config = {
|
||||||
Network: FakeNetwork,
|
Network: FakeNetwork,
|
||||||
Blockchain: Insight,
|
Blockchain: FakeBlockchain,
|
||||||
Storage: FakeStorage,
|
Storage: FakeStorage,
|
||||||
wallet: {
|
wallet: {
|
||||||
requiredCopayers: 3,
|
requiredCopayers: 3,
|
||||||
|
@ -38,12 +28,34 @@ describe('WalletFactory model', function() {
|
||||||
},
|
},
|
||||||
networkName: 'testnet',
|
networkName: 'testnet',
|
||||||
passphrase: 'test',
|
passphrase: 'test',
|
||||||
|
storageObj: new FakeStorage(),
|
||||||
|
networkObj: new FakeNetwork(),
|
||||||
|
blockchainObj: new FakeBlockchain(),
|
||||||
};
|
};
|
||||||
|
|
||||||
it('should create the factory', function() {
|
beforeEach(function() {
|
||||||
var wf = new WalletFactory(config);
|
config.storageObj.reset();
|
||||||
should.exist(wf);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should create the factory', function() {
|
||||||
|
var wf = new WalletFactory(config, '0.0.1');
|
||||||
|
should.exist(wf);
|
||||||
|
wf.networkName.should.equal(config.networkName);
|
||||||
|
wf.walletDefaults.should.deep.equal(config.wallet);
|
||||||
|
wf.version.should.equal('0.0.1');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should log', function() {
|
||||||
|
var c2 = JSON.parse(JSON.stringify(config));
|
||||||
|
c2.verbose = 1;
|
||||||
|
var wf = new WalletFactory(c2, '0.0.1');
|
||||||
|
var spy = sinon.spy(console, 'log');
|
||||||
|
wf.log('ok');
|
||||||
|
sinon.assert.callCount(spy, 1);
|
||||||
|
spy.getCall(0).args[0].should.equal('ok');
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
it('#_checkRead should return false', function() {
|
it('#_checkRead should return false', function() {
|
||||||
var wf = new WalletFactory(config);
|
var wf = new WalletFactory(config);
|
||||||
wf._checkRead('dummy').should.equal(false);
|
wf._checkRead('dummy').should.equal(false);
|
||||||
|
@ -83,7 +95,7 @@ describe('WalletFactory model', function() {
|
||||||
it('BIP32 length problem', function() {
|
it('BIP32 length problem', function() {
|
||||||
var sconfig = {
|
var sconfig = {
|
||||||
Network: FakeNetwork,
|
Network: FakeNetwork,
|
||||||
Blockchain: Insight,
|
Blockchain: FakeBlockchain,
|
||||||
Storage: FakeStorage,
|
Storage: FakeStorage,
|
||||||
"networkName": "testnet",
|
"networkName": "testnet",
|
||||||
"network": {
|
"network": {
|
||||||
|
@ -114,7 +126,10 @@ describe('WalletFactory model', function() {
|
||||||
"port": 3001
|
"port": 3001
|
||||||
},
|
},
|
||||||
"verbose": 0,
|
"verbose": 0,
|
||||||
"themes": ["default"]
|
"themes": ["default"],
|
||||||
|
storageObj: new FakeStorage(),
|
||||||
|
networkObj: new FakeNetwork(),
|
||||||
|
blockchainObj: new FakeBlockchain(),
|
||||||
};
|
};
|
||||||
var wf = new WalletFactory(sconfig, '0.0.1');
|
var wf = new WalletFactory(sconfig, '0.0.1');
|
||||||
var opts = {
|
var opts = {
|
||||||
|
@ -125,4 +140,30 @@ describe('WalletFactory model', function() {
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should be able to get current wallets', function() {
|
||||||
|
var wf = new WalletFactory(config, '0.0.1');
|
||||||
|
var ws = wf.getWallets();
|
||||||
|
|
||||||
|
var w = wf.create({
|
||||||
|
name: 'test wallet'
|
||||||
|
});
|
||||||
|
var ws = wf.getWallets();
|
||||||
|
ws.length.should.equal(1);
|
||||||
|
ws[0].name.should.equal('test wallet');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should be able to delete wallet', function(done) {
|
||||||
|
var wf = new WalletFactory(config, '0.0.1');
|
||||||
|
var w = wf.create({
|
||||||
|
name: 'test wallet'
|
||||||
|
});
|
||||||
|
var ws = wf.getWallets();
|
||||||
|
ws.length.should.equal(1);
|
||||||
|
wf.delete(ws[0].id, function() {
|
||||||
|
ws = wf.getWallets();
|
||||||
|
ws.length.should.equal(0);
|
||||||
|
done();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,6 +1,14 @@
|
||||||
//
|
//
|
||||||
// test/unit/controllers/controllersSpec.js
|
// test/unit/controllers/controllersSpec.js
|
||||||
//
|
//
|
||||||
|
|
||||||
|
// Replace saveAs plugin
|
||||||
|
saveAsLastCall = null;
|
||||||
|
saveAs = function(o) {
|
||||||
|
saveAsLastCall = o;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
describe("Unit: Controllers", function() {
|
describe("Unit: Controllers", function() {
|
||||||
|
|
||||||
var scope;
|
var scope;
|
||||||
|
@ -9,6 +17,47 @@ describe("Unit: Controllers", function() {
|
||||||
beforeEach(module('copayApp.services'));
|
beforeEach(module('copayApp.services'));
|
||||||
beforeEach(module('copayApp.controllers'));
|
beforeEach(module('copayApp.controllers'));
|
||||||
|
|
||||||
|
var config = {
|
||||||
|
requiredCopayers: 3,
|
||||||
|
totalCopayers: 5,
|
||||||
|
spendUnconfirmed: 1,
|
||||||
|
reconnectDelay: 100,
|
||||||
|
networkName: 'testnet',
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
describe('Backup Controller', function() {
|
||||||
|
var ctrl;
|
||||||
|
beforeEach(inject(function($controller, $rootScope) {
|
||||||
|
scope = $rootScope.$new();
|
||||||
|
|
||||||
|
$rootScope.wallet = new FakeWallet(config);
|
||||||
|
ctrl = $controller('BackupController', {
|
||||||
|
$scope: scope,
|
||||||
|
$modal: {},
|
||||||
|
});
|
||||||
|
}));
|
||||||
|
|
||||||
|
it('Should have a Backup controller', function() {
|
||||||
|
expect(scope.title).equal('Backup');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('Backup controller #download', function() {
|
||||||
|
scope.wallet.setEnc('1234567');
|
||||||
|
expect(saveAsLastCall).equal(null);
|
||||||
|
scope.download();
|
||||||
|
expect(saveAsLastCall.size).equal(7);
|
||||||
|
expect(saveAsLastCall.type).equal('text/plain;charset=utf-8');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('Backup controller #delete', function() {
|
||||||
|
expect(scope.wallet).not.equal(undefined);
|
||||||
|
scope.deleteWallet();
|
||||||
|
expect(scope.wallet).equal(undefined);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
describe('Address Controller', function() {
|
describe('Address Controller', function() {
|
||||||
var addressCtrl;
|
var addressCtrl;
|
||||||
beforeEach(inject(function($controller, $rootScope) {
|
beforeEach(inject(function($controller, $rootScope) {
|
||||||
|
@ -114,4 +163,3 @@ describe("Unit: Controllers", function() {
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue