From b7f96da25a234aa17ab821ae959a19205084c7fc Mon Sep 17 00:00:00 2001 From: Ivan Socolsky Date: Thu, 28 May 2015 12:58:17 -0300 Subject: [PATCH] test when getTransaction fails --- test/integration/server.js | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/test/integration/server.js b/test/integration/server.js index 91d72b6..38da49d 100644 --- a/test/integration/server.js +++ b/test/integration/server.js @@ -1736,6 +1736,27 @@ describe('Wallet service', function() { }); }); }); + + it('should keep tx as accepted if broadcast fails and cannot check tx in blockchain', function(done) { + helpers.stubBroadcastFail(); + blockchainExplorer.getTransaction = sinon.stub().callsArgWith(1, 'bc check error'); + server.broadcastTx({ + txProposalId: txpid + }, function(err) { + should.exist(err); + err.code.should.equal('BLOCKCHAINERROR'); + server.getTx({ + txProposalId: txpid + }, function(err, txp) { + should.not.exist(err); + should.not.exist(txp.txid); + txp.isBroadcasted().should.be.false; + should.not.exist(txp.broadcastedOn); + txp.isAccepted().should.be.true; + done(); + }); + }); + }); }); describe('Tx proposal workflow', function() {