aboutsummaryrefslogtreecommitdiff
path: root/internal/scanner/scanner_test.go
diff options
context:
space:
mode:
authorRanXom <saiyedshizain@gmail.com>2026-07-13 01:24:33 +0530
committerRanXom <saiyedshizain@gmail.com>2026-07-13 01:24:33 +0530
commit3323efbcd18ad48ff2dd8491d1830b57e8ac87dd (patch)
treec65a11096ee5eef63d5a1a0bbfdb824a9fba71f7 /internal/scanner/scanner_test.go
parentacb7160bb7dd885ae45f762d967ddfd4be6a3d23 (diff)
downloadgalleryd-3323efbcd18ad48ff2dd8491d1830b57e8ac87dd.tar.xz
galleryd-3323efbcd18ad48ff2dd8491d1830b57e8ac87dd.zip
feat(scanner): deduplicate discovered files
test(scanner): add test for deduplicacy
Diffstat (limited to 'internal/scanner/scanner_test.go')
-rw-r--r--internal/scanner/scanner_test.go18
1 files changed, 18 insertions, 0 deletions
diff --git a/internal/scanner/scanner_test.go b/internal/scanner/scanner_test.go
index f13384a..4027d95 100644
--- a/internal/scanner/scanner_test.go
+++ b/internal/scanner/scanner_test.go
@@ -48,4 +48,22 @@ func TestScan(t *testing.T) {
}
}
})
+
+ t.Run("Deduplicates overlapping roots", func(t *testing.T) {
+ root := filepath.Join("testdata", "duplicate")
+
+ s := New([]string{
+ root,
+ root,
+ })
+
+ files, err := s.Scan(context.Background())
+ if err != nil {
+ t.Fatalf("Scan failed: %v", err)
+ }
+
+ if len(files) != 2 {
+ t.Fatalf("Expected 2 unique files, got %d", len(files))
+ }
+ })
}