add rebroadcast test
This commit is contained in:
parent
91829f8410
commit
5a2dfe690d
5 changed files with 131 additions and 66 deletions
|
|
@ -678,10 +678,10 @@ describe('Wallet model', function() {
|
|||
w.blockchain.fixUnspent(utxo);
|
||||
w.createTx(toAddress, amountSatStr, null, function(ntxid) {
|
||||
var s = sinon.stub(w, 'getMyCopayerId').returns('213');
|
||||
Object.keys(w.txProposals._getTxp(ntxid).rejectedBy).length.should.equal(0);
|
||||
Object.keys(w.txProposals.get(ntxid).rejectedBy).length.should.equal(0);
|
||||
w.reject(ntxid);
|
||||
Object.keys(w.txProposals._getTxp(ntxid).rejectedBy).length.should.equal(1);
|
||||
w.txProposals._getTxp(ntxid).rejectedBy['213'].should.gt(1);
|
||||
Object.keys(w.txProposals.get(ntxid).rejectedBy).length.should.equal(1);
|
||||
w.txProposals.get(ntxid).rejectedBy['213'].should.gt(1);
|
||||
s.restore();
|
||||
done();
|
||||
});
|
||||
|
|
@ -1169,7 +1169,7 @@ describe('Wallet model', function() {
|
|||
w._handleReject(1, {
|
||||
ntxid: 1
|
||||
}, 1);
|
||||
}).should.throw('unknown TX');
|
||||
}).should.throw('Unknown TXP');
|
||||
});
|
||||
it('should fail to reject a signed tx', function() {
|
||||
var w = cachedCreateW();
|
||||
|
|
@ -1223,7 +1223,7 @@ describe('Wallet model', function() {
|
|||
w._handleReject(1, {
|
||||
ntxid: 1
|
||||
}, 1);
|
||||
}).should.throw('unknown TX');
|
||||
}).should.throw('Unknown TXP');
|
||||
});
|
||||
it('should set seen a tx', function() {
|
||||
var w = cachedCreateW();
|
||||
|
|
|
|||
|
|
@ -82,9 +82,9 @@ describe('Insight model', function() {
|
|||
|
||||
|
||||
sinon
|
||||
.stub(http, 'request')
|
||||
.returns(req)
|
||||
.yields(request);
|
||||
.stub(http, 'request')
|
||||
.returns(req)
|
||||
.yields(request);
|
||||
|
||||
i.getUnspent(['2MuD5LnZSViZZYwZbpVsagwrH8WWvCztdmV', '2NBSLoMvsHsf2Uv3LA17zV4beH6Gze6RovA'], function(e, ret) {
|
||||
should.not.exist(e);
|
||||
|
|
@ -113,9 +113,9 @@ describe('Insight model', function() {
|
|||
req.end = function() {};
|
||||
|
||||
sinon
|
||||
.stub(http, 'request')
|
||||
.returns(req)
|
||||
.yields(request);
|
||||
.stub(http, 'request')
|
||||
.returns(req)
|
||||
.yields(request);
|
||||
|
||||
i.sendRawTransaction(rawtx, function(a) {
|
||||
should.exist(a);
|
||||
|
|
@ -200,5 +200,36 @@ describe('Insight model', function() {
|
|||
});
|
||||
});
|
||||
|
||||
describe("#checkSentTx", function() {
|
||||
it('should return true if Tx is found', function(done) {
|
||||
var w = new Insight();
|
||||
w._request = sinon.stub().yields(null, {
|
||||
txid: "414142",
|
||||
});
|
||||
var tx = function() {};
|
||||
tx.prototype.getHash = function(){return new Buffer('BAA')};
|
||||
w.checkSentTx(new tx(), function(err, ret) {
|
||||
should.not.exist(err);
|
||||
ret.should.equal('414142');
|
||||
done();
|
||||
});
|
||||
});
|
||||
it('should return false if Tx is not found', function(done) {
|
||||
var w = new Insight();
|
||||
w._request = sinon.stub().yields(null, {
|
||||
txid: "414142",
|
||||
});
|
||||
var tx = function() {};
|
||||
tx.prototype.getHash = function(){return new Buffer('ABC')};
|
||||
w.checkSentTx(new tx(), function(err, ret) {
|
||||
should.not.exist(err);
|
||||
ret.should.equal(false);
|
||||
done();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue