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

Function TestCmdShowTaskDueDate

internal/app/show_test.go:403–425  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

401}
402
403func TestCmdShowTaskDueDate(t *testing.T) {
404 root, db := showListEditDB(t)
405 insertTask(t, db, "urgent", "Urgent", "in-progress", "high", filepath.Join(root, "x"), nil)
406 // Set due date to 2 days from now.
407 due := time.Now().AddDate(0, 0, 2).Format("2006-01-02")
408 if _, err := db.Exec(`UPDATE tasks SET due_date = ? WHERE slug = ?`, due, "urgent"); err != nil {
409 t.Fatal(err)
410 }
411 out := captureStdout(t, func() {
412 if rc := cmdShow([]string{"task", "urgent"}); rc != 0 {
413 t.Errorf("rc=%d", rc)
414 }
415 })
416 if !strings.Contains(out, "due:") {
417 t.Errorf("missing due: line; out=%q", out)
418 }
419 if !strings.Contains(out, due) {
420 t.Errorf("missing due date value; out=%q", out)
421 }
422 if !strings.Contains(out, "(in 2 days)") {
423 t.Errorf("missing due date info; out=%q", out)
424 }
425}
426
427func TestCmdShowTaskOverdue(t *testing.T) {
428 root, db := showListEditDB(t)

Callers

nothing calls this directly

Calls 4

showListEditDBFunction · 0.85
captureStdoutFunction · 0.85
cmdShowFunction · 0.85
insertTaskFunction · 0.70

Tested by

no test coverage detected