Add assembled workflow compatibility coverage

This commit is contained in:
2026-08-29 20:08:48 +00:00
parent 3128bef20a
commit 5887839aa1
5 changed files with 314 additions and 39 deletions

View File

@@ -11,25 +11,20 @@ import (
"gitea.maximumdirect.net/eric/narratio/internal/stage"
)
func TestDecideStageActions(t *testing.T) {
func TestDecideStageAction(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 := decideStageAction(stages[0], m, false); got != stageActionSkip {
t.Fatalf("prepare action = %q, want %q", got, stageActionSkip)
}
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)
if got := decideStageAction(stages[1], m, false); got != stageActionRun {
t.Fatalf("transcribe action = %q, want %q", got, stageActionRun)
}
forced := decideStageActions(stages, m, true)
if forced[0].Action != stageActionRun {
t.Fatalf("forced prepare action = %q, want %q", forced[0].Action, stageActionRun)
if got := decideStageAction(stages[0], m, true); got != stageActionRun {
t.Fatalf("forced prepare action = %q, want %q", got, stageActionRun)
}
}