diff options
| author | Saiyed Shizain <saiyedshizain@gmail.com> | 2026-08-26 16:46:29 +0530 |
|---|---|---|
| committer | Saiyed Shizain <saiyedshizain@gmail.com> | 2026-08-26 16:46:29 +0530 |
| commit | 6792c6f697db94012adca1c56d6b032d71d00665 (patch) | |
| tree | 336c79c7b314fc872c693a10f2e92569d832a766 /internal/gallery/query_photos_test.go | |
| parent | cce66ffa45779bc8752c0237a1dfad34083479bf (diff) | |
| download | galleryd-6792c6f697db94012adca1c56d6b032d71d00665.tar.xz galleryd-6792c6f697db94012adca1c56d6b032d71d00665.zip | |
feat(gallery): search photos by relative path
Diffstat (limited to 'internal/gallery/query_photos_test.go')
| -rw-r--r-- | internal/gallery/query_photos_test.go | 48 |
1 files changed, 45 insertions, 3 deletions
diff --git a/internal/gallery/query_photos_test.go b/internal/gallery/query_photos_test.go index b60cfea..c5d9376 100644 --- a/internal/gallery/query_photos_test.go +++ b/internal/gallery/query_photos_test.go @@ -312,12 +312,54 @@ func TestQueryPhotosFilterThenSortThenPaginate(t *testing.T) { assertIDs(t, got, "3") } -func TestQueryPhotosIgnoreSearchForNow(t *testing.T) { - photos := makePhotos(3) +func TestQueryPhotosSearchByRelativePath(t *testing.T) { + photos := []Photo{ + { + ID: "vacation", + File: scanner.File{ + RelativePath: "photos/vacation/beach.jpg", + }, + }, + { + ID: "work", + File: scanner.File{ + RelativePath: "photos/work/meeting.jpg", + }, + }, + { + ID: "vacation2", + File: scanner.File{ + RelativePath: "photos/vacation/mountains.jpg", + }, + }, + } got := QueryPhotos(photos, Query{ Search: "vacation", }) - assertIDs(t, got, "0", "1", "2") + assertIDs(t, got, "vacation", "vacation2") +} + +func TestQueryPhotosSearchIsCaseInsensitive(t *testing.T) { + photos := []Photo{ + { + ID: "1", + File: scanner.File{ + RelativePath: "Photos/Vacation/Beach.jpg", + }, + }, + { + ID: "2", + File: scanner.File{ + RelativePath: "photos/work/meeting.jpg", + }, + }, + } + + got := QueryPhotos(photos, Query{ + Search: "VACATION", + }) + + assertIDs(t, got, "1") } |