JS Tests: Fallback to config-example if config is not present.

This commit is contained in:
Stefan Thomas
2013-07-27 19:47:51 -07:00
parent 1d5802fd1c
commit ccde264282
10 changed files with 31 additions and 21 deletions

View File

@@ -218,6 +218,20 @@ var credit_limit = function (remote, src, amount, callback) {
}
};
function init_config() {
var cfg;
// See if the person testing wants to override the configuration by creating a
// file called test/config.js.
try {
cfg = require('./config');
} catch (e) {
cfg = require('./config-example');
}
return require('ripple-lib').config.load(cfg);
}
var verify_limit = function (remote, src, amount, callback) {
assert(4 === arguments.length);
@@ -486,6 +500,7 @@ exports.build_teardown = build_teardown;
exports.create_accounts = create_accounts;
exports.credit_limit = credit_limit;
exports.credit_limits = credit_limits;
exports.init_config = init_config;
exports.ledger_close = ledger_close;
exports.payment = payment;
exports.payments = payments;