mirror of
https://github.com/XRPLF/rippled.git
synced 2025-11-20 19:15:54 +00:00
UT: Update offer-test for new Transaction split.
This commit is contained in:
@@ -15,8 +15,8 @@ require("../src/js/remote").config = require("./config");
|
|||||||
buster.testRunner.timeout = 5000;
|
buster.testRunner.timeout = 5000;
|
||||||
|
|
||||||
buster.testCase("Offer tests", {
|
buster.testCase("Offer tests", {
|
||||||
'setUp' : testutils.build_setup(),
|
// 'setUp' : testutils.build_setup(),
|
||||||
// 'setUp' : testutils.build_setup({ verbose: true, standalone: false }),
|
'setUp' : testutils.build_setup({ verbose: true, standalone: false }),
|
||||||
'tearDown' : testutils.build_teardown(),
|
'tearDown' : testutils.build_teardown(),
|
||||||
|
|
||||||
"offer create then cancel in one ledger" :
|
"offer create then cancel in one ledger" :
|
||||||
@@ -168,8 +168,8 @@ buster.testCase("Offer tests", {
|
|||||||
|
|
||||||
testutils.verify_balances(self.remote,
|
testutils.verify_balances(self.remote,
|
||||||
{
|
{
|
||||||
"alice" : [ "499/USD/mtgox", String(100000000000+4000000000-2*(Remote.fees['default'].to_number())) ],
|
"alice" : [ "499/USD/mtgox", String(100000000000+4000000000-2*(Transaction.fees['default'].to_number())) ],
|
||||||
"bob" : [ "1/USD/mtgox", String(100000000000-4000000000-2*(Remote.fees['default'].to_number())) ],
|
"bob" : [ "1/USD/mtgox", String(100000000000-4000000000-2*(Transaction.fees['default'].to_number())) ],
|
||||||
},
|
},
|
||||||
callback);
|
callback);
|
||||||
},
|
},
|
||||||
@@ -224,7 +224,7 @@ buster.testCase("Offer tests", {
|
|||||||
self.what = "Create first offer.";
|
self.what = "Create first offer.";
|
||||||
|
|
||||||
self.remote.transaction()
|
self.remote.transaction()
|
||||||
.offer_create("alice", "150000.0", "50/USD/mtgox")
|
.offer_create("alice", "150000.0", "50/USD/mtgox") // 3000 XRP = 1 USD
|
||||||
.on('proposed', function (m) {
|
.on('proposed', function (m) {
|
||||||
// console.log("PROPOSED: offer_create: %s", JSON.stringify(m));
|
// console.log("PROPOSED: offer_create: %s", JSON.stringify(m));
|
||||||
|
|
||||||
@@ -236,7 +236,7 @@ buster.testCase("Offer tests", {
|
|||||||
self.what = "Create crossing offer.";
|
self.what = "Create crossing offer.";
|
||||||
|
|
||||||
self.remote.transaction()
|
self.remote.transaction()
|
||||||
.offer_create("bob", "1/USD/mtgox", "4000.0")
|
.offer_create("bob", "1/USD/mtgox", "3000.0")
|
||||||
.on('proposed', function (m) {
|
.on('proposed', function (m) {
|
||||||
// console.log("PROPOSED: offer_create: %s", JSON.stringify(m));
|
// console.log("PROPOSED: offer_create: %s", JSON.stringify(m));
|
||||||
|
|
||||||
@@ -249,8 +249,8 @@ buster.testCase("Offer tests", {
|
|||||||
|
|
||||||
testutils.verify_balances(self.remote,
|
testutils.verify_balances(self.remote,
|
||||||
{
|
{
|
||||||
"alice" : [ "499/USD/mtgox", String(100000000000+4000000000-2*(Remote.fees['default'].to_number())) ],
|
"alice" : [ "499/USD/mtgox", String(100000000000+3000000000-2*(Transaction.fees['default'].to_number())) ],
|
||||||
"bob" : [ "1/USD/mtgox", String(100000000000-4000000000-2*(Remote.fees['default'].to_number())) ],
|
"bob" : [ "1/USD/mtgox", String(100000000000-3000000000-2*(Transaction.fees['default'].to_number())) ],
|
||||||
},
|
},
|
||||||
callback);
|
callback);
|
||||||
},
|
},
|
||||||
@@ -305,7 +305,7 @@ buster.testCase("Offer tests", {
|
|||||||
self.what = "Create first offer.";
|
self.what = "Create first offer.";
|
||||||
|
|
||||||
self.remote.transaction()
|
self.remote.transaction()
|
||||||
.offer_create("alice", "150000.0", "50/USD/mtgox")
|
.offer_create("alice", "150000.0", "50/USD/mtgox") // 300 XRP = 1 USD
|
||||||
.on('proposed', function (m) {
|
.on('proposed', function (m) {
|
||||||
// console.log("PROPOSED: offer_create: %s", JSON.stringify(m));
|
// console.log("PROPOSED: offer_create: %s", JSON.stringify(m));
|
||||||
|
|
||||||
@@ -328,7 +328,7 @@ buster.testCase("Offer tests", {
|
|||||||
self.what = "Create crossing offer.";
|
self.what = "Create crossing offer.";
|
||||||
|
|
||||||
self.remote.transaction()
|
self.remote.transaction()
|
||||||
.offer_create("bob", "1/USD/mtgox", "4000.0")
|
.offer_create("bob", "1/USD/mtgox", "3000.0") //
|
||||||
.on('proposed', function (m) {
|
.on('proposed', function (m) {
|
||||||
// console.log("PROPOSED: offer_create: %s", JSON.stringify(m));
|
// console.log("PROPOSED: offer_create: %s", JSON.stringify(m));
|
||||||
|
|
||||||
@@ -341,8 +341,8 @@ buster.testCase("Offer tests", {
|
|||||||
|
|
||||||
testutils.verify_balances(self.remote,
|
testutils.verify_balances(self.remote,
|
||||||
{
|
{
|
||||||
"alice" : [ "499/USD/mtgox", String(100000000000+4000000000-2*(Remote.fees['default'].to_number())) ],
|
"alice" : [ "499/USD/mtgox", String(100000000000+3000000000-2*(Transaction.fees['default'].to_number())) ],
|
||||||
"bob" : [ "1/USD/mtgox", String(100000000000-4000000000-1*(Remote.fees['default'].to_number())) ],
|
"bob" : [ "1/USD/mtgox", String(100000000000-3000000000-1*(Transaction.fees['default'].to_number())) ],
|
||||||
},
|
},
|
||||||
callback);
|
callback);
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -309,7 +309,7 @@ var verify_balance = function (remote, src, amount_json, callback) {
|
|||||||
var account_balance = Amount.from_json(m.account_balance);
|
var account_balance = Amount.from_json(m.account_balance);
|
||||||
|
|
||||||
if (!account_balance.equals(amount_req)) {
|
if (!account_balance.equals(amount_req)) {
|
||||||
console.log("verify_balance: failed: %s vs %s is %s: %s", src, account_balance.to_text_full(), amount_req.to_text_full(), account_balance.not_equals_why(amount_req));
|
console.log("verify_balance: failed: %s vs %s / %s: %s", src, account_balance.to_text_full(), amount_req.to_text_full(), account_balance.not_equals_why(amount_req));
|
||||||
}
|
}
|
||||||
|
|
||||||
callback(!account_balance.equals(amount_req));
|
callback(!account_balance.equals(amount_req));
|
||||||
|
|||||||
Reference in New Issue
Block a user