mirror of
https://github.com/Xahau/xahau.js.git
synced 2025-11-29 00:25:48 +00:00
[FIX] fix eslint errors
This commit is contained in:
26
test/fixtures/orderbook.js
vendored
26
test/fixtures/orderbook.js
vendored
@@ -1,6 +1,10 @@
|
||||
var _ = require('lodash');
|
||||
/*eslint-disable max-len */
|
||||
|
||||
'use strict';
|
||||
|
||||
var _ = require('lodash');
|
||||
var addresses = require('./addresses');
|
||||
var Meta = require('ripple-lib').Meta;
|
||||
var Meta = require('ripple-lib').Meta;
|
||||
|
||||
module.exports.FIAT_BALANCE = '10';
|
||||
module.exports.NATIVE_BALANCE = '55';
|
||||
@@ -93,7 +97,7 @@ module.exports.fiatOffers = function (options) {
|
||||
index: module.exports.OTHER_LEDGER_INDEX,
|
||||
owner_funds: options.other_account_funds,
|
||||
quality: '195796912.5171664'
|
||||
},
|
||||
}
|
||||
];
|
||||
};
|
||||
|
||||
@@ -161,7 +165,7 @@ module.exports.NATIVE_OFFERS = [
|
||||
index: 'D3338DA77BA23122FB5647B74B53636AB54BE246D4B21707C9D6887DEB334252',
|
||||
owner_funds: '235.0194163432668',
|
||||
quality: '195796912.5171664'
|
||||
},
|
||||
}
|
||||
];
|
||||
|
||||
module.exports.REQUEST_OFFERS = [
|
||||
@@ -638,7 +642,7 @@ module.exports.transactionWithInvalidAccountRoot = function(options) {
|
||||
options = options || {};
|
||||
_.defaults(options, {
|
||||
account: addresses.ACCOUNT,
|
||||
balance: module.exports.NATIVE_BALANCE,
|
||||
balance: module.exports.NATIVE_BALANCE
|
||||
});
|
||||
|
||||
return {
|
||||
@@ -700,7 +704,7 @@ module.exports.transactionWithCreatedOffer = function(options) {
|
||||
TransactionType: 'OfferCreate',
|
||||
owner_funds: '2010.027702881682'
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
module.exports.transactionWithDeletedOffer = function(options) {
|
||||
@@ -745,7 +749,7 @@ module.exports.transactionWithDeletedOffer = function(options) {
|
||||
TransactionType: options.transaction_type,
|
||||
owner_funds: '2010.027702881682'
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
module.exports.transactionWithModifiedOffer = function() {
|
||||
@@ -761,7 +765,7 @@ module.exports.transactionWithModifiedOffer = function() {
|
||||
TransactionType: 'OfferCreate',
|
||||
owner_funds: '2010.027702881682'
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
module.exports.transactionWithModifiedOffers = function() {
|
||||
@@ -777,7 +781,7 @@ module.exports.transactionWithModifiedOffers = function() {
|
||||
TransactionType: 'OfferCreate',
|
||||
owner_funds: '2010.027702881682'
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
module.exports.transactionWithNoNodes = function() {
|
||||
@@ -793,7 +797,7 @@ module.exports.transactionWithNoNodes = function() {
|
||||
TransactionType: 'OfferCreate',
|
||||
owner_funds: '2010.027702881682'
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
module.exports.accountInfoResponse = function(options) {
|
||||
@@ -819,4 +823,4 @@ module.exports.accountInfoResponse = function(options) {
|
||||
urlgravatar: 'http:www.gravatar.com/avatar/5b33b93c7ffe384d53450fc666bb11fb'
|
||||
}
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
@@ -1,5 +1,9 @@
|
||||
/*eslint-disable max-len */
|
||||
|
||||
'use strict';
|
||||
|
||||
var assert = require('assert-diff');
|
||||
var Remote = require('ripple-lib').Remote;
|
||||
var Remote = require('ripple-lib').Remote;
|
||||
var Currency = require('ripple-lib').Currency;
|
||||
var Amount = require('ripple-lib').Amount;
|
||||
var Meta = require('ripple-lib').Meta;
|
||||
@@ -64,7 +68,7 @@ describe('OrderBook', function() {
|
||||
done();
|
||||
};
|
||||
|
||||
book.on('model', function(){});
|
||||
book.on('model', function() {});
|
||||
});
|
||||
|
||||
it('Subscribe', function(done) {
|
||||
@@ -100,7 +104,7 @@ describe('OrderBook', function() {
|
||||
done();
|
||||
});
|
||||
|
||||
book.on('model', function(){});
|
||||
book.on('model', function() {});
|
||||
|
||||
book.unsubscribe();
|
||||
|
||||
@@ -120,7 +124,7 @@ describe('OrderBook', function() {
|
||||
done();
|
||||
};
|
||||
|
||||
book.on('model', function(){});
|
||||
book.on('model', function() {});
|
||||
book.removeAllListeners('model');
|
||||
});
|
||||
|
||||
@@ -135,7 +139,7 @@ describe('OrderBook', function() {
|
||||
done();
|
||||
};
|
||||
|
||||
book.once('model', function(){});
|
||||
book.once('model', function() {});
|
||||
book.emit('model', {});
|
||||
});
|
||||
|
||||
@@ -190,7 +194,7 @@ describe('OrderBook', function() {
|
||||
});
|
||||
|
||||
it('Has owner funds', function() {
|
||||
var book = new Remote().createOrderBook({
|
||||
var book = new Remote().createOrderBook({
|
||||
currency_gets: 'XRP',
|
||||
issuer_pays: addresses.ISSUER,
|
||||
currency_pays: 'BTC'
|
||||
@@ -441,7 +445,7 @@ describe('OrderBook', function() {
|
||||
remote.request = function(request) {
|
||||
assert.deepEqual(request.message, {
|
||||
command: 'account_info',
|
||||
id: void(0),
|
||||
id: undefined,
|
||||
account: addresses.ISSUER
|
||||
});
|
||||
|
||||
@@ -469,7 +473,7 @@ describe('OrderBook', function() {
|
||||
remote.request = function(request) {
|
||||
assert.deepEqual(request.message, {
|
||||
command: 'account_info',
|
||||
id: void(0),
|
||||
id: undefined,
|
||||
account: addresses.ISSUER
|
||||
});
|
||||
|
||||
@@ -495,7 +499,7 @@ describe('OrderBook', function() {
|
||||
|
||||
book._issuerTransferRate = 1002000000;
|
||||
|
||||
remote.request = function(request) {
|
||||
remote.request = function() {
|
||||
assert(false);
|
||||
};
|
||||
|
||||
@@ -513,7 +517,7 @@ describe('OrderBook', function() {
|
||||
currency_pays: 'BTC'
|
||||
});
|
||||
|
||||
remote.request = function(request) {
|
||||
remote.request = function() {
|
||||
assert(false);
|
||||
};
|
||||
|
||||
@@ -1116,7 +1120,7 @@ describe('OrderBook', function() {
|
||||
|
||||
book._offers = fixtures.fiatOffers();
|
||||
|
||||
book.on('offer_changed', function(offer) {
|
||||
book.on('offer_changed', function() {
|
||||
receivedChangedEvents += 1;
|
||||
});
|
||||
|
||||
@@ -1150,7 +1154,6 @@ describe('OrderBook', function() {
|
||||
});
|
||||
|
||||
it('Update funded amounts - increase funds', function() {
|
||||
var receivedChangedEvents = 0;
|
||||
var receivedFundsChangedEvents = 0;
|
||||
|
||||
var remote = new Remote();
|
||||
@@ -1252,7 +1255,7 @@ describe('OrderBook', function() {
|
||||
var receivedFundsChangedEvents = 0;
|
||||
|
||||
var remote = new Remote();
|
||||
|
||||
|
||||
var message = fixtures.transactionWithAccountRoot();
|
||||
|
||||
var book = remote.createOrderBook({
|
||||
@@ -1264,7 +1267,7 @@ describe('OrderBook', function() {
|
||||
book._synchronized = true;
|
||||
book._offers = fixtures.NATIVE_OFFERS;
|
||||
|
||||
book.on('offer_changed', function(offer) {
|
||||
book.on('offer_changed', function() {
|
||||
receivedChangedEvents += 1;
|
||||
});
|
||||
|
||||
@@ -1295,7 +1298,7 @@ describe('OrderBook', function() {
|
||||
|
||||
it('Update funded amounts - no affected account', function(done) {
|
||||
var remote = new Remote();
|
||||
|
||||
|
||||
var message = fixtures.transactionWithAccountRoot({
|
||||
account: addresses.ACCOUNT
|
||||
});
|
||||
@@ -1533,13 +1536,6 @@ describe('OrderBook', function() {
|
||||
it('Notify - created node', function() {
|
||||
var remote = new Remote();
|
||||
|
||||
var book = remote.createOrderBook({
|
||||
currency_gets: 'USD',
|
||||
issuer_gets: addresses.ISSUER,
|
||||
currency_pays: 'XRP'
|
||||
});
|
||||
var remote = new Remote();
|
||||
|
||||
var book = remote.createOrderBook({
|
||||
currency_gets: 'USD',
|
||||
issuer_gets: addresses.ISSUER,
|
||||
@@ -1637,13 +1633,6 @@ describe('OrderBook', function() {
|
||||
it('Notify - deleted node', function() {
|
||||
var remote = new Remote();
|
||||
|
||||
var book = remote.createOrderBook({
|
||||
currency_gets: 'USD',
|
||||
issuer_gets: addresses.ISSUER,
|
||||
currency_pays: 'XRP'
|
||||
});
|
||||
var remote = new Remote();
|
||||
|
||||
var book = remote.createOrderBook({
|
||||
currency_gets: 'USD',
|
||||
issuer_gets: addresses.ISSUER,
|
||||
@@ -1667,13 +1656,6 @@ describe('OrderBook', function() {
|
||||
it('Notify - deleted node - last offer', function() {
|
||||
var remote = new Remote();
|
||||
|
||||
var book = remote.createOrderBook({
|
||||
currency_gets: 'USD',
|
||||
issuer_gets: addresses.ISSUER,
|
||||
currency_pays: 'XRP'
|
||||
});
|
||||
var remote = new Remote();
|
||||
|
||||
var book = remote.createOrderBook({
|
||||
currency_gets: 'USD',
|
||||
issuer_gets: addresses.ISSUER,
|
||||
@@ -1772,13 +1754,6 @@ describe('OrderBook', function() {
|
||||
it('Notify - deleted node - offer cancel', function() {
|
||||
var remote = new Remote();
|
||||
|
||||
var book = remote.createOrderBook({
|
||||
currency_gets: 'USD',
|
||||
issuer_gets: addresses.ISSUER,
|
||||
currency_pays: 'XRP'
|
||||
});
|
||||
var remote = new Remote();
|
||||
|
||||
var book = remote.createOrderBook({
|
||||
currency_gets: 'USD',
|
||||
issuer_gets: addresses.ISSUER,
|
||||
@@ -1804,13 +1779,6 @@ describe('OrderBook', function() {
|
||||
it('Notify - deleted node - offer cancel - last offer', function() {
|
||||
var remote = new Remote();
|
||||
|
||||
var book = remote.createOrderBook({
|
||||
currency_gets: 'USD',
|
||||
issuer_gets: addresses.ISSUER,
|
||||
currency_pays: 'XRP'
|
||||
});
|
||||
var remote = new Remote();
|
||||
|
||||
var book = remote.createOrderBook({
|
||||
currency_gets: 'USD',
|
||||
issuer_gets: addresses.ISSUER,
|
||||
@@ -1835,13 +1803,6 @@ describe('OrderBook', function() {
|
||||
it('Notify - modified node', function() {
|
||||
var remote = new Remote();
|
||||
|
||||
var book = remote.createOrderBook({
|
||||
currency_gets: 'USD',
|
||||
issuer_gets: addresses.ISSUER,
|
||||
currency_pays: 'XRP'
|
||||
});
|
||||
var remote = new Remote();
|
||||
|
||||
var book = remote.createOrderBook({
|
||||
currency_gets: 'USD',
|
||||
issuer_gets: addresses.ISSUER,
|
||||
@@ -2094,7 +2055,7 @@ describe('OrderBook', function() {
|
||||
book.insertOffer(fixtures.transactionWithCreatedOffer({
|
||||
amount: '51.04587961502088'
|
||||
}).mmeta.getNodes()[0]);
|
||||
|
||||
|
||||
assert.strictEqual(book._offers.length, 2);
|
||||
|
||||
assert.strictEqual(book._offers[0].taker_gets_funded, '51.04587961502088');
|
||||
@@ -2223,7 +2184,7 @@ describe('OrderBook', function() {
|
||||
case 'book_offers':
|
||||
assert.deepEqual(request.message, {
|
||||
command: 'book_offers',
|
||||
id: void(0),
|
||||
id: undefined,
|
||||
taker_gets: {
|
||||
currency: '0000000000000000000000004254430000000000',
|
||||
issuer: addresses.ISSUER
|
||||
@@ -2252,7 +2213,7 @@ describe('OrderBook', function() {
|
||||
book._issuerTransferRate = 1002000000;
|
||||
|
||||
var expected = [
|
||||
{
|
||||
{
|
||||
Account: addresses.ACCOUNT,
|
||||
BookDirectory: '6EAB7C172DEFA430DBFAD120FDC373B5F5AF8B191649EC985711A3A4254F5000',
|
||||
BookNode: '0000000000000000',
|
||||
@@ -2260,7 +2221,8 @@ describe('OrderBook', function() {
|
||||
LedgerEntryType: 'Offer',
|
||||
OwnerNode: '0000000000000000',
|
||||
Sequence: 195,
|
||||
TakerGets: { currency: 'BTC',
|
||||
TakerGets: {
|
||||
currency: 'BTC',
|
||||
issuer: addresses.ISSUER,
|
||||
value: '0.1129232560043778'
|
||||
},
|
||||
@@ -2302,7 +2264,7 @@ describe('OrderBook', function() {
|
||||
taker_pays_funded: '99.72233516476456',
|
||||
quality: '498.6116758238228'
|
||||
},
|
||||
{
|
||||
{
|
||||
Account: addresses.THIRD_ACCOUNT,
|
||||
BookDirectory: '6EAB7C172DEFA430DBFAD120FDC373B5F5AF8B191649EC985711B6D8C62EF414',
|
||||
BookNode: '0000000000000000',
|
||||
@@ -2311,7 +2273,8 @@ describe('OrderBook', function() {
|
||||
LedgerEntryType: 'Offer',
|
||||
OwnerNode: '0000000000000144',
|
||||
Sequence: 29356,
|
||||
TakerGets: { currency: 'BTC',
|
||||
TakerGets: {
|
||||
currency: 'BTC',
|
||||
issuer: addresses.ISSUER,
|
||||
value: '0.5'
|
||||
},
|
||||
@@ -2327,7 +2290,7 @@ describe('OrderBook', function() {
|
||||
taker_pays_funded: '99.72233516476456',
|
||||
quality: '498.6116758238228'
|
||||
},
|
||||
{
|
||||
{
|
||||
Account: addresses.THIRD_ACCOUNT,
|
||||
BookDirectory: '6EAB7C172DEFA430DBFAD120FDC373B5F5AF8B191649EC985711B6D8C62EF414',
|
||||
BookNode: '0000000000000000',
|
||||
@@ -2464,9 +2427,9 @@ describe('OrderBook', function() {
|
||||
case 'book_offers':
|
||||
assert.deepEqual(request.message, {
|
||||
command: 'book_offers',
|
||||
id: void(0),
|
||||
id: undefined,
|
||||
taker_gets: {
|
||||
currency: '0000000000000000000000000000000000000000',
|
||||
currency: '0000000000000000000000000000000000000000'
|
||||
},
|
||||
taker_pays: {
|
||||
currency: '0000000000000000000000005553440000000000',
|
||||
|
||||
Reference in New Issue
Block a user