Fix tests for changed implementation

- we do not display a load more button when there are clearly no more
posts to load... if there are at least 6, the pageSize, we display it
because there might or might not be posts to load
This commit is contained in:
mattwr18 2019-10-04 12:34:48 +02:00
parent c9219f0be3
commit fd388fc1ba

View File

@ -139,7 +139,23 @@ describe('ProfileSlug', () => {
wrapper.setData({ posts, hasMore: true })
})
it('displays a "load more" button', () => {
it('does not display a "load more" button', () => {
expect(wrapper.find('.load-more').exists()).toBe(false)
})
})
describe('pagination returned at least as many posts as pageSize', () => {
beforeEach(() => {
const posts = [1, 2, 3, 4, 5, 6].map(id => {
return {
...aPost,
id,
}
})
wrapper.setData({ posts })
})
it('displays "load more" button', () => {
expect(wrapper.find('.load-more').exists()).toBe(true)
})
@ -157,23 +173,6 @@ describe('ProfileSlug', () => {
})
})
})
describe('pagination returned as many posts as available', () => {
beforeEach(() => {
const posts = [1, 2, 3, 4, 5, 6].map(id => {
return {
...aPost,
id,
}
})
wrapper.setData({ posts, hasMore: false })
})
it('displays no "load more" button', () => {
expect(wrapper.find('.load-more').exists()).toBe(false)
})
})
})
})
})