@@ -85,20 +85,45 @@ func Test_ExecCommandForOutputInDir(t *testing.T) {
8585 }
8686}
8787
88- func Test_ValidateDependencies_ValidDependencies (t * testing.T ) {
89- depends := []string {"task-uuid-1" , "task-uuid-2" }
90- currentTaskUUID := "current-task-uuid"
91- err := ValidateDependencies (depends , currentTaskUUID )
92- assert .NoError (t , err )
93- }
94-
9588func Test_ValidateDependencies_EmptyList (t * testing.T ) {
9689 depends := []string {}
9790 currentTaskUUID := "current-task-uuid"
9891 err := ValidateDependencies (depends , currentTaskUUID )
9992 assert .NoError (t , err )
10093}
10194
95+ // Circular Dependency Detection Tests
96+ func Test_detectCycle_NoCycle (t * testing.T ) { //A -> B -> C
97+ graph := map [string ][]string {
98+ "A" : {"B" },
99+ "B" : {"C" },
100+ "C" : {},
101+ }
102+
103+ hasCycle := detectCycle (graph , "A" )
104+ assert .False (t , hasCycle , "Should not detect cycle in linear dependency" )
105+ }
106+
107+ func Test_detectCycle_SimpleCycle (t * testing.T ) { // A -> B -> A
108+ graph := map [string ][]string {
109+ "A" : {"B" },
110+ "B" : {"A" },
111+ }
112+
113+ hasCycle := detectCycle (graph , "A" )
114+ assert .True (t , hasCycle , "Should detect simple cycle A -> B -> A" )
115+ }
116+
117+ func Test_detectCycle_ComplexCycle (t * testing.T ) { // A -> B -> C -> A
118+ graph := map [string ][]string {
119+ "A" : {"B" },
120+ "B" : {"C" },
121+ "C" : {"A" },
122+ }
123+
124+ hasCycle := detectCycle (graph , "A" )
125+ assert .True (t , hasCycle , "Should detect complex cycle A -> B -> C -> A" )
126+ }
102127func TestConvertISOToTaskwarriorFormat (t * testing.T ) {
103128 tests := []struct {
104129 name string
@@ -136,6 +161,24 @@ func TestConvertISOToTaskwarriorFormat(t *testing.T) {
136161 expected : "" ,
137162 hasError : true ,
138163 },
164+ {
165+ name : "Compact ISO datetime format (Taskwarrior export)" ,
166+ input : "20260128T000000Z" ,
167+ expected : "2026-01-28T00:00:00" ,
168+ hasError : false ,
169+ },
170+ {
171+ name : "Compact ISO datetime format with time" ,
172+ input : "20260128T143000Z" ,
173+ expected : "2026-01-28T14:30:00" ,
174+ hasError : false ,
175+ },
176+ {
177+ name : "Compact date only format" ,
178+ input : "20260128" ,
179+ expected : "2026-01-28" ,
180+ hasError : false ,
181+ },
139182 }
140183
141184 for _ , tt := range tests {
0 commit comments