import { describe, expect, it } from 'vitest' import { formatTranscriptLines, parseTranscriptLines } from '../src/meeting-transcript' describe('meeting transcript lines', () => { it('parses timestamps and speakers written by the desktop recorder and diarization', () => { const text = '[00:05] 안녕하세요\n\n[01:12] [화자 2] 다음 안건입니다\n[12:03] [Speaker 1] 끝' expect(parseTranscriptLines(text)).toEqual([ { timestampMs: 5_000, timed: true, speaker: null, text: '안녕하세요' }, { timestampMs: 72_000, timed: true, speaker: '화자 2', text: '다음 안건입니다' }, { timestampMs: 723_000, timed: true, speaker: 'Speaker 1', text: '끝' }, ]) }) it('keeps untimed lines (phone transcripts, manual edits) and carries the last time forward', () => { expect(parseTranscriptLines('first line\n[00:30] timed\nfollow-up')).toEqual([ { timestampMs: 0, timed: false, speaker: null, text: 'first line' }, { timestampMs: 30_000, timed: true, speaker: null, text: 'timed' }, { timestampMs: 30_000, timed: false, speaker: null, text: 'follow-up' }, ]) }) it('drops empty and timestamp-only lines and round-trips through the formatter', () => { const text = '[00:01] [화자 1] a\n[00:02]\nb' const lines = parseTranscriptLines(text) expect(lines).toHaveLength(2) expect(formatTranscriptLines(lines)).toBe('[00:01] [화자 1] a\nb') }) it('returns nothing for empty input', () => { expect(parseTranscriptLines(null)).toEqual([]) expect(parseTranscriptLines(' \n ')).toEqual([]) }) })