diff --git a/frontend/src/lib/utils/mention.spec.ts b/frontend/src/lib/utils/mention.spec.ts
index 04b659b1..47a84645 100644
--- a/frontend/src/lib/utils/mention.spec.ts
+++ b/frontend/src/lib/utils/mention.spec.ts
@@ -1,6 +1,12 @@
import { describe, it, expect } from 'vitest';
-import { detectMention, escapeHtml, extractContent, renderBody } from './mention';
-import type { MentionDTO } from '$lib/types';
+import {
+ detectMention,
+ escapeHtml,
+ extractContent,
+ renderBody,
+ renderTranscriptionBody
+} from './mention';
+import type { MentionDTO, PersonMention } from '$lib/types';
// ─── escapeHtml ───────────────────────────────────────────────────────────────
@@ -161,3 +167,144 @@ describe('renderBody', () => {
expect(result).not.toContain('\n');
});
});
+
+// ─── renderTranscriptionBody ──────────────────────────────────────────────────
+
+describe('renderTranscriptionBody', () => {
+ const auguste: PersonMention = {
+ personId: '550e8400-e29b-41d4-a716-446655440000',
+ displayName: 'Auguste Raddatz'
+ };
+ const hans: PersonMention = {
+ personId: '550e8400-e29b-41d4-a716-446655440001',
+ displayName: 'Hans'
+ };
+
+ it('returns empty string for empty input', () => {
+ expect(renderTranscriptionBody('', [])).toBe('');
+ });
+
+ it('returns escaped plain text when no mentions', () => {
+ expect(renderTranscriptionBody('Hello world', [])).toBe('Hello world');
+ });
+
+ it('escapes < and > in plain block text', () => {
+ const result = renderTranscriptionBody('', []);
+ expect(result).toBe('<script>alert(1)</script>');
+ expect(result).not.toContain(''
+ };
+ const result = renderTranscriptionBody('Hi @ there', [xss]);
+ expect(result).not.toContain('