Skip to content

Commit ec4c3e9

Browse files
added-ut
1 parent 3651a22 commit ec4c3e9

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

internal/commands/scan_test.go

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2368,3 +2368,21 @@ func Test_parseArgs(t *testing.T) {
23682368
}
23692369
}
23702370
}
2371+
2372+
func Test_isValidJSONOrXML(t *testing.T) {
2373+
tests := []struct {
2374+
description string
2375+
inputPath string
2376+
output bool
2377+
}{
2378+
{"wrong file", "wrongfilepath", false},
2379+
{"correct file", "data/package.json", true},
2380+
}
2381+
2382+
for _, test := range tests {
2383+
isValid, _ := isValidJSONOrXML(test.inputPath)
2384+
if isValid != test.output {
2385+
t.Errorf(" test case failed for params %v", test)
2386+
}
2387+
}
2388+
}

0 commit comments

Comments
 (0)