diff options
| author | Saiyed Shizain <saiyedshizain@gmail.com> | 2026-08-26 16:53:33 +0530 |
|---|---|---|
| committer | Saiyed Shizain <saiyedshizain@gmail.com> | 2026-08-26 16:53:33 +0530 |
| commit | bd8fab9ace7444d1b97a6df7b2d81ef981808a05 (patch) | |
| tree | 0535b1eae4cf0fa21d24e2ed3e7ab4875c0e70f6 /internal/gallery | |
| parent | 6792c6f697db94012adca1c56d6b032d71d00665 (diff) | |
| download | galleryd-bd8fab9ace7444d1b97a6df7b2d81ef981808a05.tar.xz galleryd-bd8fab9ace7444d1b97a6df7b2d81ef981808a05.zip | |
test(gallery): cover combined query pipeline
Diffstat (limited to 'internal/gallery')
| -rw-r--r-- | internal/gallery/query_photos_test.go | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/internal/gallery/query_photos_test.go b/internal/gallery/query_photos_test.go index c5d9376..f38c237 100644 --- a/internal/gallery/query_photos_test.go +++ b/internal/gallery/query_photos_test.go @@ -363,3 +363,49 @@ func TestQueryPhotosSearchIsCaseInsensitive(t *testing.T) { assertIDs(t, got, "1") } + +func TestQueryPhotosFilterSearchSortThenPaginate(t *testing.T) { + photos := []Photo{ + { + ID: "1", + File: scanner.File{ + RelativePath: "photos/work/report.jpg", + }, + }, + { + ID: "2", + File: scanner.File{ + RelativePath: "photos/vacation/zebra.jpg", + }, + }, + { + ID: "3", + File: scanner.File{ + RelativePath: "photos/vacation/apple.jpg", + }, + }, + { + ID: "4", + File: scanner.File{ + RelativePath: "photos/vacation/beach.png", + }, + }, + { + ID: "5", + File: scanner.File{ + RelativePath: "photos/vacation/mountains.jpg", + }, + }, + } + + got := QueryPhotos(photos, Query{ + Extension: "jpg", + Search: "vacation", + Sort: SortByPath, + Order: SortAsc, + Offset: 1, + Limit: 1, + }) + + assertIDs(t, got, "5") +} |