import { describe, it, expect } from 'vitest' import { ErrorCode } from '@d3ro/core/errors' import { getTTSPlaybackService } from '../../src/main/services/TTSPlaybackService' import { useRedHarness } from './harness' useRedHarness() describe('유스케이스: TTS 입력 가드 (네이티브 재생 전)', () => { it('빈 텍스트는 TTSTextEmpty 다', async () => { await expect(getTTSPlaybackService().speak('')).rejects.toMatchObject({ code: ErrorCode.TTSTextEmpty, }) }) it('공백만 있는 텍스트도 TTSTextEmpty 다', async () => { await expect(getTTSPlaybackService().speak(' \n')).rejects.toMatchObject({ code: ErrorCode.TTSTextEmpty, }) }) it('stop 은 재생 중이 아니어도 안전하다', () => { expect(() => getTTSPlaybackService().stop()).not.toThrow() expect(getTTSPlaybackService().isSpeaking).toBe(false) }) })