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

Function TestValidate_DuplicateIDs

sdk/go/validator/validator_test.go:242–279  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

240}
241
242func TestValidate_DuplicateIDs(t *testing.T) {
243 tasks := []*model.Task{
244 {
245 ID: "001",
246 Title: "Task 1",
247 FilePath: "/path/to/task1.md",
248 },
249 {
250 ID: "001",
251 Title: "Task 2",
252 FilePath: "/path/to/task2.md",
253 },
254 {
255 ID: "002",
256 Title: "Task 3",
257 FilePath: "/path/to/task3.md",
258 },
259 }
260
261 v := NewValidator(false)
262 result := v.Validate(tasks)
263
264 if result.Errors != 1 {
265 t.Errorf("Expected 1 error for duplicate IDs, got %d", result.Errors)
266 }
267
268 // Check that the error message mentions both files
269 foundDuplicateError := false
270 for _, issue := range result.Issues {
271 if issue.TaskID == "001" && issue.Level == LevelError {
272 foundDuplicateError = true
273 }
274 }
275
276 if !foundDuplicateError {
277 t.Error("Expected duplicate ID error for task 001")
278 }
279}
280
281func TestValidate_MissingDependencies(t *testing.T) {
282 tasks := []*model.Task{

Callers

nothing calls this directly

Calls 3

ValidateMethod · 0.95
NewValidatorFunction · 0.85
ErrorMethod · 0.80

Tested by

no test coverage detected