mirror of
https://github.com/Xahau/xahau.js.git
synced 2025-11-20 12:15:51 +00:00
[FIX] fix taker pays funded calculation
When calling `parseInt` on a string with scientific notation, it ignores the exponents.
This commit is contained in:
@@ -1533,6 +1533,27 @@ describe('OrderBook', function() {
|
||||
assert.strictEqual(book.getOwnerFunds(addresses.FOURTH_ACCOUNT).to_text(), '7229.594289344439');
|
||||
});
|
||||
|
||||
it('Set offers - incorrect taker pays funded', function() {
|
||||
var remote = new Remote();
|
||||
|
||||
var book = remote.createOrderBook({
|
||||
currency_gets: 'USD',
|
||||
issuer_gets: addresses.ISSUER,
|
||||
currency_pays: 'XRP'
|
||||
});
|
||||
|
||||
book._issuerTransferRate = 1002000000;
|
||||
|
||||
var offers = fixtures.DECIMAL_TAKER_PAYS_FUNDED_OFFERS;
|
||||
|
||||
book.setOffers(offers);
|
||||
|
||||
assert.strictEqual(book._offers.length, 1);
|
||||
|
||||
assert.strictEqual(book._offers[0].taker_gets_funded, '9261.514125778347');
|
||||
assert.strictEqual(book._offers[0].taker_pays_funded, '1704050437125');
|
||||
});
|
||||
|
||||
it('Notify - created node', function() {
|
||||
var remote = new Remote();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user