| 1 | package chat |
| 2 | |
| 3 | import ( |
| 4 | "amadan.net/oficina/equipo/internal/copydesk" |
| 5 | "amadan.net/oficina/equipo/internal/wire" |
| 6 | "encoding/json" |
| 7 | "testing" |
| 8 | ) |
| 9 | |
| 10 | func TestCopyRepeatedChecksKeepReviewRounds(t *testing.T) { |
| 11 | sig := copydesk.Classify(copydesk.Input{Version: 1, Units: []string{"tests"}}, copydesk.Classification{Version: 1, Complete: true, Failures: []copydesk.Failure{{Unit: "tests", Test: "TestA", Code: "failed", Category: "other"}}}, "adapter") |
| 12 | raw, _ := json.Marshal(sig) |
| 13 | steps := []stepRecord{{Idx: 1, Specialist: wire.SpecialistEngineering, Pushed: true, CandidateSHA: "one"}, {Idx: 2, Specialist: wire.SpecialistChecks, Checks: wire.ChecksFailed, CandidateSHA: "one", FailureSignature: string(raw)}, {Idx: 3, Specialist: wire.SpecialistEngineering, Round: 1, Pushed: true, CandidateSHA: "two"}, {Idx: 4, Specialist: wire.SpecialistChecks, State: wire.StepDone, Checks: wire.ChecksFailed, CandidateSHA: "two", FailureSignature: string(raw)}} |
| 14 | p := progressFor(taskRecord{}, steps) |
| 15 | if !repeatedChecks(p, steps) { |
| 16 | t.Fatal("same classified failure not stopped") |
| 17 | } |
| 18 | if p.needsYou(taskRecord{}) != wire.NeedsFixRounds { |
| 19 | t.Fatal("repeat has no coordinator path") |
| 20 | } |
| 21 | steps = append(steps, stepRecord{Idx: 5, Specialist: wire.SpecialistReview, State: wire.StepDone, CandidateSHA: "two", Verdict: wire.VerdictChanges}) |
| 22 | if repeatedChecks(progressOf(steps), steps) { |
| 23 | t.Fatal("review round stopped early") |
| 24 | } |
| 25 | } |
| 26 | |