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

Code before:
				mockIssueGet(t, reg)
				mockIssueProjectItemsGet(t, reg)
				mockRepoMetadata(t, reg)
				mockIssueUpdate(t, reg)
				mockIssueUpdateActorAssignees(t, reg)
				mockIssueUpdateLabels(t, reg)
				mockProjectV2ItemUpdate(t, reg)
			},
			stdout: "https://github.com/OWNER/REPO/issue/123\n",
		},
		{
			name: "interactive prompts with actor assignee display names when actors available",
			input: &EditOptions{
				IssueNumbers: []int{123},
				Interactive:  true,
				FieldsToEditSurvey: func(p prShared.EditPrompter, eo *prShared.Editable) error {
					eo.Assignees.Edited = true
					return nil
				},
				EditFieldsSurvey: func(p prShared.EditPrompter, eo *prShared.Editable, _ string) error {
					// Checking that the display name is being used in the prompt.
					require.Equal(t, eo.Assignees.Default, []string{"hubot", "MonaLisa (Mona Display Name)"})

					// Mocking a selection of only MonaLisa in the prompt.
					eo.Assignees.Value = []string{"MonaLisa (Mona Display Name)"}
					return nil
				},
				FetchOptions:    prShared.FetchOptions,
				DetermineEditor: func() (string, error) { return "vim", nil },
			},
			httpStubs: func(t *testing.T, reg *httpmock.Registry) {
				mockIsssueNumberGetWithAssignedActors(t, reg, 123)
				reg.Register(
					httpmock.GraphQL(`query RepositoryAssignableActors\b`),
					httpmock.StringResponse(`
					{ "data": { "repository": { "suggestedActors": {
						"nodes": [
							{ "login": "hubot", "id": "HUBOTID", "__typename": "Bot" },
							{ "login": "MonaLisa", "id": "MONAID", "name": "Mona Display Name", "__typename": "User" }
						],
						"pageInfo": { "hasNextPage": false }
					} } } }
					`))
				mockIssueUpdate(t, reg)
				reg.Register(
					httpmock.GraphQL(`mutation ReplaceActorsForAssignable\b`),
					httpmock.GraphQLMutation(`
					{ "data": { "replaceActorsForAssignable": { "__typename": "" } } }`,
						func(inputs map[string]interface{}) {
							// Checking that despite the display name being returned
							// from the EditFieldsSurvey, the ID is still

Review comment (suggestion):
Thought: We are missing out on testing that `eo.Assignees.Default` is properly loaded with display names and not logins. 

Code after:
				mockIssueGet(t, reg)
				mockIssueProjectItemsGet(t, reg)
				mockRepoMetadata(t, reg)
				mockIssueUpdate(t, reg)
				mockIssueUpdateActorAssignees(t, reg)
				mockIssueUpdateLabels(t, reg)
				mockProjectV2ItemUpdate(t, reg)
			},
			stdout: "https://github.com/OWNER/REPO/issue/123\n",
		},
		{
			name: "interactive prompts with actor assignee display names when actors available",
			input: &EditOptions{
				IssueNumbers: []int{123},
				Interactive:  true,
				FieldsToEditSurvey: func(p prShared.EditPrompter, eo *prShared.Editable) error {
					eo.Assignees.Edited = true
					return nil
				},
				EditFieldsSurvey: func(p prShared.EditPrompter, eo *prShared.Editable, _ string) error {
					// Checking that the display name is being used in the prompt.
					require.Equal(t, []string{"hubot"}, eo.Assignees.Default)
					require.Equal(t, []string{"hubot"}, eo.Assignees.DefaultLogins)

					// Adding MonaLisa as PR assignee, should preserve hubot.
					eo.Assignees.Value = []string{"hubot", "MonaLisa (Mona Display Name)"}
					return nil
				},
				FetchOptions:    prShared.FetchOptions,
				DetermineEditor: func() (string, error) { return "vim", nil },
			},
			httpStubs: func(t *testing.T, reg *httpmock.Registry) {
				mockIsssueNumberGetWithAssignedActors(t, reg, 123)
				reg.Register(
					httpmock.GraphQL(`query RepositoryAssignableActors\b`),
					httpmock.StringResponse(`
					{ "data": { "repository": { "suggestedActors": {
						"nodes": [
							{ "login": "hubot", "id": "HUBOTID", "__typename": "Bot" },
							{ "login": "MonaLisa", "id": "MONAID", "name": "Mona Display Name", "__typename": "User" }
						],
						"pageInfo": { "hasNextPage": false }
					} } } }
					`))
				mockIssueUpdate(t, reg)
				reg.Register(
					httpmock.GraphQL(`mutation ReplaceActorsForAssignable\b`),
					httpmock.GraphQLMutation(`
					{ "data": { "replaceActorsForAssignable": { "__typename": "" } } }`,
						func(inputs map[string]interface{}) {
							// Checking that despite the display name being returned