Repository: cli/cli
File: pkg/cmd/pr/edit/edit_test.go (Go)

Code before:
				mockPullRequestAddReviewers(reg)
			},
			stdout: "https://github.com/OWNER/REPO/pull/123\n",
		},
		{
			name: "non-interactive reviewers remove contains team skips team fetch",
			input: &EditOptions{
				Detector:    &fd.EnabledDetectorMock{},
				SelectorArg: "123",
				Finder: shared.NewMockFinder("123", &api.PullRequest{URL: "https://github.com/OWNER/REPO/pull/123", ReviewRequests: api.ReviewRequests{Nodes: []struct{ RequestedReviewer api.RequestedReviewer }{
					{RequestedReviewer: api.RequestedReviewer{TypeName: "Team", Slug: "core", Organization: struct {
						Login string `json:"login"`
					}{Login: "OWNER"}}},
					{RequestedReviewer: api.RequestedReviewer{TypeName: "User", Login: "monalisa"}},
				}}}, ghrepo.New("OWNER", "REPO")),
				Interactive: false,
				Editable: shared.Editable{
					Reviewers: shared.EditableSlice{Remove: []string{"monalisa", "OWNER/core"}, Edited: true},
				},
				Fetcher: testFetcher{},
			},
			httpStubs: func(reg *httpmock.Registry, t *testing.T) {
				mockRepoMetadata(reg, mockRepoMetadataOptions{reviewers: true})
				reg.Exclude(t, httpmock.GraphQL(`query OrganizationTeamList\b`))
				mockPullRequestUpdate(reg)
				mockPullRequestRemoveReviewers(reg)
			},
			stdout: "https://github.com/OWNER/REPO/pull/123\n",
		},
		{
			name: "non-interactive mutate reviewers with no change to existing team reviewers skips team fetch",
			input: &EditOptions{
				Detector:    &fd.EnabledDetectorMock{},
				SelectorArg: "123",
				Finder:      shared.NewMockFinder("123", &api.PullRequest{URL: "https://github.com/OWNER/REPO/pull/123"}, ghrepo.New("OWNER", "REPO")),
				Interactive: false,
				Editable: shared.Editable{
					Reviewers: shared.EditableSlice{Add: []string{"monalisa"}, Remove: []string{"hubot"}, Default: []string{"OWNER/core"}, Edited: true},
				},
				Fetcher: testFetcher{},
			},
			httpStubs: func(reg *httpmock.Registry, t *testing.T) {
				// reviewers only (users), no team reviewers fetched
				mockRepoMetadata(reg, mockRepoMetadataOptions{reviewers: true})
				// explicitly assert that no OrganizationTeamList query occurs
				reg.Exclude(t, httpmock.GraphQL(`query OrganizationTeamList\b`))
				mockPullRequestUpdate(reg)
				mockPullRequestAddReviewers(reg)
			},
			stdout: "https://github.com/OWNER/REPO/pull/123\n",
		},

Review comment (suggestion):

```suggestion
				// explicitly assert that no OrganizationTeamList query occurs
				reg.Exclude(t, httpmock.GraphQL(`query OrganizationTeamList\b`))
```

Code after:
				mockPullRequestUpdate(reg)
				mockPullRequestAddReviewers(reg)
			},
			stdout: "https://github.com/OWNER/REPO/pull/123\n",
		},
		{
			name: "non-interactive reviewers remove contains team skips team fetch",
			input: &EditOptions{
				Detector:    &fd.EnabledDetectorMock{},
				SelectorArg: "123",
				Finder: shared.NewMockFinder("123", &api.PullRequest{URL: "https://github.com/OWNER/REPO/pull/123", ReviewRequests: api.ReviewRequests{Nodes: []struct{ RequestedReviewer api.RequestedReviewer }{
					{RequestedReviewer: api.RequestedReviewer{TypeName: "Team", Slug: "core", Organization: struct {
						Login string `json:"login"`
					}{Login: "OWNER"}}},
					{RequestedReviewer: api.RequestedReviewer{TypeName: "User", Login: "monalisa"}},
				}}}, ghrepo.New("OWNER", "REPO")),
				Interactive: false,
				Editable: shared.Editable{
					Reviewers: shared.EditableSlice{Remove: []string{"monalisa", "OWNER/core"}, Edited: true},
				},
				Fetcher: testFetcher{},
			},
			httpStubs: func(t *testing.T, reg *httpmock.Registry) {
				mockRepoMetadata(reg, mockRepoMetadataOptions{reviewers: true})
				// explicitly assert that no OrganizationTeamList query occurs
				reg.Exclude(t, httpmock.GraphQL(`query OrganizationTeamList\b`))
				mockPullRequestUpdate(reg)
				mockPullRequestRemoveReviewers(reg)
			},
			stdout: "https://github.com/OWNER/REPO/pull/123\n",
		},
		{
			name: "non-interactive mutate reviewers with no change to existing team reviewers skips team fetch",
			input: &EditOptions{
				Detector:    &fd.EnabledDetectorMock{},
				SelectorArg: "123",
				Finder:      shared.NewMockFinder("123", &api.PullRequest{URL: "https://github.com/OWNER/REPO/pull/123"}, ghrepo.New("OWNER", "REPO")),
				Interactive: false,
				Editable: shared.Editable{
					Reviewers: shared.EditableSlice{Add: []string{"monalisa"}, Remove: []string{"hubot"}, Default: []string{"OWNER/core"}, Edited: true},
				},
				Fetcher: testFetcher{},
			},
			httpStubs: func(t *testing.T, reg *httpmock.Registry) {
				// reviewers only (users), no team reviewers fetched
				mockRepoMetadata(reg, mockRepoMetadataOptions{reviewers: true})
				// explicitly assert that no OrganizationTeamList query occurs
				reg.Exclude(t, httpmock.GraphQL(`query OrganizationTeamList\b`))
				mockPullRequestUpdate(reg)
				mockPullRequestAddReviewers(reg)
			},