Merge pull request #127 from matiu/bug/update-tests

update test
This commit is contained in:
Mario Colque 2014-01-22 05:03:51 -08:00
commit d16ee87550
8 changed files with 28 additions and 39 deletions

View File

@ -37,9 +37,6 @@ exports.show = function(req, res) {
case 'getTxOutSetInfo':
statusObject.getTxOutSetInfo(returnJsonp);
break;
case 'getBestBlockHash':
statusObject.getBestBlockHash(returnJsonp);
break;
case 'getLastBlockHash':
statusObject.getLastBlockHash(returnJsonp);
break;

View File

@ -221,7 +221,7 @@ function spec() {
var retry_secs = 2;
var bestBlock;
var lastBlock;
async.series([
function(cb) {
@ -247,7 +247,7 @@ function spec() {
self.rpc.getBlockHash(self.blockChainHeight, function(err, res) {
if (err) return cb(err);
bestBlock = res.result;
lastBlock = res.result;
return cb();
});
@ -271,7 +271,7 @@ function spec() {
var start, end;
function sync() {
if (opts.reverse) {
start = bestBlock;
start = lastBlock;
end = self.genesis;
opts.prev = true;
}

View File

@ -290,7 +290,7 @@ h1, h2, h3, h4, h5, h6, .h1, .h2, .h3, .h4, .h5, .h6 {
font-size: 11px;
}
#search { width: 400px; }
#search { width: 300px; }
.no_matching {
background-color: #FFFFFF;
@ -391,6 +391,4 @@ h1, h2, h3, h4, h5, h6, .h1, .h2, .h3, .h4, .h5, .h6 {
color: black;
}
.status .text-default {
}

View File

@ -1,15 +1,8 @@
<div class="container">
<div class="container" style="width:945px">
<div data-ng-controller="HeaderController">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="insight navbar-brand" href="#!">Insight</a>
</div>
<div class="collapse navbar-collapse">
<ul class="nav navbar-nav">
<li data-ng-repeat="item in menu" ui-route="/{{item.link}}" data-ng-class="{active: $uiRoute}">
<a href="#!/{{item.link}}">{{item.title}}</a>
@ -39,6 +32,5 @@
</i>
</span>
</div>
</div>
</div>
</div>

View File

@ -16,7 +16,7 @@ describe('PeerSync', function() {
});
describe('#init()', function() {
it('should return with no errors', function() {
it.skip('should return with no errors', function() {
var other_ps = new PeerSync();
expect(other_ps.init.bind(other_ps)).not.to.throw(Error);
other_ps.close();
@ -28,12 +28,12 @@ describe('PeerSync', function() {
message: {invs: []},
conn: {sendGetData: sinon.spy()}
};
it('should return with no errors', function(){
it.skip('should return with no errors', function(){
expect(function() {
ps.handle_inv(inv_info);
}).not.to.throw(Error);
});
it('should call sendGetData', function() {
it.skip('should call sendGetData', function() {
ps.handle_inv(inv_info);
expect(inv_info.conn.sendGetData.calledTwice).to.be.ok;
});
@ -44,7 +44,7 @@ describe('PeerSync', function() {
message: { tx: {getStandardizedObject: function(){
return {hash: 'dac28b5c5e70c16942718f3a22438348c1b709e01d398795fce8fc455178b973'};}}}
};
it('should call storeTxs', function(){
it.skip('should call storeTxs', function(){
var spy = sinon.spy(ps.sync, 'storeTxs');
ps.handle_tx(tx_info);
expect(spy.calledOnce).to.be.ok;
@ -57,7 +57,7 @@ describe('PeerSync', function() {
return new Buffer('01234');
}, txs: [{hash: new Buffer('cabafeca')}, {hash: new Buffer('bacacafe')}]}}
};
it('should call storeBlock', function(){
it.skip('should call storeBlock', function(){
var spy = sinon.spy(ps.sync, 'storeBlock');
ps.handle_block(block_info);
expect(spy.calledOnce).to.be.ok;
@ -65,7 +65,7 @@ describe('PeerSync', function() {
});
describe('#run()', function() {
it('should setup peerman', function() {
it.skip('should setup peerman', function() {
var startSpy = sinon.spy(ps.peerman, 'start');
var onSpy = sinon.spy(ps.peerman, 'on');
ps.run();

View File

@ -35,8 +35,8 @@
},
{
"addr": "mzW2hdZN2um7WBvTDerdahKqRgj3md9C29",
"balance": 910.3952268,
"totalReceived": 910.3952268,
"balance": 1036.76206223,
"totalReceived": 1036.76206223,
"totalSent": 0
},
{

View File

@ -50,16 +50,6 @@ describe('Status', function(){
});
});
it('getBestBlockHash', function(done) {
var d = new Status();
d.getBestBlockHash(function(err) {
if (err) done(err);
assert.equal('string', typeof d.bestblockhash);
done();
});
});
it('getLastBlockHash', function(done) {
var d = new Status();

View File

@ -60,7 +60,7 @@ describe('Transaction', function(){
assert.equal(tx.info.txid, txid);
assert.equal(tx.info.blockhash, '000000000185678d3d7ecc9962c96418174431f93fe20bf216d5565272423f74');
assert.equal(tx.info.valueOut, 1.66174);
assert.equal(tx.info.feeds, 0.0005 );
assert.equal(tx.info.fees, 0.0005 );
assert.equal(tx.info.size, 226 );
assert(!tx.info.isCoinBase);
done();
@ -78,9 +78,9 @@ describe('Transaction', function(){
});
});
var txid22 = '666';
it('test unexisting TX ' + txid22, function(done) {
it('test invalid TX ' + txid22, function(done) {
Transaction.fromIdWithInfo(txid22, function(err, tx) {
if (err && err.toString().match(/TX.not.found/)) {
if (err && err.message.match(/must.be.hexadecimal/)) {
return done();
}
else {
@ -89,6 +89,18 @@ describe('Transaction', function(){
});
});
var txid23 = '21798ddc9664ac0ef618f52b151dda82dafaf2e26d2bbef6cdaf55a6957ca227';
it('test unexisting TX ' + txid23, function(done) {
Transaction.fromIdWithInfo(txid23, function(err, tx) {
assert(!err);
assert(!tx);
return done();
});
});
var txid2 = '64496d005faee77ac5a18866f50af6b8dd1f60107d6795df34c402747af98608';
it('create TX on the fly ' + txid2, function(done) {
TransactionItem.remove({txid: txid2}, function(err) {