tests: transaction.add* better tested by raw functions
This commit is contained in:
parent
dc253bb77c
commit
db17e35013
1 changed files with 0 additions and 37 deletions
|
@ -108,28 +108,6 @@ describe('Transaction', function() {
|
||||||
assert.equal(tx.ins[0].script, Script.EMPTY)
|
assert.equal(tx.ins[0].script, Script.EMPTY)
|
||||||
})
|
})
|
||||||
|
|
||||||
fixtures.valid.forEach(function(f) {
|
|
||||||
it('should add the inputs for ' + f.id + ' correctly', function() {
|
|
||||||
var tx = new Transaction()
|
|
||||||
|
|
||||||
f.raw.ins.forEach(function(txIn, i) {
|
|
||||||
var txHash = new Buffer(txIn.hash, 'hex')
|
|
||||||
var script = txIn.script ? Script.fromASM(txIn.script) : undefined
|
|
||||||
var j = tx.addInput(txHash, txIn.index, txIn.sequence, script)
|
|
||||||
var sequence = txIn.sequence
|
|
||||||
if (sequence === undefined || sequence === null ) {
|
|
||||||
sequence = Transaction.DEFAULT_SEQUENCE
|
|
||||||
}
|
|
||||||
|
|
||||||
assert.equal(i, j)
|
|
||||||
assert.equal(tx.ins[i].hash.toString('hex'), txIn.hash)
|
|
||||||
assert.equal(tx.ins[i].index, txIn.index)
|
|
||||||
assert.equal(tx.ins[i].sequence, sequence)
|
|
||||||
assert.deepEqual(tx.ins[i].script, script || Script.EMPTY)
|
|
||||||
})
|
|
||||||
})
|
|
||||||
})
|
|
||||||
|
|
||||||
fixtures.invalid.addInput.forEach(function(f) {
|
fixtures.invalid.addInput.forEach(function(f) {
|
||||||
it('throws on ' + f.exception, function() {
|
it('throws on ' + f.exception, function() {
|
||||||
var tx = new Transaction()
|
var tx = new Transaction()
|
||||||
|
@ -181,21 +159,6 @@ describe('Transaction', function() {
|
||||||
assert.equal(tx.addOutput(destScript, 40000), 0)
|
assert.equal(tx.addOutput(destScript, 40000), 0)
|
||||||
assert.equal(tx.addOutput(destScript, 40000), 1)
|
assert.equal(tx.addOutput(destScript, 40000), 1)
|
||||||
})
|
})
|
||||||
|
|
||||||
fixtures.valid.forEach(function(f) {
|
|
||||||
it('should add the outputs for ' + f.id + ' correctly', function() {
|
|
||||||
var tx = new Transaction()
|
|
||||||
|
|
||||||
f.raw.outs.forEach(function(txOut, i) {
|
|
||||||
var scriptPubKey = Script.fromASM(txOut.script)
|
|
||||||
var j = tx.addOutput(scriptPubKey, txOut.value)
|
|
||||||
|
|
||||||
assert.equal(i, j)
|
|
||||||
assert.equal(tx.outs[i].script, scriptPubKey)
|
|
||||||
assert.equal(tx.outs[i].value, txOut.value)
|
|
||||||
})
|
|
||||||
})
|
|
||||||
})
|
|
||||||
})
|
})
|
||||||
|
|
||||||
describe('clone', function() {
|
describe('clone', function() {
|
||||||
|
|
Loading…
Add table
Reference in a new issue