feat(config): ignore jquery static assets (#1595)

This commit is contained in:
Richard Gomez authored and GitHub committed 2024-10-23 07:30:48 -05:00
1 parent 455ae0aab7
commit 50c2818167
3 files changed
+36 -1

No files matched your search

+32
View File
@@ -83,3 +83,35 @@ func TestConfigAllowlistRegexes(t *testing.T) {
})
}
}
func TestConfigAllowlistPaths(t *testing.T) {
tests := map[string]struct {
invalid []string
valid []string
}{
"javascript - jquery.js": {
invalid: []string{
`src/main/resources/static/jquery-ui-1.12.1/jquery-ui-min.js`,
`src/main/resources/static/js/jquery-ui-1.10.4.min.js`,
},
},
}
cfg := CreateGlobalConfig()
allowlist := cfg.Allowlist
for name, cases := range tests {
t.Run(name, func(t *testing.T) {
for _, c := range cases.invalid {
if !allowlist.PathAllowed(c) {
t.Errorf("invalid path not marked as allowed: %s", c)
}
}
for _, c := range cases.valid {
if allowlist.PathAllowed(c) {
t.Errorf("valid path marked as allowed: %s", c)
}
}
})
}
}