mirror of
https://github.com/LukeHagar/slinky.git
synced 2025-12-06 12:47:45 +00:00
Update .slinkignore to include additional SailPoint API URLs and enhance test coverage for ignored URLs. Modify tests to ensure proper handling of ignored paths and URLs, including node_modules and package-lock.json.
This commit is contained in:
@@ -44,11 +44,24 @@ func TestCollectURLs_FromTestFiles(t *testing.T) {
|
||||
if _, ok := urls["https://example.com/this/path/does/not/exist"]; ok {
|
||||
t.Fatalf("expected URL ignored by .slinkignore to be absent")
|
||||
}
|
||||
// Ignore sailpoint api variants
|
||||
ignoredAPIs := []string{
|
||||
"https://sailpoint.api.identitynow.com/beta",
|
||||
"https://sailpoint.api.identitynow.com/v3",
|
||||
"https://sailpoint.api.identitynow.com/v2024",
|
||||
"https://sailpoint.api.identitynow.com/v2025",
|
||||
"https://sailpoint.api.identitynow.com/v2026",
|
||||
}
|
||||
for _, u := range ignoredAPIs {
|
||||
if _, ok := urls[u]; ok {
|
||||
t.Fatalf("expected API URL %s to be ignored via .slinkignore", u)
|
||||
}
|
||||
}
|
||||
|
||||
// Verify .slinkignore path ignores: file under ignore-me should not contribute
|
||||
for u, files := range urls {
|
||||
for _, f := range files {
|
||||
if strings.Contains(f, "ignore-me/") {
|
||||
if strings.Contains(f, "ignore-me/") || strings.Contains(f, "node_modules/") || strings.HasSuffix(f, "package-lock.json") {
|
||||
t.Fatalf("file %s should have been ignored via .slinkignore, but contributed to URL %s", f, u)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,9 +27,9 @@ func TestCollectURLs_FromCodeFiles(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
// Ensure sanitizer trims emphasis and punctuation
|
||||
if _, ok := urls["https://sailpoint.api.identitynow.com/v2024"]; !ok {
|
||||
t.Fatalf("expected sanitized emphasized URL to be collected without trailing *")
|
||||
// Ensure sanitizer trims emphasis and punctuation (note: v2024 is ignored by .slinkignore)
|
||||
if _, ok := urls["https://sailpoint.api.identitynow.com/v2024"]; ok {
|
||||
t.Fatalf("expected v2024 URL to be ignored via .slinkignore")
|
||||
}
|
||||
if _, ok := urls["https://example.com/path"]; !ok {
|
||||
t.Fatalf("expected URL with trailing ) to be trimmed")
|
||||
|
||||
12
testdata/.slinkignore
vendored
12
testdata/.slinkignore
vendored
@@ -1,10 +1,18 @@
|
||||
{
|
||||
"ignorePaths": [
|
||||
"**/ignore-me/**",
|
||||
"**/*.bak"
|
||||
"**/*.bak",
|
||||
"node_modules",
|
||||
"package-lock.json"
|
||||
],
|
||||
"ignoreURLs": [
|
||||
"*notarealwebsite.com*",
|
||||
"https://example.com/this/path/does/not/exist",
|
||||
"*notarealwebsite.com*"
|
||||
"*acme*",
|
||||
"https://sailpoint.api.identitynow.com/beta",
|
||||
"https://sailpoint.api.identitynow.com/v3",
|
||||
"https://sailpoint.api.identitynow.com/v2024",
|
||||
"https://sailpoint.api.identitynow.com/v2025",
|
||||
"https://sailpoint.api.identitynow.com/v2026"
|
||||
]
|
||||
}
|
||||
|
||||
2
testdata/node_modules/pkg/readme.md
generated
vendored
Normal file
2
testdata/node_modules/pkg/readme.md
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
This is a vendored dependency and should be ignored.
|
||||
https://sailpoint.api.identitynow.com/v2024
|
||||
12
testdata/package-lock.json
generated
vendored
Normal file
12
testdata/package-lock.json
generated
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"name": "fixture",
|
||||
"version": "1.0.0",
|
||||
"dependencies": {
|
||||
"@acme/pkg": {
|
||||
"version": "1.2.3",
|
||||
"resolved": "https://registry.npmjs.org/@acme/pkg/-/pkg-1.2.3.tgz",
|
||||
"integrity": "sha512-...",
|
||||
"homepage": "https://acme.example.com"
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user