From 5fb9e95217916e9d4b97ed29c0932e76ba48a24e Mon Sep 17 00:00:00 2001 From: graciousgrey Date: Fri, 14 Jul 2023 11:51:28 +0200 Subject: [PATCH] Tests: Add unit test #3493 --- internal/search/photos_filter_geo_test.go | 26 +++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/internal/search/photos_filter_geo_test.go b/internal/search/photos_filter_geo_test.go index 7fb219e26..f087c6833 100644 --- a/internal/search/photos_filter_geo_test.go +++ b/internal/search/photos_filter_geo_test.go @@ -23,8 +23,34 @@ func TestPhotosQueryGeo(t *testing.T) { if err != nil { t.Fatal(err) } + assert.GreaterOrEqual(t, len(photos0), 13) + for _, r0 := range photos0 { + assert.IsType(t, Photo{}, r0) + assert.NotEqual(t, "zz", r0.CellID) + } + + t.Run("geo:false", func(t *testing.T) { + var f form.SearchPhotos + + f.Query = "geo:false" + f.Merged = true + + photos, _, err := Photos(f) + + if err != nil { + t.Fatal(err) + } + + assert.LessOrEqual(t, len(photos), 13) + + for _, r := range photos { + assert.IsType(t, Photo{}, r) + assert.Equal(t, "zz", r.CellID) + } + }) + t.Run("StartsWithPercent", func(t *testing.T) { var f form.SearchPhotos