Use a local data directory specific for reg testing.

This commit is contained in:
Braydon Fuller 2015-07-21 17:32:24 -04:00
parent 072c109174
commit bcc3a4c2e1
4 changed files with 45 additions and 29 deletions

View File

@ -11,4 +11,4 @@ before_install:
- git config --global user.email "dev@bitpay.com" - git config --global user.email "dev@bitpay.com"
- git config --global user.name "BitPay, Inc." - git config --global user.name "BitPay, Inc."
script: script:
- mocha -R spec integration/regtest.js - _mocha -R spec integration/regtest.js

View File

@ -0,0 +1,8 @@
server=1
whitelist=127.0.0.1
txindex=1
rpcallowip=127.0.0.1
rpcuser=bitcoin
rpcpassword=local321

View File

@ -5,6 +5,7 @@
var chai = require('chai'); var chai = require('chai');
var bitcore = require('bitcore'); var bitcore = require('bitcore');
var rimraf = require('rimraf');
var bitcoind; var bitcoind;
/* jshint unused: false */ /* jshint unused: false */
@ -17,13 +18,16 @@ describe('Basic Functionality', function() {
before(function(done) { before(function(done) {
this.timeout(30000); this.timeout(30000);
rimraf('./data/regtest', function(err) {
if (err) {
throw err;
}
bitcoind = require('../').daemon({ bitcoind = require('../').daemon({
datadir: process.env.BITCOINDJS_DIR || '~/.bitcoin', datadir: './data',
network: 'regtest', network: 'regtest'
server: true,
rpcuser: 'bitcoin',
rpcpassword: 'local321',
rpcallowip: '127.0.0.1'
}); });
bitcoind.on('error', function(err) { bitcoind.on('error', function(err) {
@ -46,9 +50,10 @@ describe('Basic Functionality', function() {
pass: 'local321' pass: 'local321'
}); });
client.generate(100, function(err, result) { client.generate(100, function(err) {
console.log('err', err); if (err) {
console.log('result', result); throw err;
}
done(); done();
}); });
@ -56,6 +61,8 @@ describe('Basic Functionality', function() {
}); });
});
after(function(done) { after(function(done) {
this.timeout(20000); this.timeout(20000);
bitcoind.stop(function(err, result) { bitcoind.stop(function(err, result) {

View File

@ -55,6 +55,7 @@
"chai": "^3.0.0", "chai": "^3.0.0",
"mocha": "~1.16.2", "mocha": "~1.16.2",
"proxyquire": "^1.3.1", "proxyquire": "^1.3.1",
"rimraf": "^2.4.2",
"sinon": "^1.15.4" "sinon": "^1.15.4"
} }
} }