getBalances fixes:

obey limit, do not return XRP if currency or issuer specified
This commit is contained in:
Ivan Tivonenko
2015-10-15 05:04:13 +03:00
parent 462e440d5b
commit 4faa857330
3 changed files with 61 additions and 18 deletions

View File

@@ -196,9 +196,45 @@ describe('RippleAPI', function() {
});
});
it('getBalances', function() {
return this.api.getBalances(address).then(
_.partial(checkResult, responses.getBalances, 'getBalances'));
describe('RippleAPI', function() {
it('getBalances', function() {
return this.api.getBalances(address).then(
_.partial(checkResult, responses.getBalances, 'getBalances'));
});
it('getBalances - limit', function() {
const options = {
limit: 3
};
const expectedResponse = responses.getBalances.slice(0, 3);
return this.api.getBalances(address, options).then(
_.partial(checkResult, expectedResponse, 'getBalances'));
});
it('getBalances - limit & currency', function() {
const options = {
currency: 'USD',
limit: 3
};
const expectedResponse = _.filter(responses.getBalances,
item => item.currency === 'USD').slice(0, 3);
return this.api.getBalances(address, options).then(
_.partial(checkResult, expectedResponse, 'getBalances'));
});
it('getBalances - limit & currency & issuer', function() {
const options = {
currency: 'USD',
counterparty: 'rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B',
limit: 3
};
const expectedResponse = _.filter(responses.getBalances,
item => item.currency === 'USD' &&
item.counterparty === 'rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B').slice(0, 3);
return this.api.getBalances(address, options).then(
_.partial(checkResult, expectedResponse, 'getBalances'));
});
});
it('getBalanceSheet', function() {