fork of https://github.com/sourcegraph/zoekt
0

Configure Feed

Select the types of activity you want to include in your feed.

at main 891 B View raw
1package mockSearcher 2 3import ( 4 "context" 5 "fmt" 6 7 "github.com/sourcegraph/zoekt" 8 "github.com/sourcegraph/zoekt/query" 9) 10 11type MockSearcher struct { 12 WantSearch query.Q 13 SearchResult *zoekt.SearchResult 14 15 WantList query.Q 16 RepoList *zoekt.RepoList 17} 18 19func (s *MockSearcher) Search(ctx context.Context, q query.Q, opts *zoekt.SearchOptions) (*zoekt.SearchResult, error) { 20 if q.String() != s.WantSearch.String() { 21 return nil, fmt.Errorf("got query %s != %s", q.String(), s.WantSearch.String()) 22 } 23 return s.SearchResult, nil 24} 25 26func (s *MockSearcher) List(ctx context.Context, q query.Q, opts *zoekt.ListOptions) (*zoekt.RepoList, error) { 27 if q.String() != s.WantList.String() { 28 return nil, fmt.Errorf("got query %s != %s", q.String(), s.WantList.String()) 29 } 30 return s.RepoList, nil 31} 32 33func (*MockSearcher) Close() {} 34 35func (*MockSearcher) String() string { 36 return "MockSearcher" 37}