test(doctor): cover mutation command wiring (age-nw28h.2.7.3)

This commit is contained in:
boshu
2026-07-11 19:42:37 -04:00
parent 8cf46a670c
commit 8a9c3293a8
2 changed files with 34 additions and 1 deletions
+33
View File
@@ -15,6 +15,39 @@ import (
"github.com/boshu2/agentops/cli/internal/doctor"
)
func TestDoctorMutationRequestCopiesCommandFlags(t *testing.T) {
oldOnly, oldSkip := doctorOnly, doctorSkip
oldQuick, oldOnline := doctorQuick, doctorOnline
oldSeverity, oldDryRun := doctorSeverity, doctorDryRun
oldRobot := doctorRobot
t.Cleanup(func() {
doctorOnly, doctorSkip = oldOnly, oldSkip
doctorQuick, doctorOnline = oldQuick, oldOnline
doctorSeverity, doctorDryRun = oldSeverity, oldDryRun
doctorRobot = oldRobot
})
doctorOnly = []string{"one"}
doctorSkip = []string{"two"}
doctorQuick = true
doctorOnline = true
doctorSeverity = "P2"
doctorDryRun = true
doctorRobot = true
request := doctorMutationRequest()
if len(request.Only) != 1 || request.Only[0] != "one" || len(request.Skip) != 1 || request.Skip[0] != "two" {
t.Fatalf("request=%+v", request)
}
if !request.Quick || !request.Online || request.Severity != "P2" || !request.DryRun || !request.JSON {
t.Fatalf("request=%+v", request)
}
doctorOnly[0] = "changed"
if request.Only[0] != "one" {
t.Fatalf("request aliases command flags: %+v", request)
}
}
func TestComputeResult(t *testing.T) {
tests := []struct {
name string
+1 -1
View File
@@ -143,7 +143,7 @@ ao doctor [command]
--online Enable network probes (default: offline-only)
--only strings Scope to a subset of detectors or subsystems
--quick Run only fast-path detectors (< 200ms)
--robot Alias for --json with structured wrapper
--robot Alias for stable JSON report output
--robot-triage Emit the mega-command triage JSON
--severity string Minimum severity to emit (P0|P1|P2|P3) (default "P3")
--since string Diff findings against an earlier run