all addr test OK

This commit is contained in:
Matias Alejo Garcia 2014-01-13 20:38:51 -03:00
parent 5290314bd0
commit 801651d494
3 changed files with 6 additions and 9 deletions

View File

@ -54,12 +54,12 @@ function spec() {
// TODO TXout! // TODO TXout!
//T //T
function (cb) { function (cb) {
TransactionItem.find({addr:that.addrStr}, function(err,txItems){ TransactionItem.find({addr:that.addrStr}).sort({ts:1}).exec(function(err,txItems){
if (err) return cb(err); if (err) return cb(err);
txItems.forEach(function(txItem){ txItems.forEach(function(txItem){
// console.log(txItem.txid + ' : ' + txItem.value_sat); // console.log(txItem.txid + ':' + txItem.ts+ ' : ' + (txItem.value_sat/parseFloat(BitcoreUtil.COIN) ) );
that.txApperances +=1; that.txApperances +=1;
that.balanceSat += txItem.value_sat; that.balanceSat += txItem.value_sat;

View File

@ -41,8 +41,9 @@ describe('Address balances', function(){
if (v.totalReceived) assert.equal(v.totalReceived, a.totalReceived); if (v.totalReceived) assert.equal(v.totalReceived, a.totalReceived);
if (v.totalSent) assert.equal(v.totalSent, a.totalSent); if (v.totalSent) assert.equal(v.totalSent, a.totalSent);
if (v.transactions) { if (v.transactions) {
v.transactions.forEach( function(tx) { v.transactions.forEach( function(tx) {
assert(tx in a.transactions); assert(a.transactions.indexOf(tx)>-1);
}); });
} }
done(); done();

View File

@ -34,21 +34,18 @@
"totalSent": 3.9775 "totalSent": 3.9775
}, },
{ {
"disabled":1,
"addr": "mzW2hdZN2um7WBvTDerdahKqRgj3md9C29", "addr": "mzW2hdZN2um7WBvTDerdahKqRgj3md9C29",
"balance": 910.39522682, "balance": 910.3952268,
"totalReceived": 910.39522682, "totalReceived": 910.3952268,
"totalSent": 0 "totalSent": 0
}, },
{ {
"disabled":1,
"addr": "mjRmkmYzvZN3cA3aBKJgYJ65epn3WCG84H", "addr": "mjRmkmYzvZN3cA3aBKJgYJ65epn3WCG84H",
"balance": 46413.0, "balance": 46413.0,
"totalReceived": 357130.17644359, "totalReceived": 357130.17644359,
"totalSent": 310717.17644359 "totalSent": 310717.17644359
}, },
{ {
"disabled":1,
"addr": "mgKY35SXqxFpcKK3Dq9mW9919N7wYXvcFM", "addr": "mgKY35SXqxFpcKK3Dq9mW9919N7wYXvcFM",
"balance": 0.01979459, "balance": 0.01979459,
"totalReceived": 0.01979459, "totalReceived": 0.01979459,
@ -56,7 +53,6 @@
"transactions": [ "91800d80bb4c69b238c9bfd94eb5155ab821e6b25cae5c79903d12853bbb4ed5" ] "transactions": [ "91800d80bb4c69b238c9bfd94eb5155ab821e6b25cae5c79903d12853bbb4ed5" ]
}, },
{ {
"disabled":1,
"addr": "mmvP3mTe53qxHdPqXEvdu8WdC7GfQ2vmx5", "addr": "mmvP3mTe53qxHdPqXEvdu8WdC7GfQ2vmx5",
"balance": 10580.50027254, "balance": 10580.50027254,
"totalReceived": 12157.65075053, "totalReceived": 12157.65075053,