MCPcopy Index your code
hub / github.com/cli/cli / TestRunCreateField_TEXT

Function TestRunCreateField_TEXT

pkg/cmd/project/field-create/field_create_test.go:387–467  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

385}
386
387func TestRunCreateField_TEXT(t *testing.T) {
388 defer gock.Off()
389 gock.Observe(gock.DumpRequest)
390 // get viewer ID
391 gock.New("https://api.github.com").
392 Post("/graphql").
393 MatchType("json").
394 JSON(map[string]interface{}{
395 "query": "query ViewerOwner.*",
396 }).
397 Reply(200).
398 JSON(map[string]interface{}{
399 "data": map[string]interface{}{
400 "viewer": map[string]interface{}{
401 "id": "an ID",
402 },
403 },
404 })
405
406 // get project ID
407 gock.New("https://api.github.com").
408 Post("/graphql").
409 MatchType("json").
410 JSON(map[string]interface{}{
411 "query": "query ViewerProject.*",
412 "variables": map[string]interface{}{
413 "number": 1,
414 "firstItems": 0,
415 "afterItems": nil,
416 "firstFields": 0,
417 "afterFields": nil,
418 },
419 }).
420 Reply(200).
421 JSON(map[string]interface{}{
422 "data": map[string]interface{}{
423 "viewer": map[string]interface{}{
424 "projectV2": map[string]interface{}{
425 "id": "an ID",
426 },
427 },
428 },
429 })
430
431 // create Field
432 gock.New("https://api.github.com").
433 Post("/graphql").
434 BodyString(`{"query":"mutation CreateField.*","variables":{"input":{"projectId":"an ID","dataType":"TEXT","name":"a name"}}}`).
435 Reply(200).
436 JSON(map[string]interface{}{
437 "data": map[string]interface{}{
438 "createProjectV2Field": map[string]interface{}{
439 "projectV2Field": map[string]interface{}{
440 "id": "Field ID",
441 },
442 },
443 },
444 })

Callers

nothing calls this directly

Calls 7

NewTestClientFunction · 0.92
TestFunction · 0.92
runCreateFieldFunction · 0.85
ReplyMethod · 0.80
SetStdoutTTYMethod · 0.80
EqualMethod · 0.80
StringMethod · 0.45

Tested by

no test coverage detected