Repository: cli/cli
File: pkg/cmd/pr/create/create_test.go (Go)

Code before:
			if tt.wantErr != "" {
				assert.EqualError(t, err, tt.wantErr)
			} else {
				assert.NoError(t, err)
				if tt.expectedOut != "" {
					assert.Equal(t, tt.expectedOut, output.String())
				}
				if len(tt.expectedOutputs) > 0 {
					assert.Equal(t, tt.expectedOutputs, strings.Split(output.String(), "\n"))
				}
				assert.Equal(t, tt.expectedErrOut, output.Stderr())
				assert.Equal(t, tt.expectedBrowse, output.BrowsedURL)
			}
		})
	}
}

func TestRemoteGuessing(t *testing.T) {
	// Given git config does not provide the necessary info to determine a remote
	cs, cmdTeardown := run.Stub()
	defer cmdTeardown(t)

	cs.Register(`git status --porcelain`, 0, "")
	cs.Register(`git config --get-regexp \^branch\\\..+\\\.\(remote\|merge\|pushremote\|gh-merge-base\)\$`, 0, "")
	cs.Register(`git rev-parse --symbolic-full-name feature@{push}`, 1, "")
	cs.Register("git config remote.pushDefault", 1, "")
	cs.Register("git config push.default", 1, "")

	// And Given there is a remote on a SHA that matches the current HEAD
	cs.Register(`git show-ref --verify -- HEAD refs/remotes/upstream/feature refs/remotes/origin/feature`, 0, heredoc.Doc(`
	deadbeef HEAD
	deadb00f refs/remotes/upstream/feature
	deadbeef refs/remotes/origin/feature`))

	// When the command is run
	reg := &httpmock.Registry{}
	reg.StubRepoInfoResponse("OWNER", "REPO", "master")
	defer reg.Verify(t)

	reg.Register(
		httpmock.GraphQL(`mutation PullRequestCreate\b`),
		httpmock.GraphQLMutation(`
				{ "data": { "createPullRequest": { "pullRequest": {
					"URL": "https://github.com/OWNER/REPO/pull/12"
				} } } }`, func(input map[string]interface{}) {
			assert.Equal(t, "REPOID", input["repositoryId"].(string))
			assert.Equal(t, "master", input["baseRefName"].(string))
			assert.Equal(t, "OTHEROWNER:feature", input["headRefName"].(string))
		}))

	ios, _, _, _ := iostreams.Test()

Review comment (suggestion):
For consistency you can use `require`/`assert`:

```suggestion
							assert.NotContains(t, inputs, "assigneeIds")
							assert.NotContains(t, inputs, "userIds")
```

Code after:
					httpmock.StringResponse(`
					{ "data": { "organization": { "teams": {
						"nodes": [
							{ "slug": "core", "id": "COREID" },
							{ "slug": "robots", "id": "ROBOTID" }
						],
						"pageInfo": { "hasNextPage": false }
					} } } }
					`))
				reg.Register(
					httpmock.GraphQL(`mutation PullRequestCreate\b`),
					httpmock.GraphQLMutation(`
						{ "data": { "createPullRequest": { "pullRequest": {
							"id": "NEWPULLID",
							"URL": "https://github.com/OWNER/REPO/pull/12"
						} } } }
						`,
						func(inputs map[string]interface{}) {
							assert.Equal(t, "TITLE", inputs["title"])
							assert.Equal(t, "BODY", inputs["body"])
							if v, ok := inputs["assigneeIds"]; ok {
								t.Errorf("did not expect assigneeIds: %v", v)
							}
							if v, ok := inputs["userIds"]; ok {
								t.Errorf("did not expect userIds: %v", v)
							}
						}))
				reg.Register(
					httpmock.GraphQL(`mutation PullRequestCreateRequestReviews\b`),
					httpmock.GraphQLMutation(`
					{ "data": { "requestReviews": {
						"clientMutationId": ""
					} } }
				`, func(inputs map[string]interface{}) {
						assert.Equal(t, "NEWPULLID", inputs["pullRequestId"])
						assert.Equal(t, []interface{}{"COREID"}, inputs["teamIds"])
						assert.Equal(t, []interface{}{"MONAID"}, inputs["userIds"])
						assert.Equal(t, true, inputs["union"])
					}))
			},
			expectedOut:    "https://github.com/OWNER/REPO/pull/12\n",
			expectedErrOut: "\nCreating pull request for feature into master in OWNER/REPO\n\n",
		},
	}
	for _, tt := range tests {
		t.Run(tt.name, func(t *testing.T) {
			branch := "feature"
			reg := &httpmock.Registry{}
			reg.StubRepoInfoResponse("OWNER", "REPO", "master")
			defer reg.Verify(t)
			if tt.httpStubs != nil {