package backlog import "testing" func TestParse(t *testing.T) { raw := []byte(`--- id: TASK-007 title: Wire the issues view status: In Progress priority: high labels: - feature - ui dependencies: - TASK-001 ordinal: 7000 created_date: '2026-06-17 16:08' updated_date: '2026-06-17 16:21' --- Render backlog tasks as issues. ## Acceptance Criteria - [ ] list view - [x] detail view `) got, err := ParseTask("task-007 - wire-the-issues-view", raw) if err != nil { t.Fatalf("ParseTask: %v", err) } if got.ID != "TASK-007" { t.Errorf("ID = %q, want TASK-007", got.ID) } if got.Key() != "task-007" { t.Errorf("Key = %q, want task-007", got.Key()) } if got.Status != "In Progress" { t.Errorf("Status = %q", got.Status) } if got.Ordinal != 7000 { t.Errorf("Ordinal = %d, want 7000", got.Ordinal) } if len(got.Labels) != 2 || got.Labels[0] != "feature" { t.Errorf("Labels = %v", got.Labels) } if len(got.Deps) != 1 || got.Deps[0] != "TASK-001" { t.Errorf("Deps = %v", got.Deps) } if got.Body == "" || got.Body[0] == '-' { t.Errorf("Body not separated from frontmatter: %q", got.Body) } } func TestParseNoFrontmatter(t *testing.T) { got, err := ParseTask("loose-note", []byte("just a body, no frontmatter")) if err != nil { t.Fatalf("ParseTask: %v", err) } if got.ID != "loose-note" || got.Title != "loose-note" { t.Errorf("fallbacks not applied: id=%q title=%q", got.ID, got.Title) } if got.Status != "To Do" { t.Errorf("default status = %q, want To Do", got.Status) } }