insight-ui-zcash/test/integration/block.js

41 lines
1005 B
JavaScript
Raw Normal View History

2014-01-08 11:29:39 -08:00
#!/usr/bin/env node
'use strict';
2014-01-08 11:29:39 -08:00
process.env.NODE_ENV = process.env.NODE_ENV || 'development';
var TESTING_BLOCK = '000000000185678d3d7ecc9962c96418174431f93fe20bf216d5565272423f74';
2014-01-08 11:29:39 -08:00
var
2014-01-08 11:29:39 -08:00
assert = require('assert'),
2014-02-08 15:09:54 -08:00
// config = require('../../config/config'),
2014-02-03 22:22:58 -08:00
BlockDb = require('../../lib/BlockDb').class();
2014-01-08 11:29:39 -08:00
2014-02-05 06:23:41 -08:00
var bDb;
2014-01-08 11:29:39 -08:00
2014-02-03 22:22:58 -08:00
describe('BlockDb fromHashWithInfo', function(){
2014-01-08 12:04:45 -08:00
2014-02-05 06:23:41 -08:00
before(function(c) {
bDb = new BlockDb();
return c();
});
2014-01-10 11:02:33 -08:00
it('should poll block\'s info from bitcoind', function(done) {
2014-02-05 06:23:41 -08:00
bDb.fromHashWithInfo(TESTING_BLOCK, function(err, b2) {
2014-01-10 11:02:33 -08:00
if (err) done(err);
2014-02-03 22:22:58 -08:00
assert.equal(b2.hash, TESTING_BLOCK);
2014-01-10 11:02:33 -08:00
assert.equal(b2.info.hash, TESTING_BLOCK);
assert.equal(b2.info.chainwork, '000000000000000000000000000000000000000000000000001b6dc969ffe847');
2014-01-10 11:02:33 -08:00
done();
2014-01-08 11:29:39 -08:00
});
});
2014-02-03 22:22:58 -08:00
it('return true in has', function(done) {
2014-02-05 06:23:41 -08:00
bDb.has(TESTING_BLOCK, function(err, has) {
2014-02-03 22:22:58 -08:00
assert.equal(has, true);
done();
});
});
2014-01-08 11:29:39 -08:00
});