test: 验证手部诊断按需查询与证据不足展示

This commit is contained in:
GouJ committed 2026-10-15 19:42:08 +08:00
1 parent 620b4b1aea
commit beb39479f2
1 file changed
+27
@@ -451,6 +451,33 @@ describe('拆解页内容滚动', () => {
expect(drawerPanel().text()).toContain('重试失败抽取')
})
it('手部质量诊断仅在点击后请求,并展示证据不足状态', async () => {
const fetcher = vi.fn<typeof fetch>().mockResolvedValue(new Response(JSON.stringify({
data: {
projectId: 'breakdown-scroll-test', episodeCount: 1,
shotCount: 25, validSnapshotCount: 25,
evidenceShotCount: 0, invalidEvidenceShotCount: 0,
missingEvidenceShotCount: 25, evidenceCoverage: 0,
assessment: 'insufficient_evidence', warningCount: 0,
diagnostics: [], willCallModel: false, willModifyAssets: false
}
}), { status: 200, headers: { 'Content-Type': 'application/json' } }))
vi.stubGlobal('fetch', fetcher)
mountPage()
await wrapper!.get('[data-workspace-tools]').trigger('click')
await flushPromises()
expect(fetcher).not.toHaveBeenCalled()
const panel = drawerPanel()
const action = panel.findAll('button').find(button => button.text() === '查看诊断')
expect(action).toBeDefined()
await action!.trigger('click')
await flushPromises()
expect(fetcher).toHaveBeenCalledTimes(1)
expect(String(fetcher.mock.calls[0]?.[0])).toContain('/breakdown/storyboard-hand-occupancy-diagnostics')
expect(panel.text()).toContain('有效证据 0 / 25')
expect(panel.text()).toContain('证据不足')
})
it('没有正式剧集时保留可滚动的空状态,不显示拆解设置与结果', () => {
mountPage([], 0)
expect(wrapper!.get('.panel-scroll .n-scrollbar-container').text()).toContain('还没有可拆解的剧集')