Implement resume, skip, and stage selection
This commit is contained in:
42
internal/app/run_control_test.go
Normal file
42
internal/app/run_control_test.go
Normal file
@@ -0,0 +1,42 @@
|
||||
package app
|
||||
|
||||
import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"gitea.maximumdirect.net/eric/narratio/internal/manifest"
|
||||
)
|
||||
|
||||
func TestFirstNonSucceededIndex(t *testing.T) {
|
||||
stages := BuildFullPlan()
|
||||
m := manifest.New("2026-05-03", time.Now().UTC())
|
||||
m.MarkStageSucceeded("prepare", time.Now().UTC(), nil)
|
||||
m.MarkStageSucceeded("transcribe", time.Now().UTC(), nil)
|
||||
|
||||
got := firstNonSucceededIndex(stages, m)
|
||||
if got != 2 {
|
||||
t.Fatalf("firstNonSucceededIndex() = %d, want 2", got)
|
||||
}
|
||||
}
|
||||
|
||||
func TestDecideStageActions(t *testing.T) {
|
||||
stages := BuildFullPlan()[:2]
|
||||
m := manifest.New("2026-05-03", time.Now().UTC())
|
||||
m.MarkStageSucceeded("prepare", time.Now().UTC(), nil)
|
||||
|
||||
got := decideStageActions(stages, m, false)
|
||||
if len(got) != 2 {
|
||||
t.Fatalf("len(decisions) = %d, want 2", len(got))
|
||||
}
|
||||
if got[0].Action != stageActionSkip {
|
||||
t.Fatalf("prepare action = %q, want %q", got[0].Action, stageActionSkip)
|
||||
}
|
||||
if got[1].Action != stageActionRun {
|
||||
t.Fatalf("transcribe action = %q, want %q", got[1].Action, stageActionRun)
|
||||
}
|
||||
|
||||
forced := decideStageActions(stages, m, true)
|
||||
if forced[0].Action != stageActionRun {
|
||||
t.Fatalf("forced prepare action = %q, want %q", forced[0].Action, stageActionRun)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user