From 6b9fbc920e8ba0774a64fd183bc1b97dae02cbbc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Wolfgang=20Hu=C3=9F?= Date: Mon, 16 May 2022 11:39:48 +0200 Subject: [PATCH] Add test for invisible pagination buttons --- backend/src/seeds/creation/index.ts | 1 - .../src/components/GddTransactionList.spec.js | 78 +++++++++---------- .../src/components/GddTransactionList.vue | 5 +- 3 files changed, 39 insertions(+), 45 deletions(-) diff --git a/backend/src/seeds/creation/index.ts b/backend/src/seeds/creation/index.ts index 598a76cd7..8c7b35a45 100644 --- a/backend/src/seeds/creation/index.ts +++ b/backend/src/seeds/creation/index.ts @@ -127,7 +127,6 @@ bobsSendings.forEach((sending) => { confirmed: true, }) }) -// Wolle: console.log('bobsSum: ', bobsSum) export const creations: CreationInterface[] = [ { diff --git a/frontend/src/components/GddTransactionList.spec.js b/frontend/src/components/GddTransactionList.spec.js index b792cc3cc..a6d0ef935 100644 --- a/frontend/src/components/GddTransactionList.spec.js +++ b/frontend/src/components/GddTransactionList.spec.js @@ -407,29 +407,34 @@ describe('GddTransactionList', () => { }) describe('pagination buttons', () => { + const createTransaction = (idx) => { + return { + amount: '3.14', + balanceDate: '2021-04-29T17:26:40+00:00', + decay: { + decay: '-477.01', + start: '2021-05-13T17:46:31.000Z', + end: '2022-04-20T06:51:25.000Z', + duration: 29509494, + }, + memo: 'Kreiszahl PI', + linkedUser: { + firstName: 'Bibi', + lastName: 'Bloxberg', + }, + id: idx + 1, + typeId: 'RECEIVE', + balance: '33.33', + } + } + beforeEach(async () => { + const transactionCount = 42 await wrapper.setProps({ - transactions: Array.from({ length: 42 }, (_, idx) => { - return { - amount: '3.14', - balanceDate: '2021-04-29T17:26:40+00:00', - decay: { - decay: '-477.01', - start: '2021-05-13T17:46:31.000Z', - end: '2022-04-20T06:51:25.000Z', - duration: 29509494, - }, - memo: 'Kreiszahl PI', - linkedUser: { - firstName: 'Bibi', - lastName: 'Bloxberg', - }, - id: idx + 1, - typeId: 'RECEIVE', - balance: '33.33', - } + transactions: Array.from({ length: transactionCount }, (_, idx) => { + return createTransaction(idx) }), - transactionCount: 42, + transactionCount, decayStartBlock, pageSize: 25, showPagination: true, @@ -449,28 +454,21 @@ describe('GddTransactionList', () => { ) }) }) - }) - describe.skip('show no pagination', () => { - // Wolle: beforeEach(async () => { - // await wrapper.setProps({ - // transactions: [], - // transactionCount: 2, - // decayStartBlock, - // pageSize: 25, - // showPagination: false, - // }) - // }) - - it('shows no pagination buttons', async () => { - await wrapper.setProps({ - transactions: [], - transactionCount: 2, - decayStartBlock, - pageSize: 25, - showPagination: false, + describe('show no pagination', () => { + it('shows no pagination buttons', async () => { + const transactionCount = 2 + await wrapper.setProps({ + transactions: Array.from({ length: transactionCount }, (_, idx) => { + return createTransaction(idx) + }), + transactionCount, + decayStartBlock, + pageSize: 25, + showPagination: false, + }) + expect(wrapper.find('ul.pagination').exists()).toBe(false) }) - expect(wrapper.find('ul.pagination').exists()).toBe(false) }) }) }) diff --git a/frontend/src/components/GddTransactionList.vue b/frontend/src/components/GddTransactionList.vue index abc9ecb0e..5becfa39e 100644 --- a/frontend/src/components/GddTransactionList.vue +++ b/frontend/src/components/GddTransactionList.vue @@ -125,10 +125,6 @@ export default { }, computed: { isPaginationVisible() { - // Wolle: console.log('this.showPagination: ', this.showPagination) - // console.log('this.pageSize: ', this.pageSize) - // console.log('this.transactions.length: ', this.transactions.length) - // console.log('this.transactionCount: ', this.transactionCount) return this.showPagination && this.pageSize < this.transactionCount }, }, @@ -143,6 +139,7 @@ export default { }, } +