Browse Source

tests: transaction.add* better tested by raw functions

hk-custom-address
Daniel Cousens 10 years ago
parent
commit
db17e35013
  1. 37
      test/transaction.js

37
test/transaction.js

@ -108,28 +108,6 @@ describe('Transaction', function() {
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) {
it('throws on ' + f.exception, function() {
var tx = new Transaction()
@ -181,21 +159,6 @@ describe('Transaction', function() {
assert.equal(tx.addOutput(destScript, 40000), 0)
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() {

Loading…
Cancel
Save