mirror of
https://github.com/XRPLF/rippled.git
synced 2025-11-20 11:05:54 +00:00
Add tests for ripple partial sends.
This commit is contained in:
@@ -12,7 +12,7 @@ var serverDelay = 1500;
|
|||||||
|
|
||||||
buster.testRunner.timeout = 3000;
|
buster.testRunner.timeout = 3000;
|
||||||
|
|
||||||
buster.testCase("// Sending", {
|
buster.testCase("Sending", {
|
||||||
'setUp' : testutils.build_setup(),
|
'setUp' : testutils.build_setup(),
|
||||||
'tearDown' : testutils.build_teardown(),
|
'tearDown' : testutils.build_teardown(),
|
||||||
|
|
||||||
@@ -234,7 +234,7 @@ buster.testCase("// Sending", {
|
|||||||
});
|
});
|
||||||
|
|
||||||
// XXX In the future add ledger_accept after partial retry is implemented in the server.
|
// XXX In the future add ledger_accept after partial retry is implemented in the server.
|
||||||
buster.testCase("// Sending future", {
|
buster.testCase("Sending future", {
|
||||||
'setUp' : testutils.build_setup(),
|
'setUp' : testutils.build_setup(),
|
||||||
'tearDown' : testutils.build_teardown(),
|
'tearDown' : testutils.build_teardown(),
|
||||||
|
|
||||||
@@ -242,7 +242,7 @@ buster.testCase("// Sending future", {
|
|||||||
function (done) {
|
function (done) {
|
||||||
var self = this;
|
var self = this;
|
||||||
|
|
||||||
self.remote.set_trace();
|
// self.remote.set_trace();
|
||||||
|
|
||||||
async.waterfall([
|
async.waterfall([
|
||||||
function (callback) {
|
function (callback) {
|
||||||
@@ -279,12 +279,6 @@ buster.testCase("// Sending future", {
|
|||||||
|
|
||||||
self.remote.request_ripple_balance("alice", "bob", "USD", 'CURRENT')
|
self.remote.request_ripple_balance("alice", "bob", "USD", 'CURRENT')
|
||||||
.once('ripple_state', function (m) {
|
.once('ripple_state', function (m) {
|
||||||
console.log("BALANCE: %s", JSON.stringify(m));
|
|
||||||
console.log("account_balance: %s", m.account_balance.to_text_full());
|
|
||||||
console.log("account_limit: %s", m.account_limit.to_text_full());
|
|
||||||
console.log("issuer_balance: %s", m.issuer_balance.to_text_full());
|
|
||||||
console.log("issuer_limit: %s", m.issuer_limit.to_text_full());
|
|
||||||
|
|
||||||
buster.assert(m.account_balance.equals("-24/USD/alice"));
|
buster.assert(m.account_balance.equals("-24/USD/alice"));
|
||||||
buster.assert(m.issuer_balance.equals("24/USD/bob"));
|
buster.assert(m.issuer_balance.equals("24/USD/bob"));
|
||||||
|
|
||||||
@@ -401,7 +395,7 @@ buster.testCase("// Sending future", {
|
|||||||
.payment('bob', 'alice', "1/USD/bob")
|
.payment('bob', 'alice', "1/USD/bob")
|
||||||
.once('proposed', function (m) {
|
.once('proposed', function (m) {
|
||||||
// console.log("proposed: %s", JSON.stringify(m));
|
// console.log("proposed: %s", JSON.stringify(m));
|
||||||
callback(m.result != 'tepPATH_PARTIAL');
|
callback(m.result != 'tepPATH_DRY');
|
||||||
})
|
})
|
||||||
.submit();
|
.submit();
|
||||||
},
|
},
|
||||||
@@ -454,14 +448,14 @@ buster.testCase("// Sending future", {
|
|||||||
});
|
});
|
||||||
|
|
||||||
buster.testCase("Indirect ripple", {
|
buster.testCase("Indirect ripple", {
|
||||||
'setUp' : testutils.build_setup({ verbose: true, no_server: false }),
|
'setUp' : testutils.build_setup({ verbose: false, no_server: false }),
|
||||||
'tearDown' : testutils.test_teardown,
|
'tearDown' : testutils.test_teardown,
|
||||||
|
|
||||||
"indirect ripple" :
|
"indirect ripple" :
|
||||||
function (done) {
|
function (done) {
|
||||||
var self = this;
|
var self = this;
|
||||||
|
|
||||||
self.remote.set_trace();
|
// self.remote.set_trace();
|
||||||
|
|
||||||
async.waterfall([
|
async.waterfall([
|
||||||
function (callback) {
|
function (callback) {
|
||||||
@@ -499,13 +493,40 @@ buster.testCase("Indirect ripple", {
|
|||||||
|
|
||||||
testutils.verify_balance(self.remote, "bob", "50/USD/mtgox", callback);
|
testutils.verify_balance(self.remote, "bob", "50/USD/mtgox", callback);
|
||||||
},
|
},
|
||||||
|
function (callback) {
|
||||||
|
self.what = "Alice sends more than has to issuer: 100 out of 70";
|
||||||
|
|
||||||
|
self.remote.transaction()
|
||||||
|
.payment("alice", "mtgox", "100/USD/mtgox")
|
||||||
|
.on('proposed', function (m) {
|
||||||
|
// console.log("proposed: %s", JSON.stringify(m));
|
||||||
|
|
||||||
|
callback(m.result != 'tepPATH_PARTIAL');
|
||||||
|
})
|
||||||
|
.submit();
|
||||||
|
},
|
||||||
|
function (callback) {
|
||||||
|
self.what = "Alice sends more than has to bob: 100 out of 70";
|
||||||
|
|
||||||
|
self.remote.transaction()
|
||||||
|
.payment("alice", "bob", "100/USD/mtgox")
|
||||||
|
.on('proposed', function (m) {
|
||||||
|
// console.log("proposed: %s", JSON.stringify(m));
|
||||||
|
|
||||||
|
callback(m.result != 'tepPATH_PARTIAL');
|
||||||
|
})
|
||||||
|
.submit();
|
||||||
|
},
|
||||||
], function (error) {
|
], function (error) {
|
||||||
buster.refute(error, self.what);
|
buster.refute(error, self.what);
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
// Direct ripple without no liqudity.
|
||||||
// Ripple without credit path.
|
// Ripple without credit path.
|
||||||
// Ripple with one-way credit path.
|
// Ripple with one-way credit path.
|
||||||
|
// Transfer Fees
|
||||||
|
// Use multiple paths.
|
||||||
});
|
});
|
||||||
// vim:sw=2:sts=2:ts=8
|
// vim:sw=2:sts=2:ts=8
|
||||||
|
|||||||
@@ -117,7 +117,7 @@ var credit_limit = function (remote, src, amount, callback) {
|
|||||||
remote.transaction()
|
remote.transaction()
|
||||||
.ripple_line_set(src, amount)
|
.ripple_line_set(src, amount)
|
||||||
.on('proposed', function (m) {
|
.on('proposed', function (m) {
|
||||||
console.log("proposed: %s", JSON.stringify(m));
|
// console.log("proposed: %s", JSON.stringify(m));
|
||||||
|
|
||||||
callback(m.result != 'tesSUCCESS');
|
callback(m.result != 'tesSUCCESS');
|
||||||
})
|
})
|
||||||
@@ -153,11 +153,11 @@ var verify_balance = function (remote, src, amount_json, callback) {
|
|||||||
|
|
||||||
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) {
|
.once('ripple_state', function (m) {
|
||||||
console.log("BALANCE: %s", JSON.stringify(m));
|
// console.log("BALANCE: %s", JSON.stringify(m));
|
||||||
console.log("account_balance: %s", m.account_balance.to_text_full());
|
// console.log("account_balance: %s", m.account_balance.to_text_full());
|
||||||
console.log("account_limit: %s", m.account_limit.to_text_full());
|
// console.log("account_limit: %s", m.account_limit.to_text_full());
|
||||||
console.log("issuer_balance: %s", m.issuer_balance.to_text_full());
|
// console.log("issuer_balance: %s", m.issuer_balance.to_text_full());
|
||||||
console.log("issuer_limit: %s", m.issuer_limit.to_text_full());
|
// console.log("issuer_limit: %s", m.issuer_limit.to_text_full());
|
||||||
|
|
||||||
callback(!m.account_balance.equals(amount));
|
callback(!m.account_balance.equals(amount));
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user