File tree Expand file tree Collapse file tree 1 file changed +41
-0
lines changed
Expand file tree Collapse file tree 1 file changed +41
-0
lines changed Original file line number Diff line number Diff line change @@ -221,3 +221,44 @@ func TestEslintInstallationValidationLogic(t *testing.T) {
221221 })
222222 }
223223}
224+
225+ func TestValidatePaths (t * testing.T ) {
226+ tests := []struct {
227+ name string
228+ paths []string
229+ expectError bool
230+ }{
231+ {
232+ name : "valid path" ,
233+ paths : []string {"." },
234+ expectError : false ,
235+ },
236+ {
237+ name : "non-existent file" ,
238+ paths : []string {"non-existent-file.txt" },
239+ expectError : true ,
240+ },
241+ {
242+ name : "multiple paths with one invalid" ,
243+ paths : []string {"." , "non-existent-file.txt" },
244+ expectError : true ,
245+ },
246+ {
247+ name : "empty paths" ,
248+ paths : []string {},
249+ expectError : false ,
250+ },
251+ }
252+
253+ for _ , tt := range tests {
254+ t .Run (tt .name , func (t * testing.T ) {
255+ err := validatePaths (tt .paths )
256+ if tt .expectError {
257+ assert .Error (t , err )
258+ assert .Contains (t , err .Error (), "❌ Error: cannot find file or directory" )
259+ } else {
260+ assert .NoError (t , err )
261+ }
262+ })
263+ }
264+ }
You can’t perform that action at this time.
0 commit comments