MCPcopy
hub / github.com/cli/cli / TestGetRepoSuggestions

Function TestGetRepoSuggestions

internal/codespaces/api/api_test.go:440–470  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

438}
439
440func TestGetRepoSuggestions(t *testing.T) {
441 tests := []struct {
442 searchText string // The input search string
443 queryText string // The wanted query string (based off searchText)
444 sort string // (Optional) The RepoSearchParameters.Sort param
445 maxRepos string // (Optional) The RepoSearchParameters.MaxRepos param
446 }{
447 {
448 searchText: "test",
449 queryText: "test",
450 },
451 {
452 searchText: "org/repo",
453 queryText: "repo user:org",
454 },
455 {
456 searchText: "org/repo/extra",
457 queryText: "repo/extra user:org",
458 },
459 {
460 searchText: "test",
461 queryText: "test",
462 sort: "stars",
463 maxRepos: "1000",
464 },
465 }
466
467 for _, tt := range tests {
468 runRepoSearchTest(t, tt.searchText, tt.queryText, tt.sort, tt.maxRepos)
469 }
470}
471
472func createFakeSearchReposServer(t *testing.T, wantSearchText string, wantSort string, wantPerPage string, responseRepos []*Repository) *httptest.Server {
473 return httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {

Callers

nothing calls this directly

Calls 1

runRepoSearchTestFunction · 0.85

Tested by

no test coverage detected