MCPcopy Create free account
hub / github.com/Facets-cloud/flow / TestRenderJSON

Function TestRenderJSON

internal/listfmt/listfmt_test.go:190–204  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

188}
189
190func TestRenderJSON(t *testing.T) {
191 type row struct {
192 Slug string `json:"slug"`
193 Status string `json:"status"`
194 }
195 rows := []row{{"a", "in-progress"}, {"b", "backlog"}}
196 var buf bytes.Buffer
197 if err := RenderJSON(&buf, rows); err != nil {
198 t.Fatalf("RenderJSON: %v", err)
199 }
200 out := buf.String()
201 if !strings.Contains(out, `"slug": "a"`) || !strings.Contains(out, `"status": "backlog"`) {
202 t.Errorf("RenderJSON output unexpected: %s", out)
203 }
204}
205
206func TestRenderTSV(t *testing.T) {
207 var buf bytes.Buffer

Callers

nothing calls this directly

Calls 2

RenderJSONFunction · 0.85
StringMethod · 0.80

Tested by

no test coverage detected