Skip to content

Commit c061d08

Browse files
committed
test: add snapshot case for detectors preset
1 parent 8a1fd47 commit c061d08

2 files changed

Lines changed: 45 additions & 0 deletions

File tree

internal/scalibrplugin/__snapshots__/resolve_test.snap

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,28 @@
11

2+
[TestResolve_Detectors_Presets/cis - 1]
3+
cis/generic-linux/etcpasswdpermissions
4+
---
5+
6+
[TestResolve_Detectors_Presets/govulncheck - 1]
7+
govulncheck/binary
8+
---
9+
10+
[TestResolve_Detectors_Presets/untested - 1]
11+
cve/cve-2020-11978
12+
cve/cve-2020-16846
13+
cve/cve-2022-33891
14+
cve/cve-2023-38408
15+
cve/cve-2023-6019
16+
cve/cve-2024-2912
17+
---
18+
19+
[TestResolve_Detectors_Presets/weakcreds - 1]
20+
weakcredentials/codeserver
21+
weakcredentials/etcshadow
22+
weakcredentials/filebrowser
23+
weakcredentials/winlocal
24+
---
25+
226
[TestResolve_Extractors_Presets/artifact - 1]
327
chrome/extensions
428
containers/containerd

internal/scalibrplugin/resolve_test.go

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -615,6 +615,27 @@ func TestResolve_Extractors(t *testing.T) {
615615
}
616616
}
617617

618+
func TestResolve_Detectors_Presets(t *testing.T) {
619+
t.Parallel()
620+
621+
for _, preset := range []string{"cis", "govulncheck", "untested", "weakcreds"} {
622+
t.Run(preset, func(t *testing.T) {
623+
t.Parallel()
624+
625+
got := scalibrplugin.Resolve([]string{preset}, []string{})
626+
627+
gotNames := make([]string, 0, len(got))
628+
for _, detector := range got {
629+
gotNames = append(gotNames, detector.Name())
630+
}
631+
632+
slices.Sort(gotNames)
633+
634+
testutility.NewSnapshot().MatchText(t, strings.Join(gotNames, "\n"))
635+
})
636+
}
637+
}
638+
618639
func TestResolve_Extractors_Presets(t *testing.T) {
619640
t.Parallel()
620641

0 commit comments

Comments
 (0)