github.com/qri-io/qri@v0.10.1-0.20220104210721-c771715036cb/remote/registry/regclient/search_test.go (about)

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