MCPcopy Index your code
hub / github.com/keploy/keploy / TestJSONWriterWriteEnabled

Function TestJSONWriterWriteEnabled

utils/output_test.go:39–52  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

37}
38
39func TestJSONWriterWriteEnabled(t *testing.T) {
40 writer := NewJSONWriter(true)
41
42 out, err := captureStdout(t, func() error {
43 return writer.Write(map[string]string{"status": "ok"})
44 })
45 if err != nil {
46 t.Fatalf("expected no error, got %v", err)
47 }
48
49 if strings.TrimSpace(out) != `{"status":"ok"}` {
50 t.Fatalf("unexpected output: %q", out)
51 }
52}
53
54func TestJSONWriterWriteDisabled(t *testing.T) {
55 writer := NewJSONWriter(false)

Callers

nothing calls this directly

Calls 3

WriteMethod · 0.95
NewJSONWriterFunction · 0.85
captureStdoutFunction · 0.85

Tested by

no test coverage detected