feat(home): import messages open with a full-restoration or partial-recovery headline; BDR-040 recorded

This commit is contained in:
bchanot committed 2026-10-11 16:31:37 +02:00
1 parent de2bd0437e
commit 62b8a43e09
7 files changed
+106 -23

No files matched your search

@@ -1,8 +1,8 @@
/**
* Step 6 Phase 0 characterisation of the import flow on the home route, with
* `importReportFromPdf` mocked: the migration alert with its count, the three
* ImportError kinds plus the generic error mapped to the FR messages, and
* the navigation to /editor on success. Kept green unchanged by Step 6.
* `importReportFromPdf` mocked: the migration alert (degraded headline, then
* the count), the three ImportError kinds plus the generic error mapped to
* the FR messages, and the navigation to /editor on success.
*/
import {
describe,
@@ -110,7 +110,7 @@ describe('HomeRoute import: success paths', () => {
expect(alertMock()).not.toHaveBeenCalled()
})
it('alerts with the unresolved count (zones + findings) after a lossy migration', async () => {
it('alerts "degraded" then the unresolved count (zones + findings) after a lossy migration', async () => {
importMock.mockResolvedValue(
outcome({ migrated: true, unresolvedZones: 1, unresolvedFindings: 1 }),
)
@@ -118,8 +118,11 @@ describe('HomeRoute import: success paths', () => {
await screen.findByTestId('editor-route')
expect(alertMock()).toHaveBeenCalledTimes(1)
const message = alertMock().mock.calls[0]![0] as string
expect(message).toBe(fr['home.import.migrated']!.replace('{count}', '2'))
expect(message).toContain('2')
const [headline, ...lines] = message.split('\n\n')
expect(headline).toBe(fr['home.import.degraded'])
expect(lines).toEqual([
fr['home.import.migrated']!.replace('{count}', '2'),
])
})
it('stays silent on a migration that lost nothing', async () => {