Add test for TxProposal
This commit is contained in:
parent
503895fe6c
commit
63b4f2c649
2 changed files with 50 additions and 12 deletions
|
|
@ -74,6 +74,7 @@ describe('HDParams model', function() {
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
it('should count generation indexes', function() {
|
it('should count generation indexes', function() {
|
||||||
var j = new HDParams();
|
var j = new HDParams();
|
||||||
j.copayerIndex = 1;
|
j.copayerIndex = 1;
|
||||||
|
|
@ -121,3 +122,28 @@ describe('HDParams model', function() {
|
||||||
})
|
})
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
describe('#checkRange', function() {
|
||||||
|
it('should throw an error', function() {
|
||||||
|
var hd = new HDParams();
|
||||||
|
|
||||||
|
(function() {
|
||||||
|
hd.checkRange(60, true);
|
||||||
|
}).should.throw('Out of bounds');
|
||||||
|
|
||||||
|
});
|
||||||
|
it('should throw an error', function() {
|
||||||
|
var hd = new HDParams();
|
||||||
|
|
||||||
|
(function() {
|
||||||
|
hd.checkRange(60, false);
|
||||||
|
}).should.throw('Out of bounds');
|
||||||
|
|
||||||
|
});
|
||||||
|
it('should not throw an error', function() {
|
||||||
|
var hd = new HDParams();
|
||||||
|
hd.checkRange(0, false);
|
||||||
|
hd.checkRange(0, true);
|
||||||
|
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
|
||||||
|
|
@ -368,6 +368,18 @@ describe('TxProposal', function() {
|
||||||
txp.builder.inputsSigned.should.be.equal(0);
|
txp.builder.inputsSigned.should.be.equal(0);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it.only('should not add signatures to complete txs ', function() {
|
||||||
|
var txp = dummyProposal({
|
||||||
|
nsig: 1
|
||||||
|
});
|
||||||
|
txp.addSignature('pepe', [SIG1]);
|
||||||
|
txp.builder.inputsSigned.should.be.equal(0);
|
||||||
|
|
||||||
|
var r = txp.addSignature('lolo', [SIG0]);
|
||||||
|
r.should.be.false;
|
||||||
|
txp.builder.inputsSigned.should.be.equal(0);
|
||||||
|
});
|
||||||
|
|
||||||
it('should fail with invalid signatures', function() {
|
it('should fail with invalid signatures', function() {
|
||||||
var txp = dummyProposal({
|
var txp = dummyProposal({
|
||||||
nsig: 1
|
nsig: 1
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue