From fd388fc1ba0b1b5cc709d50d33695fcd862c9f6a Mon Sep 17 00:00:00 2001 From: mattwr18 Date: Fri, 4 Oct 2019 12:34:48 +0200 Subject: [PATCH] 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 --- webapp/pages/profile/_id/_slug.spec.js | 35 +++++++++++++------------- 1 file changed, 17 insertions(+), 18 deletions(-) diff --git a/webapp/pages/profile/_id/_slug.spec.js b/webapp/pages/profile/_id/_slug.spec.js index 6470bb69a..f7eba10cc 100644 --- a/webapp/pages/profile/_id/_slug.spec.js +++ b/webapp/pages/profile/_id/_slug.spec.js @@ -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) - }) - }) }) }) })