From cce66ffa45779bc8752c0237a1dfad34083479bf Mon Sep 17 00:00:00 2001 From: Saiyed Shizain Date: Tue, 25 Aug 2026 19:40:36 +0530 Subject: feat(api): parse search query parameter --- internal/api/query_test.go | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'internal/api/query_test.go') diff --git a/internal/api/query_test.go b/internal/api/query_test.go index 0c3c1ae..a1effe7 100644 --- a/internal/api/query_test.go +++ b/internal/api/query_test.go @@ -227,3 +227,24 @@ func TestParseQueryExtension(t *testing.T) { t.Fatalf("expected extension %q, got %q", "jpg", got.Extension) } } + +func TestParseQuerySearch(t *testing.T) { + req := httptest.NewRequest( + "http.MethodGet", + "/api/photos?q=vacation", + nil, + ) + + got, err := parseQuery(req) + if err != nil { + t.Fatalf("parseQuery() error = %v", err) + } + + if got.Search != "vacation" { + t.Fatalf( + "expected search %q, got %q", + "vacation", + got.Search, + ) + } +} -- cgit v1.2.3