Phase 7~8 구현: 테스트 + 빌드 + CI/CD + SoundEffect + AutoLaunch + UI 리디자인
- vitest 41개 단위 테스트 (HistoryService, DictionaryService, CustomInstructionService, VoiceModeService, D3ROError) - electron-builder.yml (NSIS, asarUnpack, extraResources) - .gitlab-ci.yml (lint, typecheck, test, build, release) - SoundEffectService: WAV 프리로드 + PowerShell 재생 + VoiceMode 연동 - AutoLaunchService: app.setLoginItemSettings + ConfigService 동기화 - TextInsertService: 간이 삽입 검증 (EditMonitor 경량) - 번들링 인프라: SoX 다운로드 스크립트, PyInstaller 빌드, 경로 해상도 유틸 - AudioCaptureService/LocalSTTService: 번들 경로 자동 감지 - 08-design-system.md 기반 MUI 테마 (다크+라이트+auto 테마 시스템) - 전체 UI 컴포넌트 리디자인: AppLayout, Dashboard, StatusBar, History, Dictionary, Commands, Settings - 효과음 WAV 생성: recording-start, recording-stop, error - EPIPE 에러 핸들링 추가
This commit is contained in:
parent
ed5541f769
commit
3f4d0c5828
40 changed files with 6034 additions and 580 deletions
75
tests/shared/errors.test.ts
Normal file
75
tests/shared/errors.test.ts
Normal file
|
|
@ -0,0 +1,75 @@
|
|||
// tests/shared/errors.test.ts
|
||||
// D3ROError + IPCResult 헬퍼 테스트
|
||||
|
||||
import { describe, it, expect } from 'vitest'
|
||||
import { D3ROError, ErrorCode, ipcSuccess, ipcError } from '../../src/shared/errors'
|
||||
|
||||
describe('D3ROError', () => {
|
||||
it('code, message, details를 올바르게 설정한다', () => {
|
||||
const err = new D3ROError(ErrorCode.STTModelNotFound, 'Model not found', { modelId: 'large' })
|
||||
|
||||
expect(err.code).toBe(ErrorCode.STTModelNotFound)
|
||||
expect(err.message).toBe('Model not found')
|
||||
expect(err.details).toEqual({ modelId: 'large' })
|
||||
expect(err.name).toBe('D3ROError')
|
||||
expect(err instanceof Error).toBe(true)
|
||||
})
|
||||
|
||||
it('toJSON으로 직렬화할 수 있다', () => {
|
||||
const err = new D3ROError(ErrorCode.LLMServerUnreachable, 'Server down')
|
||||
const json = err.toJSON()
|
||||
|
||||
expect(json.code).toBe(300)
|
||||
expect(json.message).toBe('Server down')
|
||||
expect(json.details).toBeUndefined()
|
||||
})
|
||||
|
||||
it('fromJSON으로 역직렬화할 수 있다', () => {
|
||||
const json = { code: ErrorCode.AudioDeviceNotFound, message: 'No mic' }
|
||||
const err = D3ROError.fromJSON(json)
|
||||
|
||||
expect(err).toBeInstanceOf(D3ROError)
|
||||
expect(err.code).toBe(ErrorCode.AudioDeviceNotFound)
|
||||
expect(err.message).toBe('No mic')
|
||||
})
|
||||
})
|
||||
|
||||
describe('IPCResult helpers', () => {
|
||||
it('ipcSuccess는 success: true + data를 반환한다', () => {
|
||||
const result = ipcSuccess({ value: 42 })
|
||||
|
||||
expect(result.success).toBe(true)
|
||||
if (result.success) {
|
||||
expect(result.data).toEqual({ value: 42 })
|
||||
}
|
||||
})
|
||||
|
||||
it('ipcError는 success: false + error를 반환한다', () => {
|
||||
const result = ipcError(ErrorCode.DBQueryFailed, 'Query failed', { table: 'history' })
|
||||
|
||||
expect(result.success).toBe(false)
|
||||
if (!result.success) {
|
||||
expect(result.error.code).toBe(ErrorCode.DBQueryFailed)
|
||||
expect(result.error.message).toBe('Query failed')
|
||||
expect(result.error.details).toEqual({ table: 'history' })
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
describe('ErrorCode', () => {
|
||||
it('에러 코드 범위가 올바르다', () => {
|
||||
// STT: 100-199
|
||||
expect(ErrorCode.STTEngineNotInstalled).toBe(100)
|
||||
expect(ErrorCode.STTGPUNotAvailable).toBe(140)
|
||||
|
||||
// LLM: 300-399
|
||||
expect(ErrorCode.LLMServerUnreachable).toBe(300)
|
||||
expect(ErrorCode.LLMPromptTooLong).toBe(331)
|
||||
|
||||
// Audio: 400-499
|
||||
expect(ErrorCode.AudioDeviceNotFound).toBe(400)
|
||||
|
||||
// System: 900-999
|
||||
expect(ErrorCode.UnknownError).toBe(999)
|
||||
})
|
||||
})
|
||||
Loading…
Add table
Add a link
Reference in a new issue