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 () {
|
||||
fixtures.valid.forEach(function (f) {
|
||||
it('imports ' + f.description + ' (' + f.id + ')', function () {
|
||||
var actual = Transaction.fromHex(f.hex)
|
||||
function importExport (f) {
|
||||
var id = f.id || f.hash
|
||||
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) {
|
||||
it('imports ' + f.description + ' (' + f.id + ')', function () {
|
||||
var actual = Transaction.fromHex(f.hex)
|
||||
|
||||
assert.strictEqual(actual.toHex(), f.hex, actual.toHex())
|
||||
})
|
||||
})
|
||||
fixtures.valid.forEach(importExport)
|
||||
fixtures.witness.forEach(importExport)
|
||||
fixtures.hashForSignature.forEach(importExport)
|
||||
fixtures.hashForWitnessV0.forEach(importExport)
|
||||
|
||||
fixtures.invalid.fromBuffer.forEach(function (f) {
|
||||
it('throws on ' + f.exception, function () {
|
||||
|
|
Loading…
Add table
Reference in a new issue