feat(short-drama-agent-front): 新增诊断抽屉并优化项目弹窗
This commit is contained in:
1 parent
97dc784c8b
commit
49ad08a63e
21 files changed
+1479
-363
No files matched your search
@@ -0,0 +1,104 @@
|
||||
import { describe, expect, it } from 'vitest'
|
||||
import { diagnosisInput, scopeDiagnosisShots, summarizeDiagnosis } from '@/features/breakdown/diagnosis'
|
||||
import type { LegacyActionDiagnosisResults } from '@/features/breakdown/types'
|
||||
|
||||
/** 同集不同节拍及跨集镜头,用于验证范围不会混入其它位置的结果。 */
|
||||
const shots: LegacyActionDiagnosisResults['shots'] = [
|
||||
{
|
||||
shotId: 'a',
|
||||
episodeNo: 1,
|
||||
beatNo: 1,
|
||||
shotNo: 1,
|
||||
title: '镜头一',
|
||||
diagnosisId: null,
|
||||
status: 'not_diagnosed',
|
||||
issues: [],
|
||||
createdAt: null
|
||||
},
|
||||
{
|
||||
shotId: 'b',
|
||||
episodeNo: 1,
|
||||
beatNo: 1,
|
||||
shotNo: 2,
|
||||
title: '镜头二',
|
||||
diagnosisId: 'b',
|
||||
status: 'conflict_found',
|
||||
issues: [],
|
||||
createdAt: null
|
||||
},
|
||||
{
|
||||
shotId: 'c',
|
||||
episodeNo: 1,
|
||||
beatNo: 2,
|
||||
shotNo: 1,
|
||||
title: '镜头三',
|
||||
diagnosisId: 'c',
|
||||
status: 'stale',
|
||||
issues: [],
|
||||
createdAt: null
|
||||
},
|
||||
{
|
||||
shotId: 'd',
|
||||
episodeNo: 2,
|
||||
beatNo: 1,
|
||||
shotNo: 1,
|
||||
title: '镜头四',
|
||||
diagnosisId: 'd',
|
||||
status: 'no_conflict_found',
|
||||
issues: [],
|
||||
createdAt: null
|
||||
}
|
||||
]
|
||||
|
||||
describe('动作诊断范围与统计', () => {
|
||||
it('单镜头和节拍只保留准确位置,不能直接使用整集结果统计', () => {
|
||||
expect(
|
||||
scopeDiagnosisShots(shots, { kind: 'shot', episodeNo: 1, beatNo: 1, shotNo: 2 }).map(item => item.shotId)
|
||||
).toEqual(['b'])
|
||||
const beat = scopeDiagnosisShots(shots, { kind: 'beat', episodeNo: 1, beatNo: 1 })
|
||||
expect(beat.map(item => item.shotId)).toEqual(['a', 'b'])
|
||||
expect(summarizeDiagnosis(beat)).toEqual({
|
||||
total: 2,
|
||||
conflict: 1,
|
||||
clear: 0,
|
||||
insufficient: 0,
|
||||
invalid: 0,
|
||||
stale: 0,
|
||||
pending: 1
|
||||
})
|
||||
})
|
||||
|
||||
it('单集不混入其它剧集,全项目保留全部结果', () => {
|
||||
expect(scopeDiagnosisShots(shots, { kind: 'episode', episodeNo: 2 }).map(item => item.shotId)).toEqual(['d'])
|
||||
expect(scopeDiagnosisShots(shots, { kind: 'project' })).toHaveLength(4)
|
||||
})
|
||||
|
||||
it('未诊断、证据不足、证据无效和过期都不能计入未发现冲突', () => {
|
||||
const results = [
|
||||
shots[0]!,
|
||||
shots[2]!,
|
||||
{ ...shots[1]!, status: 'insufficient_evidence' as const },
|
||||
{ ...shots[1]!, status: 'invalid_evidence' as const }
|
||||
]
|
||||
expect(summarizeDiagnosis(results)).toEqual({
|
||||
total: 4,
|
||||
conflict: 0,
|
||||
clear: 0,
|
||||
insufficient: 1,
|
||||
invalid: 1,
|
||||
stale: 1,
|
||||
pending: 1
|
||||
})
|
||||
})
|
||||
|
||||
it('全项目启动不遗留集、节拍或镜头条件,单镜头保留全部条件', () => {
|
||||
expect(diagnosisInput({ kind: 'project' }, 3)).toEqual({ confirmed: true, concurrency: 3 })
|
||||
expect(diagnosisInput({ kind: 'shot', episodeNo: 2, beatNo: 4, shotNo: 1 }, 2)).toEqual({
|
||||
confirmed: true,
|
||||
concurrency: 2,
|
||||
episodeNo: 2,
|
||||
beatNo: 4,
|
||||
shotNo: 1
|
||||
})
|
||||
})
|
||||
})
|
||||
Reference in new issue
Block a user