MCPcopy Create free account
hub / github.com/driangle/taskmd / TestPrintIssue_WithTaskID

Function TestPrintIssue_WithTaskID

apps/cli/internal/cli/validate_test.go:255–281  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

253}
254
255func TestPrintIssue_WithTaskID(t *testing.T) {
256 issue := validator.ValidationIssue{
257 Level: validator.LevelError,
258 TaskID: "042",
259 Message: "something wrong",
260 }
261
262 oldStdout := os.Stdout
263 r, w, _ := os.Pipe()
264 os.Stdout = w
265
266 printIssue(issue, getRenderer())
267
268 w.Close()
269 os.Stdout = oldStdout
270
271 var buf bytes.Buffer
272 buf.ReadFrom(r)
273 output := buf.String()
274
275 if !strings.Contains(output, "042") {
276 t.Errorf("expected task ID in output, got:\n%s", output)
277 }
278 if !strings.Contains(output, "something wrong") {
279 t.Errorf("expected message in output, got:\n%s", output)
280 }
281}
282
283func TestPrintIssue_WithoutTaskID(t *testing.T) {
284 issue := validator.ValidationIssue{

Callers

nothing calls this directly

Calls 2

printIssueFunction · 0.85
getRendererFunction · 0.85

Tested by

no test coverage detected