profileShare

rasmusjy / voicetask

Read-only snapshot

No repository description.

main default branch 105 files Expires Sep 13, 2026, 9:06 AM
transcript.test.ts 1,023 bytes
1 import { describe, expect, it } from 'vitest'
2 import { formatTranscript } from './transcript'
3 import type { Segment } from './types'
4
5 function segment(id: string, speaker: Segment['speaker'], text: string): Segment {
6 return { id, ts: new Date().toISOString(), speaker, text }
7 }
8
9 describe('formatTranscript', () => {
10 it('renders each segment as a labeled line, in order', () => {
11 const segments = [
12 segment('S1', 'user', 'a recipe app for my family'),
13 segment('S2', 'interviewer', 'who will use it?'),
14 ]
15 const text = formatTranscript(segments, 'Family Recipes')
16 expect(text).toContain('# Family Recipes: Interview Transcript')
17 expect(text).toContain('**You:** a recipe app for my family')
18 expect(text).toContain('**Interviewer:** who will use it?')
19 expect(text.indexOf('You:')).toBeLessThan(text.indexOf('Interviewer:'))
20 })
21
22 it('falls back to a generic title when no project name is given', () => {
23 expect(formatTranscript([])).toContain('# Interview Transcript')
24 })
25 })
26