github.com/qri-io/qri@v0.10.1-0.20220104210721-c771715036cb/registry/regclient/search_test.go (about) 1 package regclient 2 3 import ( 4 "context" 5 "net/http/httptest" 6 "testing" 7 8 "github.com/qri-io/qri/registry" 9 "github.com/qri-io/qri/registry/regserver/handlers" 10 ) 11 12 func TestSearchMethods(t *testing.T) { 13 ctx := context.Background() 14 15 reg := registry.Registry{ 16 Profiles: registry.NewMemProfiles(), 17 Search: registry.MockSearch{}, 18 } 19 20 srv := httptest.NewServer(handlers.NewRoutes(reg)) 21 c := NewClient(&Config{ 22 Location: srv.URL, 23 }) 24 25 searchParams := &SearchParams{Query: "presidents", Limit: 100, Offset: 0} 26 // TODO: need to add tests that actually inspect the search results 27 _, err := c.Search(ctx, searchParams) 28 if err != nil { 29 t.Errorf("error executing search: %s", err) 30 } 31 }