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

Function TestValidate_CircularDependencies

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

Source from the content-addressed store, hash-verified

312}
313
314func TestValidate_CircularDependencies(t *testing.T) {
315 tests := []struct {
316 name string
317 tasks []*model.Task
318 wantErrs bool
319 }{
320 {
321 name: "simple cycle: A -> B -> A",
322 tasks: []*model.Task{
323 {
324 ID: "A",
325 Title: "Task A",
326 Dependencies: []string{"B"},
327 },
328 {
329 ID: "B",
330 Title: "Task B",
331 Dependencies: []string{"A"},
332 },
333 },
334 wantErrs: true,
335 },
336 {
337 name: "three-way cycle: A -> B -> C -> A",
338 tasks: []*model.Task{
339 {
340 ID: "A",
341 Title: "Task A",
342 Dependencies: []string{"B"},
343 },
344 {
345 ID: "B",
346 Title: "Task B",
347 Dependencies: []string{"C"},
348 },
349 {
350 ID: "C",
351 Title: "Task C",
352 Dependencies: []string{"A"},
353 },
354 },
355 wantErrs: true,
356 },
357 {
358 name: "self-cycle: A -> A",
359 tasks: []*model.Task{
360 {
361 ID: "A",
362 Title: "Task A",
363 Dependencies: []string{"A"},
364 },
365 },
366 wantErrs: true,
367 },
368 {
369 name: "no cycle: linear chain A -> B -> C",
370 tasks: []*model.Task{
371 {

Callers

nothing calls this directly

Calls 2

ValidateMethod · 0.95
NewValidatorFunction · 0.85

Tested by

no test coverage detected