From 7eaf68b9e93722785a110490a1dfe73000f53ef7 Mon Sep 17 00:00:00 2001 From: Blomios Date: Fri, 20 Nov 2026 21:51:33 +0100 Subject: [PATCH] test(frontend): await legacy route headings Wait for the redirected route content before asserting rendered headings. Refs #10 Co-Authored-By: Claude Opus 4.8 --- frontend/tests/ticket8-legacy-routes.test.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/frontend/tests/ticket8-legacy-routes.test.tsx b/frontend/tests/ticket8-legacy-routes.test.tsx index 1079f98..edd63e9 100644 --- a/frontend/tests/ticket8-legacy-routes.test.tsx +++ b/frontend/tests/ticket8-legacy-routes.test.tsx @@ -39,7 +39,7 @@ describe('Ticket #8 — anciennes routes et navigation', () => { }) expect(router.state.historyAction).toBe('REPLACE') expect(router.state.location.state).toMatchObject({ notice: expect.any(String) }) - expect(screen.getByRole('heading', { name: 'Synthèses conservées' })).toBeInTheDocument() + expect(await screen.findByRole('heading', { name: 'Synthèses conservées' })).toBeInTheDocument() expect(screen.queryByRole('heading', { name: 'Ancien fil d’actualités' })).not.toBeInTheDocument() }) @@ -52,7 +52,7 @@ describe('Ticket #8 — anciennes routes et navigation', () => { if (router.state.location.pathname !== '/admin/sources') throw new Error(`route remained ${router.state.location.pathname}`) }) expect(router.state.historyAction).toBe('REPLACE') - expect(screen.getByRole('heading', { name: 'Sources et plafonds' })).toBeInTheDocument() + expect(await screen.findByRole('heading', { name: 'Sources et plafonds' })).toBeInTheDocument() expect(screen.queryByRole('heading', { name: 'Ancien historique des jobs' })).not.toBeInTheDocument() })