JS: Make currency and issuer private in Amount.

This commit is contained in:
Arthur Britto
2012-11-09 17:33:37 -08:00
parent 9960bfa63f
commit 8d32892609
5 changed files with 48 additions and 42 deletions

View File

@@ -339,8 +339,6 @@ buster.testCase("Offer tests", {
var self = this;
var seq;
self.remote.set_trace();
async.waterfall([
function (callback) {
self.what = "Create accounts.";
@@ -367,6 +365,8 @@ buster.testCase("Offer tests", {
callback);
},
function (callback) {
self.what = "Create offer.";
self.remote.transaction()
.offer_create("bob", "100/USD/mtgox", "500")
.on('proposed', function (m) {
@@ -389,7 +389,7 @@ buster.testCase("Offer tests", {
.payment("alice", "alice", "500")
.send_max("100/USD/mtgox")
.on('proposed', function (m) {
console.log("proposed: %s", JSON.stringify(m));
// console.log("proposed: %s", JSON.stringify(m));
callback(m.result !== 'tesSUCCESS');
})
@@ -421,8 +421,6 @@ buster.testCase("Offer tests", {
var self = this;
var seq;
self.remote.set_trace();
async.waterfall([
function (callback) {
self.what = "Create accounts.";
@@ -449,6 +447,8 @@ buster.testCase("Offer tests", {
callback);
},
function (callback) {
self.what = "Create offer.";
self.remote.transaction()
.offer_create("bob", "100/USD/mtgox", "500")
.on('proposed', function (m) {
@@ -466,7 +466,7 @@ buster.testCase("Offer tests", {
.payment("alice", "alice", "200")
.send_max("100/USD/mtgox")
.on('proposed', function (m) {
console.log("proposed: %s", JSON.stringify(m));
// console.log("proposed: %s", JSON.stringify(m));
callback(m.result !== 'tesSUCCESS');
})
@@ -494,10 +494,8 @@ buster.testCase("Offer tests", {
.payment("alice", "alice", "600")
.send_max("100/USD/mtgox")
.on('proposed', function (m) {
console.log("proposed: %s", JSON.stringify(m));
// console.log("proposed: %s", JSON.stringify(m));
console.log("callback: %d", m.result !== 'tepPATH_PARTIAL');
console.log("callback: %s", m.result);
callback(m.result !== 'tepPATH_PARTIAL');
})
.submit();
@@ -510,7 +508,7 @@ buster.testCase("Offer tests", {
.send_max("100/USD/mtgox")
.set_flags('PartialPayment')
.on('proposed', function (m) {
console.log("proposed: %s", JSON.stringify(m));
// console.log("proposed: %s", JSON.stringify(m));
callback(m.result !== 'tesSUCCESS');
})

View File

@@ -13,7 +13,7 @@ require("../src/js/remote.js").config = require("./config.js");
// How long to wait for server to start.
var serverDelay = 1500;
buster.testRunner.timeout = 3000;
buster.testRunner.timeout = 5000;
buster.testCase("Sending", {
'setUp' : testutils.build_setup(),
@@ -451,7 +451,7 @@ buster.testCase("Sending future", {
});
buster.testCase("Indirect ripple", {
'setUp' : testutils.build_setup({ verbose: false, no_server: false }),
'setUp' : testutils.build_setup(),
'tearDown' : testutils.build_teardown(),
"indirect ripple" :

View File

@@ -187,7 +187,7 @@ var payments = function (remote, balances, callback) {
var amount_json = values[index];
var amount = Amount.from_json(amount_json);
sends.push( { "source" : src, "destination" : amount.issuer.to_json(), "amount" : amount_json } );
sends.push( { "source" : src, "destination" : amount.issuer().to_json(), "amount" : amount_json } );
}
}
@@ -229,7 +229,7 @@ var verify_balance = function (remote, src, amount_json, callback) {
callback();
}
else {
remote.request_ripple_balance(src, amount.issuer.to_json(), amount.currency.to_json(), 'CURRENT')
remote.request_ripple_balance(src, amount.issuer().to_json(), amount.currency().to_json(), 'CURRENT')
.once('ripple_state', function (m) {
// console.log("BALANCE: %s", JSON.stringify(m));
// console.log("account_balance: %s", m.account_balance.to_text_full());
@@ -303,7 +303,7 @@ var verify_offer_not_found = function (remote, owner, seq, callback) {
callback('entryFound');
})
.on('error', function (m) {
console.log("verify_no_offer: success: %s", JSON.stringify(m));
// console.log("verify_no_offer: success: %s", JSON.stringify(m));
callback('remoteError' !== m.error
|| 'entryNotFound' !== m.remote.error);