routeConfigCommand dispatches on the subsection name. An unknown name prints a hint without panicking, and routing is case-insensitive.
(t *testing.T)
| 92 | // routeConfigCommand dispatches on the subsection name. An unknown name |
| 93 | // prints a hint without panicking, and routing is case-insensitive. |
| 94 | func TestRouteConfigCommand(t *testing.T) { |
| 95 | c := minimalCLI(t) |
| 96 | |
| 97 | tests := []struct { |
| 98 | name string |
| 99 | args []string |
| 100 | wantToken string // substring expected in captured output |
| 101 | }{ |
| 102 | {"empty → panorama", []string{}, "PANORAMA"}, |
| 103 | {"general", []string{"general"}, "GENERAL"}, |
| 104 | {"AGENT caps", []string{"AGENT"}, "AGENT RUNTIME"}, |
| 105 | {"unknown section", []string{"bogus"}, "Unknown section"}, |
| 106 | } |
| 107 | for _, tt := range tests { |
| 108 | t.Run(tt.name, func(t *testing.T) { |
| 109 | out := captureStdout(t, func() { c.routeConfigCommand(context.Background(), tt.args) }) |
| 110 | if !strings.Contains(out, tt.wantToken) { |
| 111 | t.Errorf("expected output to contain %q, got:\n%s", tt.wantToken, out) |
| 112 | } |
| 113 | }) |
| 114 | } |
| 115 | } |
| 116 | |
| 117 | // Server section short-circuits with a "skipped" notice when no |
| 118 | // server-mode envs are set. When any of them is set it prints the full |
nothing calls this directly
no test coverage detected