From 378da60ae825088d220b614411403e0c508e89b0 Mon Sep 17 00:00:00 2001 From: Marcel Date: Sat, 6 Jun 2026 11:49:48 +0200 Subject: [PATCH] test(mention): lock deleted-person graceful-degradation contract (#684) Strengthen one renderTranscriptionBody case into the AC-6 contract: a @DisplayName with an empty mentionedPersons array (the deleted-person case V71 produces) must render as plain readable text with no , person-mention class, data-person-id, or href. Guards against a future renderer refactor silently reintroducing the dead-link-on-deleted-person degradation. Co-Authored-By: Claude Opus 4.8 --- .../src/lib/shared/discussion/mention.spec.ts | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/frontend/src/lib/shared/discussion/mention.spec.ts b/frontend/src/lib/shared/discussion/mention.spec.ts index f063ab3b..a049d669 100644 --- a/frontend/src/lib/shared/discussion/mention.spec.ts +++ b/frontend/src/lib/shared/discussion/mention.spec.ts @@ -307,9 +307,21 @@ describe('renderTranscriptionBody', () => { expect(result).not.toMatch(/>O"Brien<\/a>/); }); - it('renders nothing when mentionedPersons is undefined-empty and no @ triggers', () => { - const result = renderTranscriptionBody('Plain old transcription text.', []); - expect(result).toBe('Plain old transcription text.'); + it('renders a deleted-person @mention as plain text with no dead link (graceful degradation)', () => { + // AC-6 (#684): when a mentioned person is deleted, V71's ON DELETE CASCADE removes the + // sidecar row, so the displayName reaches the renderer with an empty mentionedPersons + // array. The reader must still see the name as plain text — never a dead , a + // person-mention class, a data-person-id, or an href. This locks the degradation + // contract so a future renderer refactor cannot silently reintroduce a dead link. + const result = renderTranscriptionBody('Brief an @Auguste Raddatz vom Mai', []); + // (a) the reader still sees the readable name and the surrounding sentence verbatim + expect(result).toContain('Auguste Raddatz'); + expect(result).toBe('Brief an @Auguste Raddatz vom Mai'); + // (b) none of the anchor artifacts leak through + expect(result).not.toContain(' {