test locked funds

This commit is contained in:
Ivan Socolsky 2015-03-11 14:29:13 -03:00
parent a3e1fc68bb
commit b088183ce9
1 changed files with 21 additions and 0 deletions

View File

@ -984,6 +984,27 @@ describe('Copay server', function() {
});
});
it.only('should fail with different error for insufficient funds and locked funds', function(done) {
helpers.stubUtxos(server, wallet, [10, 10], function() {
var txOpts = helpers.createProposalOpts('18PzpUFkFZE8zKWUPvfykkTxmB9oMR8qP7', 11, null, TestData.copayers[0].privKey_1H_0);
server.createTx(txOpts, function(err, tx) {
should.not.exist(err);
server.getBalance({}, function(err, balance) {
should.not.exist(err);
balance.totalAmount.should.equal(helpers.toSatoshi(20));
balance.lockedAmount.should.equal(helpers.toSatoshi(20));
txOpts = helpers.createProposalOpts('18PzpUFkFZE8zKWUPvfykkTxmB9oMR8qP7', 8, null, TestData.copayers[0].privKey_1H_0);
server.createTx(txOpts, function(err, tx) {
should.exist(err);
err.code.should.equal('LOCKEDFUNDS');
err.message.should.equal('Funds are locked by pending transaction proposals');
done();
});
});
});
});
});
it('should fail gracefully when bitcore throws exception on raw tx creation', function(done) {
helpers.stubUtxos(server, wallet, [10], function() {
var bitcoreStub = sinon.stub(Bitcore, 'Transaction');