Some checks failed
CI Pipeline / Code Quality & Typecheck (push) Waiting to run
CI Pipeline / Test Suite (macos-latest) (push) Blocked by required conditions
CI Pipeline / Test Suite (ubuntu-latest) (push) Blocked by required conditions
CI Pipeline / Test Suite (windows-latest) (push) Blocked by required conditions
CI Pipeline / Build Validation (admin) (push) Blocked by required conditions
CI Pipeline / Build Validation (desktop) (push) Blocked by required conditions
Deploy Landing Page / deploy (push) Blocked by required conditions
Deploy Landing Page / build (push) Waiting to run
Release & Packaging Pipeline / Build & Publish Admin Docker Image (push) Failing after 8s
Release & Code Signing CA Pipeline / build-and-sign-windows (push) Failing after 1m51s
Build macOS / Build & Package (macOS) (push) Failing after 4s
Build macOS / Build & Package (macOS)-1 (push) Failing after 5s
Release & Code Signing CA Pipeline / build-and-sign-macos (push) Failing after 3s
Release & Packaging Pipeline / Package macOS Desktop App (push) Failing after 4s
Release & Packaging Pipeline / Package Windows Desktop App (push) Failing after 2m28s
Release & Packaging Pipeline / Publish Official GitHub Release (push) Has been skipped
90 lines
3.1 KiB
TypeScript
90 lines
3.1 KiB
TypeScript
import { describe, it, expect, vi } from 'vitest'
|
|
import { ErrorCode } from '@d3ro/core/errors'
|
|
import { getMeetingModeService } from '../../src/main/services/MeetingModeService'
|
|
import { getDatabase } from '../../src/main/db'
|
|
import { meetingSessions } from '../../src/main/db/schema'
|
|
import { configSet } from '../../src/main/services/ConfigService'
|
|
import { useRedHarness } from './harness'
|
|
import { FX, USER_TEXT } from './fixtures'
|
|
|
|
const localGenerate = vi.fn(async () => ({ text: FX.LLM_OK, model: 'fx-local-model' }))
|
|
const premiumGenerate = vi.fn(async () => {
|
|
throw new Error('fx.premium.should-not-run-on-local-backend')
|
|
})
|
|
|
|
vi.mock('../../src/main/services/LocalLLMService', () => ({
|
|
getLocalLLMService: () => ({
|
|
isAvailable: () => true,
|
|
generate: (...args: unknown[]) => localGenerate(...args),
|
|
chatStream: async function* () {
|
|
yield FX.LLM_OK
|
|
return FX.LLM_OK
|
|
},
|
|
}),
|
|
resetLocalLLMServiceForTests: () => undefined,
|
|
startLocalLLMAvailability: vi.fn(),
|
|
}))
|
|
|
|
vi.mock('../../src/main/services/PremiumLLMService', () => ({
|
|
getPremiumLLMService: () => ({
|
|
isAvailable: () => false,
|
|
generate: (...args: unknown[]) => premiumGenerate(...args),
|
|
chatStream: async function* () {
|
|
throw new Error('fx.premium.chat.should-not-run')
|
|
},
|
|
}),
|
|
resetPremiumLLMServiceForTests: () => undefined,
|
|
}))
|
|
|
|
useRedHarness()
|
|
|
|
function insertSession(id: string): void {
|
|
const now = Date.now()
|
|
getDatabase()
|
|
.insert(meetingSessions)
|
|
.values({
|
|
id,
|
|
title: 'llm-session',
|
|
status: 'completed',
|
|
startedAt: now,
|
|
createdAt: now,
|
|
updatedAt: now,
|
|
rawTranscript: USER_TEXT.KO,
|
|
})
|
|
.run()
|
|
}
|
|
|
|
describe('유스케이스: 회의 문서/폴리시가 로컬 LLM 을 탄다', () => {
|
|
it('llmBackend=local 이면 polish 가 LocalLLM generate 를 쓰고 Premium 을 부르지 않는다', async () => {
|
|
configSet('llmBackend', 'local')
|
|
insertSession('meet-local-polish')
|
|
localGenerate.mockClear()
|
|
premiumGenerate.mockClear()
|
|
const polished = await getMeetingModeService().polishTranscript('meet-local-polish')
|
|
expect(polished).toBe(FX.LLM_OK)
|
|
expect(localGenerate).toHaveBeenCalled()
|
|
expect(premiumGenerate).not.toHaveBeenCalled()
|
|
expect(getMeetingModeService().getSession('meet-local-polish').editedTranscript).toBe(FX.LLM_OK)
|
|
})
|
|
|
|
it('llmBackend=local 이면 generateDocument 도 LocalLLM 을 탄다', async () => {
|
|
configSet('llmBackend', 'local')
|
|
insertSession('meet-local-doc')
|
|
localGenerate.mockClear()
|
|
premiumGenerate.mockClear()
|
|
const doc = await getMeetingModeService().generateDocument({
|
|
sessionId: 'meet-local-doc',
|
|
templateId: 'builtin-minutes',
|
|
})
|
|
expect(doc.content).toBe(FX.LLM_OK)
|
|
expect(localGenerate).toHaveBeenCalled()
|
|
expect(premiumGenerate).not.toHaveBeenCalled()
|
|
})
|
|
|
|
it('없는 세션 polish 는 MeetingSessionNotFound 다', async () => {
|
|
configSet('llmBackend', 'local')
|
|
await expect(getMeetingModeService().polishTranscript('missing')).rejects.toMatchObject({
|
|
code: ErrorCode.MeetingSessionNotFound,
|
|
})
|
|
})
|
|
})
|