flocore/test/transaction/deserialize.js
Esteban Ordano 5c974a8ef2 Refactor transaction to match new API
* Refactor transaction into a different subfolder
* Added a lot of tests for sighash and transaction serialization (from
  reddit's and Ryan X. Charles' `fullnode`)
* Drop "only" from sighash tests and consolidate logs
2014-12-10 12:44:30 -03:00

31 lines
785 B
JavaScript

'use strict';
var Transaction = require('../../lib/transaction');
var vectors_valid = require('./tx_valid.json');
var vectors_invalid = require('./tx_invalid.json');
describe('Transaction deserialization', function() {
describe('valid transaction test case', function() {
var index = 0;
vectors_valid.forEach(function(vector) {
if (vector.length > 1) {
var hexa = vector[1];
Transaction(hexa).serialize().should.equal(hexa);
index++;
}
});
});
describe('invalid transaction test case', function() {
var index = 0;
vectors_invalid.forEach(function(vector) {
if (vector.length > 1) {
var hexa = vector[1];
Transaction(hexa).serialize().should.equal(hexa);
index++;
}
});
});
});