tests: fromBuffer/toBuffer, import export each set of fixtures
This commit is contained in:
parent
5c2fdb6043
commit
b60882a85e
1 changed files with 12 additions and 12 deletions
|
@ -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…
Add table
Reference in a new issue