Browse Source

fix insufficient funds error msg & tests

activeAddress
Ivan Socolsky 10 years ago
parent
commit
fdd3b831c0
  1. 5
      lib/server.js
  2. 6
      test/integration.js

5
lib/server.js

@ -427,8 +427,9 @@ CopayServer.prototype.createTx = function(opts, cb) {
});
txp.inputs = self._selectUtxos(txp, utxos);
if (!txp.inputs)
return cb('insufficient funds')
if (!txp.inputs) {
return cb(new CopayError('INSUFFICIENTFUNDS', 'Insufficient funds'));
}
// no need to do this now: // TODO remove this comment
//self._createRawTx(txp);

6
test/integration.js

@ -778,7 +778,8 @@ describe('Copay server', function() {
};
server.createTx(txOpts, function(err, tx) {
err.should.contain('insufficient');
err.code.should.equal('INSUFFICIENTFUNDS');
err.message.should.equal('Insufficient funds');
server.getPendingTxs({
walletId: '123'
}, function(err, txs) {
@ -879,7 +880,8 @@ describe('Copay server', function() {
requestSignature: 'dummy',
};
server.createTx(txOpts2, function(err, tx) {
err.should.contain('insufficient');
err.code.should.equal('INSUFFICIENTFUNDS');
err.message.should.equal('Insufficient funds');
should.not.exist(tx);
server.getPendingTxs({
walletId: '123'

Loading…
Cancel
Save