tests: fromBuffer/toBuffer, import export each set of fixtures
This commit is contained in:
parent
7fb5259233
commit
4521f3d4c1
@ -42,21 +42,21 @@ describe('Transaction', function () {
|
|||||||
}
|
}
|
||||||
|
|
||||||
describe('fromBuffer/fromHex', function () {
|
describe('fromBuffer/fromHex', function () {
|
||||||
fixtures.valid.forEach(function (f) {
|
function importExport (f) {
|
||||||
it('imports ' + f.description + ' (' + f.id + ')', function () {
|
var id = f.id || f.hash
|
||||||
var actual = Transaction.fromHex(f.hex)
|
var txHex = f.hex || f.txHex
|
||||||
|
|
||||||
assert.strictEqual(actual.toHex(), f.hex, actual.toHex())
|
it('imports ' + f.description + ' (' + id + ')', function () {
|
||||||
|
var actual = Transaction.fromHex(txHex)
|
||||||
|
|
||||||
|
assert.strictEqual(actual.toHex(), txHex, actual.toHex())
|
||||||
})
|
})
|
||||||
})
|
}
|
||||||
|
|
||||||
fixtures.witness.forEach(function (f) {
|
fixtures.valid.forEach(importExport)
|
||||||
it('imports ' + f.description + ' (' + f.id + ')', function () {
|
fixtures.witness.forEach(importExport)
|
||||||
var actual = Transaction.fromHex(f.hex)
|
fixtures.hashForSignature.forEach(importExport)
|
||||||
|
fixtures.hashForWitnessV0.forEach(importExport)
|
||||||
assert.strictEqual(actual.toHex(), f.hex, actual.toHex())
|
|
||||||
})
|
|
||||||
})
|
|
||||||
|
|
||||||
fixtures.invalid.fromBuffer.forEach(function (f) {
|
fixtures.invalid.fromBuffer.forEach(function (f) {
|
||||||
it('throws on ' + f.exception, function () {
|
it('throws on ' + f.exception, function () {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user