From 48b73c25152166e56b3424a0c5c39e100cc23adb Mon Sep 17 00:00:00 2001 From: ogerly Date: Thu, 31 Mar 2022 17:30:02 +0200 Subject: [PATCH] tests for pagenation exists --- .../src/components/GddTransactionList.spec.js | 43 +++++++------------ .../src/components/GdtTransactionList.spec.js | 42 ++++++++++++------ 2 files changed, 45 insertions(+), 40 deletions(-) diff --git a/frontend/src/components/GddTransactionList.spec.js b/frontend/src/components/GddTransactionList.spec.js index ba49e8f2a..5c9dbbb14 100644 --- a/frontend/src/components/GddTransactionList.spec.js +++ b/frontend/src/components/GddTransactionList.spec.js @@ -405,33 +405,22 @@ describe('GddTransactionList', () => { }) }) - describe('pagination buttons', () => { - /* const transactions = Array.from({ length: 42 }, (_, idx) => { - return { - amount: '3.14', - balanceDate: '2021-04-29T17:26:40+00:00', - decay: {}, - memo: 'Kreiszahl PI', - linkedUser: { - firstName: 'Bibi', - lastName: 'Bloxberg', - __typename: 'User', - }, - id: idx + 1, - typeId: 'RECEIVE', - balance: '33.33', - } - }) - */ + // describe('pagination buttons', () => { + // describe('updates transaction count < 25', () => { + // beforeEach(async () => { + // await wrapper.setProps({ + // transactionCount: 2, + // }) + // }) - it('shows no pagination buttons if transactionCount < pageSize', () => { - beforeEach(async () => { - await wrapper.setProps({ - transactionCount: 2, - }) - }) - expect(wrapper.find('div.pagination').exists()).toBe(false) - }) - }) + // it('updates transaction count', () => { + // expect(wrapper.vm.transactionCount).toBe(2) + // }) + + // it('shows no pagination buttons if transactionCount < pageSize', () => { + // expect(wrapper.find('div.pagination').exists()).toBe(false) + // }) + // }) + // }) }) }) diff --git a/frontend/src/components/GdtTransactionList.spec.js b/frontend/src/components/GdtTransactionList.spec.js index 1e2096ece..7871b6750 100644 --- a/frontend/src/components/GdtTransactionList.spec.js +++ b/frontend/src/components/GdtTransactionList.spec.js @@ -166,25 +166,41 @@ describe('GdtTransactionList ', () => { }), ) }) - }) - describe('pagination buttons', () => { - it('shows the pagination buttons if transactionCount > pageSize', () => { - beforeEach(async () => { - await wrapper.setProps({ - transactionGdtCount: 42, + describe('pagination buttons', () => { + describe('with transactionCount > pageSize', () => { + beforeEach(async () => { + apolloMock.mockResolvedValue({ + data: { + listGDTEntries: { + count: 42, + gdtEntries: [], + }, + }, + }) + wrapper = Wrapper() + }) + it('shows the pagination buttons', () => { + expect(wrapper.find('ul.pagination').exists()).toBe(true) }) }) - expect(wrapper.find('div.pagination').exists()).toBe(true) - }) - it('shows no the pagination buttons if transactionCount < pageSize', () => { - beforeEach(async () => { - await wrapper.setProps({ - transactionGdtCount: 2, + describe('with transactionCount < pageSize', () => { + beforeEach(async () => { + apolloMock.mockResolvedValue({ + data: { + listGDTEntries: { + count: 2, + gdtEntries: [], + }, + }, + }) + wrapper = Wrapper() + }) + it('shows no pagination buttons', () => { + expect(wrapper.find('ul.pagination').exists()).toBe(false) }) }) - expect(wrapper.find('div.pagination').exists()).toBe(false) }) }) })