Merge pull request #2298 from matiaspando/increaseCoverage85
Increase coverage to 83%
This commit is contained in:
commit
93b0a484c8
9 changed files with 422 additions and 80 deletions
|
|
@ -19,7 +19,7 @@ angular.module('copayApp.controllers').controller('ReceiveController',
|
|||
$scope.showAll = false;
|
||||
|
||||
var w = $rootScope.wallet;
|
||||
var lastAddr = _.first(w.getAddressesOrderer());
|
||||
var lastAddr = _.first(w.getAddressesOrdered());
|
||||
var balance = w.balanceInfo.balanceByAddr;
|
||||
$scope.setAddressList();
|
||||
|
||||
|
|
|
|||
|
|
@ -507,7 +507,7 @@ Identity.prototype.importWalletFromObj = function(obj, opts, cb) {
|
|||
log.debug('Updating Indexes for wallet:' + w.getName());
|
||||
w.updateIndexes(function(err) {
|
||||
log.debug('Adding wallet to profile:' + w.getName());
|
||||
self.storeWallet(w, function (err) {
|
||||
self.storeWallet(w, function(err) {
|
||||
if (err) return cb(err);
|
||||
|
||||
self.addWallet(w);
|
||||
|
|
|
|||
|
|
@ -14,8 +14,8 @@ var log = require('../util/log.js');
|
|||
|
||||
|
||||
/*
|
||||
This class lets interfaces with the blockchain, making general queries and
|
||||
subscribing to transactions on adressess and blocks.
|
||||
This class lets interface with the blockchain, making general queries and
|
||||
subscribing to transactions on addresses and blocks.
|
||||
|
||||
Opts:
|
||||
- url
|
||||
|
|
|
|||
|
|
@ -540,13 +540,13 @@ PublicKeyRing.prototype.getAddresses = function() {
|
|||
};
|
||||
|
||||
/**
|
||||
* getAddressesOrderer
|
||||
* {@link Wallet#getAddressesOrderer}
|
||||
* getAddressesOrdered
|
||||
* {@link Wallet#getAddressesOrdered}
|
||||
*
|
||||
* @param pubkey
|
||||
* @return {string[]}
|
||||
*/
|
||||
PublicKeyRing.prototype.getAddressesOrderer = function(pubkey) {
|
||||
PublicKeyRing.prototype.getAddressesOrdered = function(pubkey) {
|
||||
this._checkCache();
|
||||
|
||||
var info = _.map(this.cache.addressToPath, function(path, addr) {
|
||||
|
|
@ -559,9 +559,7 @@ PublicKeyRing.prototype.getAddressesOrderer = function(pubkey) {
|
|||
var l = info.length;
|
||||
|
||||
var sortedInfo = _.sortBy(info, function(i) {
|
||||
var goodness = ( (i.copayerIndex !== copayerIndex) ? 2 * l : 0 )
|
||||
+ ( i.isChange ? l : 0 )
|
||||
+ l - i.addressIndex;
|
||||
var goodness = ((i.copayerIndex !== copayerIndex) ? 2 * l : 0) + (i.isChange ? l : 0) + l - i.addressIndex;
|
||||
return goodness;
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -2062,13 +2062,13 @@ Wallet.prototype.getAddresses = function() {
|
|||
|
||||
|
||||
/**
|
||||
* @desc gets the list of addresses, orderder for the caller:
|
||||
* @desc gets the list of addresses, ordered for the caller:
|
||||
* 1) himselfs first
|
||||
* 2) receive address first
|
||||
* 3) last created first
|
||||
*/
|
||||
Wallet.prototype.getAddressesOrderer = function() {
|
||||
return this.publicKeyRing.getAddressesOrderer(this.publicKey);
|
||||
Wallet.prototype.getAddressesOrdered = function() {
|
||||
return this.publicKeyRing.getAddressesOrdered(this.publicKey);
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue