wallet-test: missing output error

This commit is contained in:
Matthew Zipkin 2019-03-01 10:50:14 -08:00
parent a2bf18ff18
commit e40e1c263c
No known key found for this signature in database
GPG Key ID: E7E2984B6289C93A

View File

@ -18,6 +18,7 @@ const Input = require('../lib/primitives/input');
const Outpoint = require('../lib/primitives/outpoint');
const Script = require('../lib/script/script');
const HD = require('../lib/hd');
const Wallet = require('../lib/wallet/wallet');
const KEY1 = 'xprv9s21ZrQH143K3Aj6xQBymM31Zb4BVc7wxqfUhMZrzewdDVCt'
+ 'qUP9iWfcHgJofs25xbaUpCps9GDXj83NiWvQCAkWQhVj5J4CorfnpKX94AZ';
@ -1642,6 +1643,21 @@ describe('Wallet', function() {
});
}
it('should throw error with missing outputs', async () => {
const wallet = new Wallet({});
let err = null;
try {
await wallet.send({outputs: []});
} catch (e) {
err = e;
}
assert(err);
assert.equal(err.message, 'At least one output required.');
});
it('should cleanup', async () => {
consensus.COINBASE_MATURITY = 100;
// await wdb.close();