UT: Rework server.js and clean up test output.

This commit is contained in:
Arthur Britto
2012-10-20 17:04:33 -07:00
parent 23b29956d3
commit 27ea314f8d
8 changed files with 203 additions and 241 deletions

View File

@@ -4,14 +4,11 @@
var utils = require('./utils.js');
var jsbn = require('./jsbn.js');
// Don't include in browser context.
var config = require('../test/config.js');
var BigInteger = jsbn.BigInteger;
var accounts = {};
var setAccounts = function (accounts_new) {
accounts = accounts_new;
};
var UInt160 = function () {
// Internal form:
// 0, 1, 'iXXXXX', 20 byte string, or NaN.
@@ -44,8 +41,8 @@ UInt160.prototype.copyTo = function(d) {
// value = NaN on error.
UInt160.prototype.parse_json = function (j) {
// Canonicalize and validate
if (j in accounts)
j = accounts[j].account;
if (config.accounts && j in config.accounts)
j = config.accounts[j].account;
switch (j) {
case undefined:
@@ -445,7 +442,6 @@ Amount.prototype.parse_issuer = function (issuer) {
return this;
};
exports.setAccounts = setAccounts;
exports.Amount = Amount;
exports.Currency = Currency;
exports.UInt160 = UInt160;