diff options
| author | RanXom <saiyedshizain@gmail.com> | 2026-07-13 01:54:57 +0530 |
|---|---|---|
| committer | RanXom <saiyedshizain@gmail.com> | 2026-07-13 01:54:57 +0530 |
| commit | dc0bd0a705c21ce7fdccbb576534d74bc9f513cc (patch) | |
| tree | 3c9750961f09d1fc08927cddfb9d9feb0a2d6961 /internal | |
| parent | caedac51246096e4358ca57ecfa32064c8c4b69e (diff) | |
| download | galleryd-dc0bd0a705c21ce7fdccbb576534d74bc9f513cc.tar.xz galleryd-dc0bd0a705c21ce7fdccbb576534d74bc9f513cc.zip | |
test(scanner): add test for hidden file skipping
Diffstat (limited to 'internal')
| -rw-r--r-- | internal/scanner/scanner_test.go | 10 | ||||
| -rw-r--r-- | internal/scanner/testdata/gallery/.secret.jpg | 0 |
2 files changed, 9 insertions, 1 deletions
diff --git a/internal/scanner/scanner_test.go b/internal/scanner/scanner_test.go index 870aab0..866b50a 100644 --- a/internal/scanner/scanner_test.go +++ b/internal/scanner/scanner_test.go @@ -43,7 +43,7 @@ func TestScanner(t *testing.T) { } }) - t.Run("skip hidden directories", func(t *testing.T) { + t.Run("skips hidden directories", func(t *testing.T) { for _, file := range files { if filepath.Base(file.Path) == "nuclearlaunchcode.txt" { t.Fatal("hidden file entered the scanner") @@ -51,6 +51,14 @@ func TestScanner(t *testing.T) { } }) + t.Run("skips hidden files", func(t *testing.T) { + for _, file := range files { + if filepath.Base(file.Path) == ".secret.jpg" { + t.Fatal("scanner returned hidden file") + } + } + }) + t.Run("deduplicates overlapping roots", func(t *testing.T) { root := filepath.Join("testdata", "duplicate") diff --git a/internal/scanner/testdata/gallery/.secret.jpg b/internal/scanner/testdata/gallery/.secret.jpg new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/internal/scanner/testdata/gallery/.secret.jpg |