diff --git a/__tests__/unit/__utils__/setup.js b/__tests__/unit/__utils__/setup.js index 6d1fe0c1da..0e04df46d6 100644 --- a/__tests__/unit/__utils__/setup.js +++ b/__tests__/unit/__utils__/setup.js @@ -19,3 +19,4 @@ VueTestUtils.config.mocks.currency_subToUnit = jest.fn() VueTestUtils.config.mocks.currency_format = jest.fn() VueTestUtils.config.mocks.session_network = jest.fn() VueTestUtils.config.mocks.session_profile = jest.fn() +VueTestUtils.config.mocks.wallet_fromRoute = {} diff --git a/__tests__/unit/services/client.spec.js b/__tests__/unit/services/client.spec.js index 76a829e9d3..216cd45d6e 100644 --- a/__tests__/unit/services/client.spec.js +++ b/__tests__/unit/services/client.spec.js @@ -305,7 +305,7 @@ describe('Services > Client', () => { const resource = resource => { if (resource === 'transactions') { return { - all: () => ({ data: { transactions, success: true } }) + all: () => ({ data: { transactions, success: true, count: 3 } }) } } } @@ -315,9 +315,13 @@ describe('Services > Client', () => { it('should return only some properties for each transaction', async () => { const response = await client.fetchTransactions('address') + expect(response).toHaveProperty('transactions') + expect(response).toHaveProperty('totalCount') - expect(response).toHaveLength(data.length) - response.forEach((transaction, i) => { + const transactions = response.transactions + expect(transactions).toHaveLength(data.length) + + transactions.forEach((transaction, i) => { expect(transaction).toHaveProperty('totalAmount', data[i].amount + data[i].fee) expect(transaction).toHaveProperty('timestamp') expect(transaction.timestamp.toJSON()).toBe(data[i].timestamp.human) @@ -344,7 +348,7 @@ describe('Services > Client', () => { const resource = resource => { if (resource === 'wallets') { return { - transactions: () => ({ data: { data: transactions } }) + transactions: () => ({ data: { data: transactions, meta: { totalCount: 3 } } }) } } } @@ -354,9 +358,13 @@ describe('Services > Client', () => { it('should return only some properties for each transaction', async () => { const response = await client.fetchTransactions('address') + expect(response).toHaveProperty('transactions') + expect(response).toHaveProperty('totalCount') + + const transactions = response.transactions + expect(transactions).toHaveLength(data.length) - expect(response).toHaveLength(data.length) - response.forEach((transaction, i) => { + transactions.forEach((transaction, i) => { expect(transaction).toHaveProperty('totalAmount', data[i].amount + data[i].fee) expect(transaction).toHaveProperty('timestamp') expect(transaction.timestamp.toJSON()).toBe(data[i].timestamp.human) diff --git a/package.json b/package.json index 5ab05683db..af1859be7d 100644 --- a/package.json +++ b/package.json @@ -92,6 +92,7 @@ "vue-good-table": "^2.14.1", "vue-i18n": "^8.1.0", "vue-router": "^3.0.1", + "vue-spinner": "^1.0.3", "vue-vuelidate-jsonschema": "^0.13.4", "vuelidate": "^0.7.4", "vuex": "^3.0.1", diff --git a/src/renderer/components/Dashboard/DashboardTransactions.vue b/src/renderer/components/Dashboard/DashboardTransactions.vue index 8743503ac7..ec03a43cbe 100644 --- a/src/renderer/components/Dashboard/DashboardTransactions.vue +++ b/src/renderer/components/Dashboard/DashboardTransactions.vue @@ -51,7 +51,7 @@ export default { try { // TODO if wallets.length > 20 do it in batches this.wallets.map(async wallet => { - const transactions = await this.$client.fetchTransactions(wallet.address) + const { transactions } = await this.$client.fetchTransactions(wallet.address) // Update the transactions when they are received this.transactions = uniqBy([ diff --git a/src/renderer/components/Transaction/TransactionTable.vue b/src/renderer/components/Transaction/TransactionTable.vue index 489030598e..a52ae60ebc 100644 --- a/src/renderer/components/Transaction/TransactionTable.vue +++ b/src/renderer/components/Transaction/TransactionTable.vue @@ -1,14 +1,37 @@