From 9bb7f221fe58d3a0a296410874a3ab632f7f4583 Mon Sep 17 00:00:00 2001 From: Matias Pando Date: Mon, 9 Mar 2015 15:24:37 -0300 Subject: [PATCH 1/2] Added tests --- test/integration/server.js | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/test/integration/server.js b/test/integration/server.js index 011df7b..e7fb6c8 100644 --- a/test/integration/server.js +++ b/test/integration/server.js @@ -1648,7 +1648,18 @@ describe('Copay server', function() { done(); }); }); - it.skip('should get someone elses transaction proposal', function(done) {}); + it('should get someone elses transaction proposal', function(done) { + helpers.getAuthServer(wallet.copayers[1].id, function(server2, wallet) { + server2.getTx({ + txProposalId: txpid + }, function(err, res) { + should.not.exist(err); + res.id.should.equal(txpid); + done(); + }); + }); + + }); it('should fail to get non-existent transaction proposal', function(done) { server.getTx({ txProposalId: 'dummy' From 880c1a21c974d32147e3dcd533dbd7f43f1231fa Mon Sep 17 00:00:00 2001 From: Matias Pando Date: Mon, 9 Mar 2015 15:40:10 -0300 Subject: [PATCH 2/2] Testing strategy for selecting utxos --- test/integration/server.js | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/test/integration/server.js b/test/integration/server.js index e7fb6c8..bad4a7e 100644 --- a/test/integration/server.js +++ b/test/integration/server.js @@ -820,6 +820,26 @@ describe('Copay server', function() { }); }); + it('should create a tx using the uxtos with minimum amount first', function(done) { + helpers.stubUtxos(server, wallet, [100, 200, 300], function() { + var txOpts = helpers.createProposalOpts('18PzpUFkFZE8zKWUPvfykkTxmB9oMR8qP7', 150, 'some message', TestData.copayers[0].privKey); + server.createTx(txOpts, function(err, tx) { + should.not.exist(err); + should.exist(tx); + server.getPendingTxs({}, function(err, txs) { + should.not.exist(err); + txs.length.should.equal(1); + server.getBalance({}, function(err, balance) { + should.not.exist(err); + balance.totalAmount.should.equal(helpers.toSatoshi(600)); + balance.lockedAmount.should.equal(helpers.toSatoshi(300)); + done(); + }); + }); + }); + }); + }); + it('should fail to create tx with invalid proposal signature', function(done) { helpers.stubUtxos(server, wallet, [100, 200], function() {