oficina / equipo Public

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

Plain git — no account needed to clone.

Download

Download this file

1package equipo
2
3import (
4 "fmt"
5 "testing"
6
7 "amadan.net/oficina/equipo/internal/wire"
8)
9
10// Mac Engineering's waits are the creator's to see under Needs you: a
11// Mac that fits all but Claude says, for each Engineering status, its own
12// line naming the Mac; a Mac or primary that needs an update names it.
13func TestMacEngineeringWaitLines(t *testing.T) {
14 seen := map[string]string{}
15 for _, state := range wire.EngineeringStates[1:] {
16 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}}}
17 if !needsViewer(task, "owner@example.com", nil) || !needsSomeone(task) || groupOf(task, "owner@example.com", nil) != "needs" {
18 t.Fatalf("%s: not under Needs you", state)
19 }
20 v := taskLineOf(task, "owner@example.com")
21 if want := fmt.Sprintf(copyText("work.needs.mac_connection"), "Tito Studio"); v.StageLine != want || copyText("work.needs.mac_connection") == "" {
22 t.Fatalf("%s: stage line %q", state, v.StageLine)
23 }
24 v.Mine, v.Cancel = true, true
25 d := decisionOf(task, v)
26 key := "work.decide.mac_connection_why." + state
27 if d == nil || copyText(key) == "" || d.Why != fmt.Sprintf(copyText(key), "Tito Studio") || d.Ask == "" || !d.Cancel {
28 t.Fatalf("%s: decision %+v", state, d)
29 }
30 if other, ok := seen[d.Why]; ok {
31 t.Fatalf("%s and %s say the same: %q", state, other, d.Why)
32 }
33 seen[d.Why] = state
34 }
35 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}}}
36 if !needsViewer(task, "owner@example.com", nil) || !needsSomeone(task) {
37 t.Fatal("mac_update: not under Needs you")
38 }
39 v := taskLineOf(task, "owner@example.com")
40 if want := fmt.Sprintf(copyText("work.needs.mac_update"), "docs-t1"); v.StageLine != want || copyText("work.needs.mac_update") == "" {
41 t.Fatalf("mac_update: stage line %q", v.StageLine)
42 }
43 v.Mine, v.Cancel = true, true
44 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 {
45 t.Fatalf("mac_update: decision %+v", d)
46 }
47}
48