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

Function TestAPIResponse_FormatJSON

lib/api_client_test.go:483–496  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

481}
482
483func TestAPIResponse_FormatJSON(t *testing.T) {
484 resp := &lib.APIResponse{
485 Body: []byte(`{"key":"abc","name":"Test"}`),
486 }
487 formatted := resp.FormatJSON()
488 if !strings.Contains(formatted, " ") {
489 t.Error("expected pretty-printed JSON with indentation")
490 }
491
492 var parsed map[string]interface{}
493 if err := json.Unmarshal([]byte(formatted), &parsed); err != nil {
494 t.Errorf("formatted JSON should be valid: %v", err)
495 }
496}
497
498func TestAPIResponse_ParseError_ErrorField(t *testing.T) {
499 resp := &lib.APIResponse{

Callers

nothing calls this directly

Calls 2

FormatJSONMethod · 0.95
ErrorMethod · 0.80

Tested by

no test coverage detected