oficina / equipo Public

Clone
git clone https://amadan.net/oficina/equipo

Plain git — no account needed to clone.

Download

Download this file

1package taskplan
2
3import "testing"
4
5func TestPlaybookValidation(t *testing.T) {
6 steps := BugPlan("", 1).Steps
7 for _, key := range []string{"review", "verify", "merge"} {
8 t.Run(key, func(t *testing.T) {
9 changed := []Step{}
10 for _, st := range steps {
11 if st.Key != key {
12 changed = append(changed, st)
13 }
14 }
15 if ValidatePlaybook(Bug, changed) == nil {
16 t.Fatal("mandatory tail removed")
17 }
18 })
19 }
20 bad := append([]Step(nil), steps...)
21 bad[2], bad[3] = bad[3], bad[2]
22 if ValidatePlaybook(Bug, bad) == nil {
23 t.Fatal("tail order changed")
24 }
25 research := []Step{{Key: "research", Specialist: "engineering", Action: "investigate"}, steps[2], steps[3], steps[5]}
26 if ValidatePlaybook(Investigation, research) != nil {
27 t.Fatal("valid investigation rejected")
28 }
29 research[3].DependsOn = []string{"review"}
30 if ValidatePlaybook(Investigation, research) == nil {
31 t.Fatal("checkpoint depends on deferred review")
32 }
33 if ValidatePlaybook(Investigation, steps) == nil {
34 t.Fatal("investigation retained publication before checkpoint")
35 }
36}
37