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 <noreply@anthropic.com>
This commit is contained in:
2026-11-20 21:51:33 +01:00
parent 6a1ad7eb76
commit 7eaf68b9e9

View File

@ -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()
})