package equipo import ( "fmt" "testing" "amadan.net/oficina/equipo/internal/wire" ) // Mac Engineering's waits are the creator's to see under Needs you: a // Mac that fits all but Claude says, for each Engineering status, its own // line naming the Mac; a Mac or primary that needs an update names it. func TestMacEngineeringWaitLines(t *testing.T) { seen := map[string]string{} for _, state := range wire.EngineeringStates[1:] { task := wire.Task{ID: "t1", Creator: "owner@example.com", Stage: wire.StageInProgress, NeedsYou: wire.NeedsMacConnection, Steps: []wire.Step{{ID: "s1", Specialist: wire.SpecialistEngineering, State: wire.StepQueued, Placement: wire.PlacementMacConnection, RunnerLabel: "Tito Studio", EngineeringStatus: &wire.EngineeringStatus{State: state}, Attempt: 1}}} if !needsViewer(task, "owner@example.com", nil) || !needsSomeone(task) || groupOf(task, "owner@example.com", nil) != "needs" { t.Fatalf("%s: not under Needs you", state) } v := taskLineOf(task, "owner@example.com") if want := fmt.Sprintf(copyText("work.needs.mac_connection"), "Tito Studio"); v.StageLine != want || copyText("work.needs.mac_connection") == "" { t.Fatalf("%s: stage line %q", state, v.StageLine) } v.Mine, v.Cancel = true, true d := decisionOf(task, v) key := "work.decide.mac_connection_why." + state if d == nil || copyText(key) == "" || d.Why != fmt.Sprintf(copyText(key), "Tito Studio") || d.Ask == "" || !d.Cancel { t.Fatalf("%s: decision %+v", state, d) } if other, ok := seen[d.Why]; ok { t.Fatalf("%s and %s say the same: %q", state, other, d.Why) } seen[d.Why] = state } task := wire.Task{ID: "t1", Creator: "owner@example.com", Stage: wire.StageInProgress, NeedsYou: wire.NeedsMacUpdate, Steps: []wire.Step{{ID: "s1", Specialist: wire.SpecialistEngineering, State: wire.StepQueued, Placement: wire.PlacementMacUpdate, RunnerLabel: "docs-t1", Attempt: 1}}} if !needsViewer(task, "owner@example.com", nil) || !needsSomeone(task) { t.Fatal("mac_update: not under Needs you") } v := taskLineOf(task, "owner@example.com") if want := fmt.Sprintf(copyText("work.needs.mac_update"), "docs-t1"); v.StageLine != want || copyText("work.needs.mac_update") == "" { t.Fatalf("mac_update: stage line %q", v.StageLine) } v.Mine, v.Cancel = true, true if d := decisionOf(task, v); d == nil || d.Why != fmt.Sprintf(copyText("work.decide.mac_update_why"), "docs-t1") || copyText("work.decide.mac_update_why") == "" || d.Ask == "" || !d.Cancel { t.Fatalf("mac_update: decision %+v", d) } }