This commit is contained in:
2026-10-14 11:02:56 +08:00
parent 3f728cd0b2
commit e0f54edcc9
24 changed files with 352 additions and 105 deletions
@@ -11,6 +11,22 @@ const detail = { task, sharedUpstream: source, observedAt: '2026-10-13T01:02:00Z
const wrappers: ReturnType<typeof mount>[] = []
afterEach(() => { wrappers.splice(0).forEach(w => w.unmount()); vi.useRealTimers() })
describe('collection task progress evidence', () => {
it('animates unknown totals only during active visible execution and retains the chart across polls', async () => {
const unknown = { ...source, progress: { ...progress, totalKnown: false, total: null } }
const w = mount(CollectionTaskProgress, { props: { task: unknown, visible: true } }); wrappers.push(w)
const chart = w.get('.ring-chart').element
expect(w.get('.ring-chart').classes()).toContain('is-indeterminate')
expect(w.get('.ring-label strong').text()).toBe('执行中')
await w.setProps({ task: { ...unknown, progress: { ...unknown.progress, completed: 46 } } })
expect(w.get('.ring-chart').element).toBe(chart)
for (const state of [{ stale: true }, { stale: false, visible: false }, { visible: true, task: { ...unknown, taskStatus: 'RETRY_WAIT' } }]) {
await w.setProps(state)
expect(w.get('.ring-chart').classes()).not.toContain('is-indeterminate')
}
await w.setProps({ task: source, visible: true, stale: false })
expect(w.get('.ring-label strong').text()).toBe('12.1%')
expect(w.get('.ring-chart').classes()).not.toContain('is-indeterminate')
})
it('explains a confirmed normal batch continuation without hiding failures or protection blocks', async () => {
const yielded: Task = { ...source, taskStatus: 'RETRY_WAIT', blockingReason: 'RETRY_SCHEDULED', latestAttemptNo: 2,
latestAttempt: { attemptNo: 2, status: 'YIELDED', phase: 'DETAIL', startedAt: null, finishedAt: null, progressUpdatedAt: null, heartbeatAt: null, executionHealth: null, elapsedSeconds: 20, errorCode: null, failureSummary: null } }