diff options
| author | Armand Philippot <git@armandphilippot.com> | 2022-05-13 15:39:55 +0200 |
|---|---|---|
| committer | Armand Philippot <git@armandphilippot.com> | 2022-05-13 15:46:05 +0200 |
| commit | dab72bb270ee2ee47a0b472d5e9e240cba7cbf0f (patch) | |
| tree | a64a49a1048eeab1204a9b04923135edd1f259e1 /src/components/organisms/layout/posts-list.test.tsx | |
| parent | c5b516e2c933e77b2550fe6becebacb3fbdd30eb (diff) | |
chore: handle blog pagination
Diffstat (limited to 'src/components/organisms/layout/posts-list.test.tsx')
| -rw-r--r-- | src/components/organisms/layout/posts-list.test.tsx | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/components/organisms/layout/posts-list.test.tsx b/src/components/organisms/layout/posts-list.test.tsx index 9b226ac..7429cbd 100644 --- a/src/components/organisms/layout/posts-list.test.tsx +++ b/src/components/organisms/layout/posts-list.test.tsx @@ -71,4 +71,19 @@ describe('PostsList', () => { render(<PostsList posts={posts} total={posts.length} />); expect(screen.getAllByRole('article')).toHaveLength(posts.length); }); + + it('renders the number of loaded posts', () => { + render(<PostsList posts={posts} total={posts.length} />); + const info = `${posts.length} loaded articles out of a total of ${posts.length}`; + expect(screen.getByText(info)).toBeInTheDocument(); + }); + + it('renders a load more button', () => { + render( + <PostsList posts={posts} total={posts.length} showLoadMoreBtn={true} /> + ); + expect( + screen.getByRole('button', { name: /Load more/i }) + ).toBeInTheDocument(); + }); }); |
