初始化
This commit is contained in:
@@ -0,0 +1,51 @@
|
||||
// 媒体反推任务范围测试,确保单分镜任务不会污染剧集或项目的总处理状态。
|
||||
package worker
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/google/uuid"
|
||||
)
|
||||
|
||||
// TestIsWholeVideoAnalysis 验证仅未绑定分镜的任务可更新反推范围总状态。
|
||||
func TestIsWholeVideoAnalysis(t *testing.T) {
|
||||
storyboardID := uuid.New()
|
||||
tests := []struct {
|
||||
name string
|
||||
snapshot analysisSnapshot
|
||||
want bool
|
||||
}{
|
||||
{name: "整段视频反推", snapshot: analysisSnapshot{}, want: true},
|
||||
{name: "单分镜重新反推", snapshot: analysisSnapshot{StoryboardID: &storyboardID}, want: false},
|
||||
}
|
||||
|
||||
for _, test := range tests {
|
||||
t.Run(test.name, func(t *testing.T) {
|
||||
if got := isWholeVideoAnalysis(test.snapshot); got != test.want {
|
||||
t.Fatalf("isWholeVideoAnalysis() = %v, want %v", got, test.want)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
// TestRedrawStoryboardsReady 验证只有全部分镜提示词完整时才恢复剧本反推入口。
|
||||
func TestRedrawStoryboardsReady(t *testing.T) {
|
||||
tests := []struct {
|
||||
name string
|
||||
total int64
|
||||
incomplete int64
|
||||
want bool
|
||||
}{
|
||||
{name: "没有分镜", total: 0, incomplete: 0, want: false},
|
||||
{name: "仍有失败分镜", total: 7, incomplete: 1, want: false},
|
||||
{name: "全部分镜完整", total: 7, incomplete: 0, want: true},
|
||||
}
|
||||
|
||||
for _, test := range tests {
|
||||
t.Run(test.name, func(t *testing.T) {
|
||||
if got := redrawStoryboardsReady(test.total, test.incomplete); got != test.want {
|
||||
t.Fatalf("redrawStoryboardsReady(%d, %d) = %v, want %v", test.total, test.incomplete, got, test.want)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user