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

Function TestTracks_ScopeFlag_JSON

apps/cli/internal/cli/tracks_test.go:458–490  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

456}
457
458func TestTracks_ScopeFlag_JSON(t *testing.T) {
459 tmpDir := createTracksTestTaskFiles(t)
460 resetTracksFlags()
461 tracksFormat = "json"
462 tracksScope = "scope-a"
463
464 output, err := captureTracksOutput(t, []string{tmpDir})
465 if err != nil {
466 t.Fatalf("runTracks failed: %v", err)
467 }
468
469 var result tracks.Result
470 if err := json.Unmarshal([]byte(output), &result); err != nil {
471 t.Fatalf("Failed to parse JSON: %v\nOutput: %s", err, output)
472 }
473
474 if len(result.Tracks) != 1 {
475 t.Fatalf("expected 1 track with --scope, got %d", len(result.Tracks))
476 }
477
478 // Tasks 002 and 003 both touch scope-a
479 ids := map[string]bool{}
480 for _, task := range result.Tracks[0].Tasks {
481 ids[task.ID] = true
482 }
483 if !ids["002"] || !ids["003"] {
484 t.Errorf("expected tasks 002 and 003 in scoped track, got %v", ids)
485 }
486
487 if len(result.Flexible) != 0 {
488 t.Errorf("expected no flexible tasks in scope mode, got %d", len(result.Flexible))
489 }
490}
491
492func TestTracks_ScopeFlag_Table(t *testing.T) {
493 tmpDir := createTracksTestTaskFiles(t)

Callers

nothing calls this directly

Calls 3

resetTracksFlagsFunction · 0.85
captureTracksOutputFunction · 0.85

Tested by

no test coverage detected