MCPcopy Create free account
hub / github.com/cli/cli / Test_createRun

Function Test_createRun

pkg/cmd/issue/create/create_test.go:390–1466  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

388}
389
390func Test_createRun(t *testing.T) {
391 tests := []struct {
392 name string
393 opts CreateOptions
394 attach []string
395 host string
396 config string
397 httpStubs func(*testing.T, *httpmock.Registry)
398 promptStubs func(*testing.T, *prompter.PrompterMock)
399 wantsStdout string
400 wantsStderr string
401 wantsBrowse string
402 wantsErr string
403 wantOperations *attachments.UploadResult
404 }{
405 {
406 name: "no args",
407 opts: CreateOptions{
408 Detector: &fd.EnabledDetectorMock{},
409 WebMode: true,
410 },
411 wantsBrowse: "https://github.com/OWNER/REPO/issues/new",
412 wantsStderr: "Opening https://github.com/OWNER/REPO/issues/new in your browser.\n",
413 },
414 {
415 name: "title and body",
416 opts: CreateOptions{
417 Detector: &fd.EnabledDetectorMock{},
418 WebMode: true,
419 Title: "myissue",
420 Body: "hello cli",
421 },
422 wantsBrowse: "https://github.com/OWNER/REPO/issues/new?body=hello+cli&title=myissue",
423 wantsStderr: "Opening https://github.com/OWNER/REPO/issues/new in your browser.\n",
424 },
425 {
426 name: "assignee",
427 opts: CreateOptions{
428 Detector: &fd.EnabledDetectorMock{},
429 WebMode: true,
430 Assignees: []string{"monalisa"},
431 },
432 wantsBrowse: "https://github.com/OWNER/REPO/issues/new?assignees=monalisa&body=",
433 wantsStderr: "Opening https://github.com/OWNER/REPO/issues/new in your browser.\n",
434 },
435 {
436 name: "@me",
437 opts: CreateOptions{
438 Detector: &fd.EnabledDetectorMock{},
439 WebMode: true,
440 Assignees: []string{"@me"},
441 },
442 httpStubs: func(_ *testing.T, r *httpmock.Registry) {
443 r.Register(
444 httpmock.GraphQL(`query UserCurrent\b`),
445 httpmock.StringResponse(`
446 { "data": {
447 "viewer": { "login": "MonaLisa" }

Callers

nothing calls this directly

Calls 15

VerifyMethod · 0.95
VerifyMethod · 0.95
GraphQLFunction · 0.92
StringResponseFunction · 0.92
GraphQLMutationFunction · 0.92
StubUploadFunction · 0.92
IndexesForFunction · 0.92
IndexForFunction · 0.92
GraphQLMutationMatcherFunction · 0.92
RESTFunction · 0.92
StubUploadToHostFunction · 0.92
TestFunction · 0.92

Tested by

no test coverage detected