MCPcopy Create free account
hub / github.com/cronitorio/cronitor-cli / TestIntegration_MonitorGet_JSONOutput

Function TestIntegration_MonitorGet_JSONOutput

cmd/integration_test.go:158–185  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

156}
157
158func TestIntegration_MonitorGet_JSONOutput(t *testing.T) {
159 mock := testutil.NewMockAPI()
160 defer mock.Close()
161
162 fixture := testutil.LoadFixture("monitor_get.json")
163 mock.On("GET", "/monitors/my-job", 200, fixture)
164
165 cleanup := setupIntegrationTest(mock.Server.URL)
166 defer cleanup()
167
168 monitorFormat = ""
169 monitorOutput = ""
170
171 output, err := executeCmd("monitor", "get", "my-job")
172 if err != nil {
173 t.Fatalf("unexpected error: %v", err)
174 }
175
176 trimmed := strings.TrimSpace(output)
177 if !json.Valid([]byte(trimmed)) {
178 t.Errorf("expected valid pretty-printed JSON output, got:\n%s", output)
179 }
180
181 // Should be indented (pretty-printed)
182 if !strings.Contains(trimmed, "\n") {
183 t.Error("expected pretty-printed JSON (multi-line)")
184 }
185}
186
187// --- Step 9: YAML Output Test ---
188

Callers

nothing calls this directly

Calls 7

CloseMethod · 0.95
OnMethod · 0.95
NewMockAPIFunction · 0.92
LoadFixtureFunction · 0.92
setupIntegrationTestFunction · 0.85
executeCmdFunction · 0.85
ErrorMethod · 0.80

Tested by

no test coverage detected