Add test for legacy assignee flow on GHES
Introduces a test case to verify that the interactive edit flow on GitHub Enterprise Server uses the legacy assignee selection without search, ensuring correct behavior when editing pull request assignees.
This commit is contained in:
parent
48bea46504
commit
fb031b2b43
1 changed files with 49 additions and 0 deletions
|
|
@ -898,6 +898,55 @@ func Test_editRun(t *testing.T) {
|
||||||
},
|
},
|
||||||
stdout: "https://github.com/OWNER/REPO/pull/123\n",
|
stdout: "https://github.com/OWNER/REPO/pull/123\n",
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
name: "interactive GHES uses legacy assignee flow without search",
|
||||||
|
input: &EditOptions{
|
||||||
|
Detector: &fd.DisabledDetectorMock{},
|
||||||
|
SelectorArg: "123",
|
||||||
|
Finder: shared.NewMockFinder("123", &api.PullRequest{
|
||||||
|
URL: "https://github.com/OWNER/REPO/pull/123",
|
||||||
|
Assignees: api.Assignees{
|
||||||
|
Nodes: []api.GitHubUser{{Login: "octocat", ID: "OCTOID"}},
|
||||||
|
TotalCount: 1,
|
||||||
|
},
|
||||||
|
}, ghrepo.New("OWNER", "REPO")),
|
||||||
|
Interactive: true,
|
||||||
|
Surveyor: testSurveyor{
|
||||||
|
fieldsToEdit: func(e *shared.Editable) error {
|
||||||
|
e.Assignees.Edited = true
|
||||||
|
return nil
|
||||||
|
},
|
||||||
|
editFields: func(e *shared.Editable, _ string) error {
|
||||||
|
require.False(t, e.Assignees.ActorAssignees)
|
||||||
|
require.Nil(t, e.AssigneeSearchFunc)
|
||||||
|
require.Contains(t, e.Assignees.Options, "monalisa")
|
||||||
|
require.Contains(t, e.Assignees.Options, "hubot")
|
||||||
|
|
||||||
|
e.Assignees.Value = []string{"monalisa", "hubot"}
|
||||||
|
return nil
|
||||||
|
},
|
||||||
|
},
|
||||||
|
Fetcher: testFetcher{},
|
||||||
|
EditorRetriever: testEditorRetriever{},
|
||||||
|
},
|
||||||
|
httpStubs: func(t *testing.T, reg *httpmock.Registry) {
|
||||||
|
reg.Exclude(t, httpmock.GraphQL(`query RepositoryAssignableActors\b`))
|
||||||
|
reg.Register(
|
||||||
|
httpmock.GraphQL(`query RepositoryAssignableUsers\b`),
|
||||||
|
httpmock.StringResponse(`
|
||||||
|
{ "data": { "repository": { "assignableUsers": {
|
||||||
|
"nodes": [
|
||||||
|
{ "login": "hubot", "id": "HUBOTID" },
|
||||||
|
{ "login": "monalisa", "id": "MONAID" }
|
||||||
|
],
|
||||||
|
"pageInfo": { "hasNextPage": false }
|
||||||
|
} } } }
|
||||||
|
`))
|
||||||
|
reg.Exclude(t, httpmock.GraphQL(`mutation ReplaceActorsForAssignable\b`))
|
||||||
|
mockPullRequestUpdate(reg)
|
||||||
|
},
|
||||||
|
stdout: "https://github.com/OWNER/REPO/pull/123\n",
|
||||||
|
},
|
||||||
{
|
{
|
||||||
name: "non-interactive projects v1 unsupported doesn't fetch v1 metadata",
|
name: "non-interactive projects v1 unsupported doesn't fetch v1 metadata",
|
||||||
input: &EditOptions{
|
input: &EditOptions{
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue