add tests

This commit is contained in:
Matias Alejo Garcia 2014-08-21 13:54:38 -04:00
commit e11ac3e956
3 changed files with 40 additions and 3 deletions

View file

@ -66,11 +66,13 @@ TxProposal.prototype._check = function() {
};
TxProposal.prototype.rejectCount = function() {
return Object.keys(this.rejectedBy);
return Object.keys(this.rejectedBy).length;
};
TxProposal.prototype.isPending = function(maxRejectCount) {
if (this.rejectCount() < maxRejectCount || p.sentTxid)
preconditions.checkArgument(typeof maxRejectCount != 'undefined');
if (this.rejectCount() > maxRejectCount || this.sentTxid)
return false;
return true;