diff options
| author | Armand Philippot <git@armandphilippot.com> | 2023-12-01 19:34:58 +0100 |
|---|---|---|
| committer | Armand Philippot <git@armandphilippot.com> | 2023-12-04 19:00:04 +0100 |
| commit | 53b63ac27c2275262db9a04be02210a3287aa71d (patch) | |
| tree | 814968e10cad25e1b34ab251de42ac5ecb82b346 /tests | |
| parent | 11e3ee75fcab0ab54b2bc1713a402c5cc3070c2d (diff) | |
refactor(pages): refine Blog pages
* replace usePostsList with useArticlesList to keep names coherent
* remove useIsMounted hook
* rewrite useRedirection hook
* add redirect in getStaticProps to avoid unecessary fetching
* move Pagination component in a noscript tag
* use hooks to refresh thematics and topics lists
* complete Cypress tests
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/cypress/e2e/pages/blog.cy.ts | 13 | ||||
| -rw-r--r-- | tests/fixtures/wp-posts.fixture.ts | 4 |
2 files changed, 15 insertions, 2 deletions
diff --git a/tests/cypress/e2e/pages/blog.cy.ts b/tests/cypress/e2e/pages/blog.cy.ts index 3a422d2..0350e39 100644 --- a/tests/cypress/e2e/pages/blog.cy.ts +++ b/tests/cypress/e2e/pages/blog.cy.ts @@ -11,6 +11,14 @@ describe('Blog Page', () => { cy.visit(ROUTES.BLOG); }); + it('successfully loads', () => { + cy.findByRole('heading', { level: 1 }).should('exist'); + }); + + it('contains a breadcrumbs', () => { + cy.findByRole('navigation', { name: 'Fil d’Ariane' }).should('exist'); + }); + it('loads the correct number of pages', () => { cy.findByText( /(?<first>\d+) articles chargés sur un total de (?<total>\d+)/i @@ -49,4 +57,9 @@ describe('Blog Page', () => { ); }); }); + + it('contains a thematics list widget and a topics list widget', () => { + cy.findByRole('heading', { level: 2, name: 'Thématiques' }).should('exist'); + cy.findByRole('heading', { level: 2, name: 'Sujets' }).should('exist'); + }); }); diff --git a/tests/fixtures/wp-posts.fixture.ts b/tests/fixtures/wp-posts.fixture.ts index a1b1e4a..7adc928 100644 --- a/tests/fixtures/wp-posts.fixture.ts +++ b/tests/fixtures/wp-posts.fixture.ts @@ -1,6 +1,6 @@ import type { WPPost } from '../../src/types'; -export const wpPostsFixture: WPPost[] = [ +export const wpPostsFixture = [ { acfPosts: null, author: { @@ -174,4 +174,4 @@ export const wpPostsFixture: WPPost[] = [ slug: '/post-4', title: 'Post 4', }, -]; +] satisfies WPPost[]; |
