From bd8fab9ace7444d1b97a6df7b2d81ef981808a05 Mon Sep 17 00:00:00 2001 From: Saiyed Shizain Date: Wed, 26 Aug 2026 16:53:33 +0530 Subject: test(gallery): cover combined query pipeline --- internal/gallery/query_photos_test.go | 46 +++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) 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") +} -- cgit v1.2.3