feat: initial release v0.3.0

This commit is contained in:
saturn
2026-03-08 03:15:27 +08:00
commit 881ed44996
1311 changed files with 225407 additions and 0 deletions

View File

@@ -0,0 +1,44 @@
import { describe, expect, it, vi } from 'vitest'
vi.mock('react', async () => {
const actual = await vi.importActual<typeof import('react')>('react')
return {
...actual,
useMemo: <T,>(factory: () => T) => factory(),
}
})
import { useVideoPanelsProjection } from '@/lib/novel-promotion/stages/video-stage-runtime/useVideoPanelsProjection'
describe('video panels projection error code', () => {
it('projects failed task lastError code/message onto panel fields', () => {
const result = useVideoPanelsProjection({
clips: [{ id: 'clip-1', start: 0, end: 5, summary: 'clip' }],
storyboards: [{
id: 'sb-1',
clipId: 'clip-1',
panels: [{
id: 'panel-1',
panelIndex: 0,
description: 'panel',
}],
}],
panelVideoStates: {
getTaskState: () => ({
phase: 'failed',
lastError: {
code: 'EXTERNAL_ERROR',
message: 'upstream failed',
},
}),
},
panelLipStates: {
getTaskState: () => null,
},
})
expect(result.allPanels).toHaveLength(1)
expect(result.allPanels[0]?.videoErrorCode).toBe('EXTERNAL_ERROR')
expect(result.allPanels[0]?.videoErrorMessage).toBe('upstream failed')
})
})