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

Function TestGet_JSONFormat

apps/cli/internal/cli/get_test.go:247–275  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

245}
246
247func TestGet_JSONFormat(t *testing.T) {
248 tmpDir := createGetTestFiles(t)
249 resetGetFlags()
250 taskDir = tmpDir
251 getFormat = "json"
252
253 output := captureGetOutput(t, "002")
254
255 var result getOutput
256 if err := json.Unmarshal([]byte(output), &result); err != nil {
257 t.Fatalf("Failed to parse JSON output: %v\nOutput: %s", err, output)
258 }
259
260 if result.ID != "002" {
261 t.Errorf("Expected ID '002', got %q", result.ID)
262 }
263 if result.Title != "Implement authentication" {
264 t.Errorf("Expected title 'Implement authentication', got %q", result.Title)
265 }
266 if result.Status != "in-progress" {
267 t.Errorf("Expected status 'in-progress', got %q", result.Status)
268 }
269 if result.Content == "" {
270 t.Error("Expected non-empty content in JSON output")
271 }
272 if len(result.Dependencies.DependsOn) != 1 || result.Dependencies.DependsOn[0].ID != "001" {
273 t.Error("Expected depends_on to contain task 001")
274 }
275}
276
277func TestGet_YAMLFormat(t *testing.T) {
278 tmpDir := createGetTestFiles(t)

Callers

nothing calls this directly

Calls 4

createGetTestFilesFunction · 0.85
resetGetFlagsFunction · 0.85
captureGetOutputFunction · 0.85
ErrorMethod · 0.80

Tested by

no test coverage detected