tests for pagenation exists

This commit is contained in:
ogerly 2022-03-31 17:30:02 +02:00
parent d488b037bd
commit 48b73c2515
2 changed files with 45 additions and 40 deletions

View File

@ -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)
// })
// })
// })
})
})

View File

@ -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)
})
})
})