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

Function TestTracks_JSONFormat

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

Source from the content-addressed store, hash-verified

131}
132
133func TestTracks_JSONFormat(t *testing.T) {
134 tmpDir := createTracksTestTaskFiles(t)
135 resetTracksFlags()
136 tracksFormat = "json"
137
138 output, err := captureTracksOutput(t, []string{tmpDir})
139 if err != nil {
140 t.Fatalf("runTracks failed: %v", err)
141 }
142
143 var result tracks.Result
144 if err := json.Unmarshal([]byte(output), &result); err != nil {
145 t.Fatalf("Failed to parse JSON: %v\nOutput: %s", err, output)
146 }
147
148 if len(result.Tracks) == 0 {
149 t.Error("Expected at least one track")
150 }
151
152 // Verify structure
153 for _, track := range result.Tracks {
154 if track.ID == 0 {
155 t.Error("Expected non-zero track ID")
156 }
157 if len(track.Tasks) == 0 {
158 t.Errorf("Track %d has no tasks", track.ID)
159 }
160 if len(track.Scopes) == 0 {
161 t.Errorf("Track %d has no scopes", track.ID)
162 }
163 }
164}
165
166func TestTracks_YAMLFormat(t *testing.T) {
167 tmpDir := createTracksTestTaskFiles(t)

Callers

nothing calls this directly

Calls 4

resetTracksFlagsFunction · 0.85
captureTracksOutputFunction · 0.85
ErrorMethod · 0.80

Tested by

no test coverage detected