package taskplan import "testing" func TestPlaybookValidation(t *testing.T) { steps := BugPlan("", 1).Steps for _, key := range []string{"review", "verify", "merge"} { t.Run(key, func(t *testing.T) { changed := []Step{} for _, st := range steps { if st.Key != key { changed = append(changed, st) } } if ValidatePlaybook(Bug, changed) == nil { t.Fatal("mandatory tail removed") } }) } bad := append([]Step(nil), steps...) bad[2], bad[3] = bad[3], bad[2] if ValidatePlaybook(Bug, bad) == nil { t.Fatal("tail order changed") } research := []Step{{Key: "research", Specialist: "engineering", Action: "investigate"}, steps[2], steps[3], steps[5]} if ValidatePlaybook(Investigation, research) != nil { t.Fatal("valid investigation rejected") } research[3].DependsOn = []string{"review"} if ValidatePlaybook(Investigation, research) == nil { t.Fatal("checkpoint depends on deferred review") } if ValidatePlaybook(Investigation, steps) == nil { t.Fatal("investigation retained publication before checkpoint") } }