From fa7e2ef6ced4c4c1e8a31b5ecc387d0c1f05e7a3 Mon Sep 17 00:00:00 2001 From: Ivan Socolsky Date: Mon, 16 Nov 2015 17:46:34 -0300 Subject: [PATCH] test multiple-output with no change --- test/integration/server.js | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/test/integration/server.js b/test/integration/server.js index 4e0cb36..702bb8f 100644 --- a/test/integration/server.js +++ b/test/integration/server.js @@ -2146,6 +2146,34 @@ describe('Wallet service', function() { }); }); + it.only('should support creating a multiple output tx with no change address', function(done) { + helpers.stubUtxos(server, wallet, [1, 2], function() { + var max = 3 - (7560 / 1e8); // Fees for this tx at 100bits/kB = 7560 sat + var outputs = [{ + toAddress: '18PzpUFkFZE8zKWUPvfykkTxmB9oMR8qP7', + amount: 1, + message: 'message #1' + }, { + toAddress: '18PzpUFkFZE8zKWUPvfykkTxmB9oMR8qP7', + amount: max - 1, + message: 'message #2' + }]; + var txOpts = helpers.createProposalOpts(Model.TxProposal.Types.MULTIPLEOUTPUTS, outputs, TestData.copayers[0].privKey_1H_0, { + message: 'some message' + }); + server.createTx(txOpts, function(err, txp) { + should.not.exist(err); + should.exist(txp); + + var t = txp.getBitcoreTx().toObject(); + t.outputs.length.should.equal(2); + _.sum(t.outputs, 'satoshis').should.equal(max * 1e8); + done(); + }); + }); + }); + + it('should fail to create tx for type multiple_outputs with missing output argument', function(done) { helpers.stubUtxos(server, wallet, [100, 200], function() { var outputs = [{