feat(short-drama-agent-front): 同步拆解候选审核与安全提交

This commit is contained in:
GJ committed 2026-10-17 20:18:20 +08:00
1 parent cc27d463e0
commit 190333d4f9
26 files changed
+1495 -249

No files matched your search

@@ -71,4 +71,24 @@ describe('候选提交资格', () => {
expect(fetcher.mock.calls[1]![0]).toContain('/projects/p%2Fid/breakdown/commit-candidate')
expect(JSON.parse(fetcher.mock.calls[1]![1]!.body as string)).toEqual({ confirmed: true })
})
it('候选新接口使用真实端点并携带版本,不把人工草稿扩展成正式资产请求', async () => {
const fetcher = vi.fn<typeof fetch>().mockResolvedValue(new Response(JSON.stringify({ data: {} })))
// 每次返回独立响应,模拟四个实际端点,不运行任何模型或真实写入。
fetcher.mockImplementation(async () => new Response(JSON.stringify({ data: {} })))
vi.stubGlobal('fetch', fetcher)
await breakdownApi.revalidateCandidate('p/id')
await breakdownApi.candidateCommitPreview('p/id')
await breakdownApi.repairCandidateSubject('p/id', { expectedCheckpointId: 'current', episodeNo: 1, beatNo: 2, shotNo: 3, subjectRef: '@PR0001', formId: 'existing-form' })
await breakdownApi.repairCandidateActions('p/id', { expectedCheckpointId: 'current', repairs: [{ episodeNo: 1, beatNo: 2, shotNo: 3, actionId: 'action-1', description: '人物伸手拿起铜铃' }] })
expect(fetcher.mock.calls.map(call => call[0])).toEqual([
'/api/projects/p%2Fid/breakdown/candidate-revalidation',
'/api/projects/p%2Fid/breakdown/candidate-commit-preview',
'/api/projects/p%2Fid/breakdown/candidate-subject-repair',
'/api/projects/p%2Fid/breakdown/candidate-action-batch-repair'
])
expect(fetcher.mock.calls.map(call => call[1]?.method)).toEqual(['GET', 'GET', 'POST', 'POST'])
const body = fetcher.mock.calls[3]?.[1]?.body
if (typeof body !== 'string') throw new Error('请求缺少 JSON 正文')
expect(JSON.parse(body)).toEqual({ expectedCheckpointId: 'current', repairs: [{ episodeNo: 1, beatNo: 2, shotNo: 3, actionId: 'action-1', description: '人物伸手拿起铜铃' }] })
})
})