change order to 'desc'

This commit is contained in:
Matias Alejo Garcia 2018-02-11 19:47:52 -03:00
parent 01a3df31c8
commit 0c24271833
2 changed files with 8 additions and 8 deletions

View File

@ -79,7 +79,7 @@ AddressService.prototype.getAddressHistory = function(addresses, options, callba
}); });
options.txIdList = lodash.sortBy(list,['height','txid']); options.txIdList = lodash.orderBy(list,['height','txid'], ['desc','asc']);
self._getAddressTxHistory(options, function(err, txList) { self._getAddressTxHistory(options, function(err, txList) {
if (err) { if (err) {

View File

@ -81,19 +81,19 @@ describe('Address Service', function() {
addressService._getAddressTxidHistory = function(addr, options, cb) { addressService._getAddressTxidHistory = function(addr, options, cb) {
options.txIdList = [ options.txIdList = [
{ {
txid: "b", txid: "d",
height: 10,
},
{
txid: "c",
height: 10, height: 10,
}, },
{ {
txid: "a", txid: "a",
height: 10,
},
{
txid: "d",
height: 101, height: 101,
}, },
{ {
txid: "c", txid: "b",
height: 100, height: 100,
}, },
]; ];
@ -163,7 +163,7 @@ describe('Address Service', function() {
} }
expect(res.totalCount).equal(3); expect(res.totalCount).equal(3);
expect(lodash.map(res.items,'txid')).to.be.deep.equal(['b','c','d']); expect(lodash.map(res.items,'txid')).to.be.deep.equal(['d','c','b']);
addressService._getAddressTxidHistory = old_getAddressTxHistory; addressService._getAddressTxidHistory = old_getAddressTxHistory;
addressService._getAddressTxHistory = old_getAddressTxHistory; addressService._getAddressTxHistory = old_getAddressTxHistory;