mirror of
https://github.com/XRPLF/rippled.git
synced 2025-11-20 02:55:50 +00:00
UT: Lots of improvements and fixes.
- Parse negative amounts. - Make Amount.negate() return a new value. - Add Amount.equals(). - Rename Remote.trace() to set_trace(). - Fix request_ripple_balnce. - Add more tests to send-test.js. - Add more tests to amount-test.js. - Add helper functions create_accounts and credit_limits to testutils.js.
This commit is contained in:
@@ -1,3 +1,6 @@
|
||||
var async = require("async");
|
||||
// var buster = require("buster");
|
||||
|
||||
var Remote = require("../js/remote.js").Remote;
|
||||
var Server = require("./server.js").Server;
|
||||
|
||||
@@ -28,6 +31,49 @@ var test_teardown = function (done, host) {
|
||||
.connect(false);
|
||||
};
|
||||
|
||||
var create_accounts = function (remote, src, amount, accounts, callback) {
|
||||
assert(5 === arguments.length);
|
||||
|
||||
async.forEachSeries(accounts, function (account, callback) {
|
||||
remote.transaction()
|
||||
.payment(src, account, amount)
|
||||
.set_flags('CreateAccount')
|
||||
.on('proposed', function (m) {
|
||||
// console.log("proposed: %s", JSON.stringify(m));
|
||||
|
||||
callback(m.result != 'tesSUCCESS');
|
||||
})
|
||||
.on('error', function (m) {
|
||||
// console.log("error: %s", JSON.stringify(m));
|
||||
|
||||
callback(m);
|
||||
})
|
||||
.submit();
|
||||
}, callback);
|
||||
};
|
||||
|
||||
var credit_limit = function (remote, src, amount, callback) {
|
||||
assert(4 === arguments.length);
|
||||
|
||||
remote.transaction()
|
||||
.ripple_line_set(src, amount)
|
||||
.on('proposed', function (m) {
|
||||
// console.log("proposed: %s", JSON.stringify(m));
|
||||
|
||||
// buster.assert.equals(m.result, 'tesSUCCESS');
|
||||
|
||||
callback(m.result != 'tesSUCCESS');
|
||||
})
|
||||
.on('error', function (m) {
|
||||
// console.log("error: %s", JSON.stringify(m));
|
||||
|
||||
callback(m);
|
||||
})
|
||||
.submit();
|
||||
};
|
||||
|
||||
exports.create_accounts = create_accounts;
|
||||
exports.credit_limit = credit_limit;
|
||||
exports.test_setup = test_setup;
|
||||
exports.test_teardown = test_teardown;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user