Show results whose plan item stopped as failed
The engine can stop a plan item without updating its drafts: a run paused on material_quote_changed leaves the draft "preparing" for good, so the result showed Preparing forever. A draft still at work now counts as failed once its plan item is failed, blocked, cancelled or skipped. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import { describe, expect, it } from 'vitest'
|
||||
import { correctIndex, questionsOf, toMarkdown, type Material } from './results'
|
||||
import { correctIndex, questionsOf, toMarkdown, withPlanItem, type Material } from './results'
|
||||
import { sentencesOf, scriptLang } from '../components/AudioPlayer'
|
||||
|
||||
describe('correctIndex', () => {
|
||||
@@ -52,3 +52,16 @@ describe('audio script helpers', () => {
|
||||
expect(scriptLang('This is the lesson that we will share with the team.')).toBe('en')
|
||||
})
|
||||
})
|
||||
|
||||
describe('withPlanItem', () => {
|
||||
it('fails a draft still at work when its plan item stopped', () => {
|
||||
expect(withPlanItem('preparing', 'failed')).toBe('failed')
|
||||
expect(withPlanItem('generating', 'blocked')).toBe('failed')
|
||||
})
|
||||
|
||||
it('keeps the draft status otherwise', () => {
|
||||
expect(withPlanItem('preparing', 'generating')).toBe('preparing')
|
||||
expect(withPlanItem('ready', 'failed')).toBe('ready')
|
||||
expect(withPlanItem('preparing', undefined)).toBe('preparing')
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user