@@ -158,6 +158,58 @@ func TestFuncProvider_GetFactoryFunc(t *testing.T) {
158158 wantErr : true ,
159159 errMsg : "data must be an array, got int" ,
160160 },
161+ // Command
162+ {
163+ name : "createCommand with string shell command" ,
164+ funcName : "createCommand" ,
165+ data : "echo hello world" ,
166+ expectedValue : & types.ShellCommand {
167+ Command : "echo hello world" ,
168+ },
169+ wantErr : false ,
170+ },
171+ {
172+ name : "createCommand with args array" ,
173+ funcName : "createCommand" ,
174+ data : []interface {}{"ls" , "-la" , "/tmp" },
175+ expectedValue : & types.ArgsCommand {
176+ Args : []string {"ls" , "-la" , "/tmp" },
177+ },
178+ wantErr : false ,
179+ },
180+ {
181+ name : "createCommand with args array containing non-string element" ,
182+ funcName : "createCommand" ,
183+ data : []interface {}{"ls" , 123 , "/tmp" },
184+ expectedValue : & types.ShellCommand {}, // Use a concrete type that implements Command
185+ wantErr : true ,
186+ errMsg : "invalid command data" ,
187+ },
188+ {
189+ name : "createCommand with invalid data type" ,
190+ funcName : "createCommand" ,
191+ data : 123 , // Invalid type for command data
192+ expectedValue : & types.ArgsCommand {}, // Use a concrete type that implements Command
193+ wantErr : true ,
194+ errMsg : "unsupported type for command data" ,
195+ },
196+ {
197+ name : "createCommand with empty args array" ,
198+ funcName : "createCommand" ,
199+ data : []interface {}{},
200+ expectedValue : & types.ArgsCommand {
201+ Args : []string {},
202+ },
203+ wantErr : false ,
204+ },
205+ {
206+ name : "createCommand with map data" ,
207+ funcName : "createCommand" ,
208+ data : map [string ]interface {}{"command" : "echo hello" },
209+ expectedValue : & types.ShellCommand {}, // Use a concrete type that implements Command
210+ wantErr : true ,
211+ errMsg : "unsupported type for command data" ,
212+ },
161213 // Container image
162214 {
163215 name : "createContainerImage with name and tag" ,
0 commit comments