Files
waooplus/tests/unit/novel-promotion/insert-panel-user-input.test.ts
saturn fba480ae6e feat: add Husky hooks and fix provider tutorial UI/logic
- Add Husky pre-commit and pre-push hooks for linting, type checking, and build validation
- Fix visual hierarchy bug in the provider onboarding tutorial
- Remove feedback modal
- Move MinIO bucket creation logic to before app startup
- Wire MiniMax audio through voice generation pipeline
- Fix scene insertion issues
- Fix portal tutorial modal and harden panel variant task flow
2026-03-09 02:42:35 +08:00

27 lines
1.1 KiB
TypeScript

import { describe, expect, it } from 'vitest'
import { resolveInsertPanelUserInput } from '@/lib/novel-promotion/insert-panel'
describe('insert panel user input normalization', () => {
it('uses localized default instruction when AI analyze sends empty input', () => {
expect(resolveInsertPanelUserInput({ userInput: '' }, 'zh')).toBe(
'请根据前后镜头自动分析并插入一个自然衔接的新分镜。',
)
expect(resolveInsertPanelUserInput({ userInput: ' ' }, 'en')).toBe(
'Automatically analyze the surrounding panels and insert a naturally connected new panel.',
)
})
it('prefers explicit user input over fallback prompt or default', () => {
expect(resolveInsertPanelUserInput({
userInput: ' 添加一个特写反应镜头 ',
prompt: 'unused prompt',
}, 'zh')).toBe('添加一个特写反应镜头')
})
it('falls back to prompt when userInput is missing', () => {
expect(resolveInsertPanelUserInput({
prompt: ' Insert a pause beat between these panels. ',
}, 'en')).toBe('Insert a pause beat between these panels.')
})
})