fix insufficient funds error msg & tests

This commit is contained in:
Ivan Socolsky 2015-02-04 12:50:23 -03:00
parent 8e7fa61466
commit fdd3b831c0
2 changed files with 7 additions and 4 deletions

View File

@ -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);

View File

@ -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'