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

Function Test_createRun

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

Source from the content-addressed store, hash-verified

360}
361
362func Test_createRun(t *testing.T) {
363 tests := []struct {
364 name string
365 opts CreateOptions
366 attach []string
367 host string
368 config string
369 httpStubs func(*testing.T, *httpmock.Registry)
370 promptStubs func(*testing.T, *prompter.PrompterMock)
371 wantsStdout string
372 wantsStderr string
373 wantsBrowse string
374 wantsErr string
375 }{
376 {
377 name: "no args",
378 opts: CreateOptions{
379 Detector: &fd.EnabledDetectorMock{},
380 WebMode: true,
381 },
382 wantsBrowse: "https://github.com/OWNER/REPO/issues/new",
383 wantsStderr: "Opening https://github.com/OWNER/REPO/issues/new in your browser.\n",
384 },
385 {
386 name: "title and body",
387 opts: CreateOptions{
388 Detector: &fd.EnabledDetectorMock{},
389 WebMode: true,
390 Title: "myissue",
391 Body: "hello cli",
392 },
393 wantsBrowse: "https://github.com/OWNER/REPO/issues/new?body=hello+cli&title=myissue",
394 wantsStderr: "Opening https://github.com/OWNER/REPO/issues/new in your browser.\n",
395 },
396 {
397 name: "assignee",
398 opts: CreateOptions{
399 Detector: &fd.EnabledDetectorMock{},
400 WebMode: true,
401 Assignees: []string{"monalisa"},
402 },
403 wantsBrowse: "https://github.com/OWNER/REPO/issues/new?assignees=monalisa&body=",
404 wantsStderr: "Opening https://github.com/OWNER/REPO/issues/new in your browser.\n",
405 },
406 {
407 name: "@me",
408 opts: CreateOptions{
409 Detector: &fd.EnabledDetectorMock{},
410 WebMode: true,
411 Assignees: []string{"@me"},
412 },
413 httpStubs: func(_ *testing.T, r *httpmock.Registry) {
414 r.Register(
415 httpmock.GraphQL(`query UserCurrent\b`),
416 httpmock.StringResponse(`
417 { "data": {
418 "viewer": { "login": "MonaLisa" }
419 } }`))

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