fix tests for tx
This commit is contained in:
parent
1df88d0694
commit
a18d703b86
@ -1,10 +1,12 @@
|
|||||||
var Varint = require('../lib/varint');
|
'use strict';
|
||||||
var Transaction = require('../lib/transaction');
|
|
||||||
var Txin = require('../lib/txin');
|
|
||||||
var Txout = require('../lib/txout');
|
|
||||||
var should = require('chai').should();
|
var should = require('chai').should();
|
||||||
var BufferReader = require('../lib/bufferreader');
|
var bitcore = require('..');
|
||||||
var BufferWriter = require('../lib/bufferwriter');
|
var Varint = bitcore.Varint;
|
||||||
|
var Transaction = bitcore.Transaction;
|
||||||
|
var Txin = bitcore.Txin;
|
||||||
|
var Txout = bitcore.Txout;
|
||||||
|
var BufferReader = bitcore.BufferReader;
|
||||||
|
|
||||||
describe('Transaction', function() {
|
describe('Transaction', function() {
|
||||||
|
|
||||||
@ -32,7 +34,7 @@ describe('Transaction', function() {
|
|||||||
should.exist(tx);
|
should.exist(tx);
|
||||||
|
|
||||||
Transaction(txbuf).toBuffer().toString('hex').should.equal(txhex);
|
Transaction(txbuf).toBuffer().toString('hex').should.equal(txhex);
|
||||||
|
|
||||||
//should set known defaults
|
//should set known defaults
|
||||||
tx.version.should.equal(1);
|
tx.version.should.equal(1);
|
||||||
tx.txinsvi.toNumber().should.equal(0);
|
tx.txinsvi.toNumber().should.equal(0);
|
||||||
@ -43,7 +45,7 @@ describe('Transaction', function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
describe('#initialize', function() {
|
describe('#initialize', function() {
|
||||||
|
|
||||||
it('should set these known defaults', function() {
|
it('should set these known defaults', function() {
|
||||||
var tx = new Transaction();
|
var tx = new Transaction();
|
||||||
tx.initialize();
|
tx.initialize();
|
||||||
@ -114,7 +116,7 @@ describe('Transaction', function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
describe('#fromBuffer', function() {
|
describe('#fromBuffer', function() {
|
||||||
|
|
||||||
it('should recover from this known tx', function() {
|
it('should recover from this known tx', function() {
|
||||||
Transaction().fromBuffer(txbuf).toBuffer().toString('hex').should.equal(txhex);
|
Transaction().fromBuffer(txbuf).toBuffer().toString('hex').should.equal(txhex);
|
||||||
});
|
});
|
||||||
@ -126,7 +128,7 @@ describe('Transaction', function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
describe('#fromBufferReader', function() {
|
describe('#fromBufferReader', function() {
|
||||||
|
|
||||||
it('should recover from this known tx', function() {
|
it('should recover from this known tx', function() {
|
||||||
Transaction().fromBufferReader(BufferReader(txbuf)).toBuffer().toString('hex').should.equal(txhex);
|
Transaction().fromBufferReader(BufferReader(txbuf)).toBuffer().toString('hex').should.equal(txhex);
|
||||||
});
|
});
|
||||||
@ -134,7 +136,7 @@ describe('Transaction', function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
describe('#toBuffer', function() {
|
describe('#toBuffer', function() {
|
||||||
|
|
||||||
it('should produce this known tx', function() {
|
it('should produce this known tx', function() {
|
||||||
Transaction().fromBuffer(txbuf).toBuffer().toString('hex').should.equal(txhex);
|
Transaction().fromBuffer(txbuf).toBuffer().toString('hex').should.equal(txhex);
|
||||||
});
|
});
|
||||||
@ -142,7 +144,7 @@ describe('Transaction', function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
describe('#toBufferWriter', function() {
|
describe('#toBufferWriter', function() {
|
||||||
|
|
||||||
it('should produce this known tx', function() {
|
it('should produce this known tx', function() {
|
||||||
Transaction().fromBuffer(txbuf).toBufferWriter().concat().toString('hex').should.equal(txhex);
|
Transaction().fromBuffer(txbuf).toBufferWriter().concat().toString('hex').should.equal(txhex);
|
||||||
});
|
});
|
||||||
@ -169,7 +171,7 @@ describe('Transaction', function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
describe('#pushin', function() {
|
describe('#pushin', function() {
|
||||||
|
|
||||||
it('should add an input', function() {
|
it('should add an input', function() {
|
||||||
var txin = Txin();
|
var txin = Txin();
|
||||||
var tx = Transaction();
|
var tx = Transaction();
|
||||||
@ -181,7 +183,7 @@ describe('Transaction', function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
describe('#pushout', function() {
|
describe('#pushout', function() {
|
||||||
|
|
||||||
it('should add an output', function() {
|
it('should add an output', function() {
|
||||||
var txout = Txout();
|
var txout = Txout();
|
||||||
var tx = Transaction();
|
var tx = Transaction();
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user