From b3529c0ea36da438e23909ea8b3df1b409f5729e Mon Sep 17 00:00:00 2001 From: Moriz Wahl Date: Wed, 5 May 2021 16:53:09 +0200 Subject: [PATCH] remove testData, fix test --- .../src/views/Layout/DashboardLayout_gdd.vue | 57 +++---------------- .../src/views/Pages/KontoOverview.spec.js | 6 -- frontend/src/views/Pages/KontoOverview.vue | 3 +- 3 files changed, 8 insertions(+), 58 deletions(-) diff --git a/frontend/src/views/Layout/DashboardLayout_gdd.vue b/frontend/src/views/Layout/DashboardLayout_gdd.vue index cdd72b68d..5fc696574 100755 --- a/frontend/src/views/Layout/DashboardLayout_gdd.vue +++ b/frontend/src/views/Layout/DashboardLayout_gdd.vue @@ -103,56 +103,13 @@ export default { } }, async updateTransactions() { - // const result = await communityAPI.transactions(this.$store.state.session_id) - // if (result.success) { - // this.GdtBalance = result.result.data.gdtSum / 10000 - // this.transactions = result.result.data.transactions - // } else { - // // what to do when loading balance fails? - // } - - this.transactions = [ - { - name: 'Max Mustermann', - email: 'Maxim@Mustermann', - type: 'send', - transaction_id: 2, - date: '2021-02-19T13:25:38+00:00', - balance: 1920000, - memo: 'a piece of cake :)', - pubkey: '038a6f93270dc57b91d76bf110ad3863fcb7d1b08e7692e793fcdb4467e5b6a7', - }, - { - name: 'Bob Bobmann', - email: 'Bob@Bobmann', - type: 'receive', - transaction_id: 3, - date: '2021-03-19T13:27:36+00:00', - balance: 1920000, - memo: 'test text hier eingeben :)', - pubkey: '038a6f93270dc57b91d76bf110ad3863fcb7d1b08e7692e793fcdb4467e5b6a7', - }, - { - name: 'Gradido Akademie', - email: 'Gradido@Akademie', - type: 'creation', - transaction_id: 4, - date: '2021-03-22T13:25:36+00:00', - balance: 10000000, - memo: '1000 Gradidos für das Sammeln von Müll im Wald.', - pubkey: '038a6f93270dc57b91d76bf110ad3863fcb7d1b08e7692e793fcdb4467e5b6a7', - }, - { - name: 'Verfall', - email: 'Gradido@Akademie', - type: 'decay', - transaction_id: 5, - date: '2021-02-22T13:25:37+00:00', - balance: 20000, - memo: 'verfall', - pubkey: '038a6f93270dc57b91d76bf110ad3863fcb7d1b08e7692e793fcdb4467e5b6a7', - }, - ] + const result = await communityAPI.transactions(this.$store.state.session_id) + if (result.success) { + this.GdtBalance = result.result.data.gdtSum / 10000 + this.transactions = result.result.data.transactions + } else { + // what to do when loading balance fails? + } }, updateBalance(ammount) { this.balance -= ammount diff --git a/frontend/src/views/Pages/KontoOverview.spec.js b/frontend/src/views/Pages/KontoOverview.spec.js index 3cb3b8271..7f09e4e2e 100644 --- a/frontend/src/views/Pages/KontoOverview.spec.js +++ b/frontend/src/views/Pages/KontoOverview.spec.js @@ -35,12 +35,6 @@ describe('KontoOverview', () => { expect(wrapper.find('gdd-table-stub').exists()).toBeTruthy() }) - it('updates transctions data when update-transactions is emitted', async () => { - wrapper.find('gdd-table-stub').vm.$emit('update-transactions', [0, 1]) - await wrapper.vm.$nextTick() - expect(wrapper.vm.transactions).toEqual(expect.arrayContaining([0, 1])) - }) - describe('updateBalance method', () => { beforeEach(async () => { wrapper.find('gdd-send-stub').vm.$emit('update-balance', { diff --git a/frontend/src/views/Pages/KontoOverview.vue b/frontend/src/views/Pages/KontoOverview.vue index 52b9f832b..64c5d2417 100644 --- a/frontend/src/views/Pages/KontoOverview.vue +++ b/frontend/src/views/Pages/KontoOverview.vue @@ -34,9 +34,8 @@ export default { props: { balance: { type: Number, default: 0 }, GdtBalance: { type: Number, default: 0 }, - transactions: { - default: [], + default: () => [], }, }, components: {