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

Function TestAdd_AllFlags

apps/cli/internal/cli/add_test.go:117–163  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

115}
116
117func TestAdd_AllFlags(t *testing.T) {
118 tmpDir := t.TempDir()
119 resetAddFlags()
120 taskDir = tmpDir
121 addPriority = "high"
122 addEffort = "large"
123 addTags = "backend,api"
124 addStatus = "in-progress"
125 addOwner = "alice"
126 addDependsOn = "001,002"
127 addParent = "010"
128
129 _, err := captureAddOutput(t, "Full featured task")
130 if err != nil {
131 t.Fatalf("unexpected error: %v", err)
132 }
133
134 files, _ := filepath.Glob(filepath.Join(tmpDir, "001-*.md"))
135 if len(files) != 1 {
136 t.Fatalf("expected 1 file, got %d", len(files))
137 }
138
139 content, _ := os.ReadFile(files[0])
140 fileStr := string(content)
141
142 if !strings.Contains(fileStr, "priority: high") {
143 t.Error("expected priority: high")
144 }
145 if !strings.Contains(fileStr, "effort: large") {
146 t.Error("expected effort: large")
147 }
148 if !strings.Contains(fileStr, `tags: ["backend", "api"]`) {
149 t.Error("expected tags with backend and api")
150 }
151 if !strings.Contains(fileStr, "status: in-progress") {
152 t.Error("expected status: in-progress")
153 }
154 if !strings.Contains(fileStr, "owner: alice") {
155 t.Error("expected owner: alice")
156 }
157 if !strings.Contains(fileStr, `dependencies: ["001", "002"]`) {
158 t.Error("expected dependencies with 001 and 002")
159 }
160 if !strings.Contains(fileStr, `parent: "010"`) {
161 t.Error("expected parent: \"010\"")
162 }
163}
164
165func TestAdd_GroupFlag(t *testing.T) {
166 tmpDir := t.TempDir()

Callers

nothing calls this directly

Calls 3

resetAddFlagsFunction · 0.85
captureAddOutputFunction · 0.85
ErrorMethod · 0.80

Tested by

no test coverage detected