diff --git a/__tests__/unit/components/utils/merge-table-transactions.spec.js b/__tests__/unit/components/utils/merge-table-transactions.spec.js index 3f3a4d6923..17fb7ce103 100644 --- a/__tests__/unit/components/utils/merge-table-transactions.spec.js +++ b/__tests__/unit/components/utils/merge-table-transactions.spec.js @@ -5,12 +5,12 @@ describe('Utils > mergeTableTransactions', () => { beforeEach(() => { transactions = [ - { id: 'tx1', timestamp: 1 }, - { id: 'tx2', timestamp: 2 }, - { id: 'tx3', timestamp: 8 }, - { id: 'tx4', timestamp: 9 }, - { id: 'tx5', timestamp: 5 }, - { id: 'tx6', timestamp: 6 } + { id: 'tx1', timestamp: 1, amount: '6' }, + { id: 'tx2', timestamp: 2, amount: '5' }, + { id: 'tx3', timestamp: 8, amount: '9' }, + { id: 'tx4', timestamp: 9, amount: '8' }, + { id: 'tx5', timestamp: 5, amount: '2' }, + { id: 'tx6', timestamp: 6, amount: '1' } ] }) @@ -31,6 +31,40 @@ describe('Utils > mergeTableTransactions', () => { ]) }) + it('should return the transactions sorted by `timestamp` ascendently', () => { + const a = [ + transactions[0], + transactions[2] + ] + const b = [ + transactions[1], + transactions[5] + ] + expect(mergeTableTransactions(a, b, { field: 'timestamp', type: 'asc' })).toEqual([ + transactions[0], + transactions[1], + transactions[5], + transactions[2] + ]) + }) + + it('should return the transactions sorted by `amount` ascendently', () => { + const a = [ + transactions[0], + transactions[2] + ] + const b = [ + transactions[1], + transactions[5] + ] + expect(mergeTableTransactions(a, b, { field: 'amount', type: 'asc' })).toEqual([ + transactions[5], + transactions[1], + transactions[0], + transactions[2] + ]) + }) + describe('when there are duplicates', () => { it('should not return duplicates', () => { const a = [ diff --git a/__tests__/unit/pages/Profile/ProfileAll.spec.js b/__tests__/unit/pages/Profile/ProfileAll.spec.js index 0b64089589..c1d2ba19a6 100644 --- a/__tests__/unit/pages/Profile/ProfileAll.spec.js +++ b/__tests__/unit/pages/Profile/ProfileAll.spec.js @@ -36,7 +36,7 @@ describe('pages > ProfileAll', () => { 'network/byToken': token => networkBy('token', token), 'network/bySymbol': symbol => networkBy('symbol', symbol), 'profile/all': profiles, - 'profile/balanceWithLedger': _id => 13700000, + 'profile/balanceWithLedger': _id => new BigNumber(13700000), 'wallet/byProfileId': id => wallets[id] } }, @@ -62,20 +62,20 @@ describe('pages > ProfileAll', () => { ] wallets = { p1: [ - { address: 'M0', balance: 1000 }, - { address: 'M1', balance: 15089900 } + { address: 'M0', balance: '1000' }, + { address: 'M1', balance: '15089900' } ], p2: [ - { address: 'O0', balance: 12000000 }, - { address: 'O1', balance: 190000 } + { address: 'O0', balance: '12000000' }, + { address: 'O1', balance: '190000' } ], p3: [ - { address: 'M2', balance: 0 }, - { address: 'M3', balance: 50000000000 } + { address: 'M2', balance: '0' }, + { address: 'M3', balance: '50000000000' } ], p4: [ - { address: 'D0', balance: 1110000 }, - { address: 'D1', balance: 50900000 } + { address: 'D0', balance: '1110000' }, + { address: 'D1', balance: '50900000' } ] } ledgerWallets = [] @@ -110,8 +110,8 @@ describe('pages > ProfileAll', () => { describe('when the Ledger has wallets on the current network', () => { beforeEach(() => { ledgerWallets = [ - { address: 'MxLedger0', balance: 9883102007 }, - { address: 'MxLedger1', balance: 6723900701 } + { address: 'MxLedger0', balance: '9883102007' }, + { address: 'MxLedger1', balance: '6723900701' } ] }) @@ -150,8 +150,8 @@ describe('pages > ProfileAll', () => { describe('when the Ledger has wallets on the current network', () => { beforeEach(() => { ledgerWallets = [ - { address: 'MxLedger0', balance: 9883102007 }, - { address: 'MxLedger1', balance: 6723900701 } + { address: 'MxLedger0', balance: '9883102007' }, + { address: 'MxLedger1', balance: '6723900701' } ] }) diff --git a/__tests__/unit/services/client.spec.js b/__tests__/unit/services/client.spec.js index d7c2979e77..28d47f3f56 100644 --- a/__tests__/unit/services/client.spec.js +++ b/__tests__/unit/services/client.spec.js @@ -421,8 +421,8 @@ describe('Services > Client', () => { transactions.forEach((transaction, i) => { expect(transaction).toHaveProperty('totalAmount') - expect(transaction.totalAmount).toBeInstanceOf(BigNumber) - expect(transaction.totalAmount.toString()).toBe((data[i].amount + data[i].fee).toString()) + expect(transaction.totalAmount).toBeString() + expect(transaction.totalAmount).toEqual(new BigNumber(data[i].amount).plus(data[i].fee).toString()) expect(transaction).toHaveProperty('timestamp', data[i].timestamp.unix * 1000) expect(transaction).toHaveProperty('isSender') expect(transaction).toHaveProperty('isRecipient') diff --git a/package.json b/package.json index de7d88df3a..73c3ac1bfa 100644 --- a/package.json +++ b/package.json @@ -93,7 +93,7 @@ "vm2": "^3.8.4", "vue": "^2.6.10", "vue-chartjs": "^3.4.2", - "vue-good-table": "2.16.5", + "vue-good-table": "^2.18.0", "vue-i18n": "^8.12.0", "vue-qrcode-reader": "^2.0.3", "vue-router": "^3.0.7", diff --git a/src/renderer/components/Transaction/TransactionConfirm/TransactionConfirm.vue b/src/renderer/components/Transaction/TransactionConfirm/TransactionConfirm.vue index e43d77dc4b..98d64812f7 100644 --- a/src/renderer/components/Transaction/TransactionConfirm/TransactionConfirm.vue +++ b/src/renderer/components/Transaction/TransactionConfirm/TransactionConfirm.vue @@ -1,7 +1,7 @@