(t *testing.T)
| 1475 | } |
| 1476 | |
| 1477 | func TestIssueCreate(t *testing.T) { |
| 1478 | http := &httpmock.Registry{} |
| 1479 | defer http.Verify(t) |
| 1480 | |
| 1481 | http.Register( |
| 1482 | httpmock.GraphQL(`query IssueRepositoryInfo\b`), |
| 1483 | httpmock.StringResponse(` |
| 1484 | { "data": { "repository": { |
| 1485 | "id": "REPOID", |
| 1486 | "hasIssuesEnabled": true |
| 1487 | } } }`), |
| 1488 | ) |
| 1489 | http.Register( |
| 1490 | httpmock.GraphQL(`mutation IssueCreate\b`), |
| 1491 | httpmock.GraphQLMutation(` |
| 1492 | { "data": { "createIssue": { "issue": { |
| 1493 | "URL": "https://github.com/OWNER/REPO/issues/12" |
| 1494 | } } } }`, |
| 1495 | func(inputs map[string]any) { |
| 1496 | assert.Equal(t, inputs["repositoryId"], "REPOID") |
| 1497 | assert.Equal(t, inputs["title"], "hello") |
| 1498 | assert.Equal(t, inputs["body"], "cash rules everything around me") |
| 1499 | }), |
| 1500 | ) |
| 1501 | |
| 1502 | output, err := runCommand(http, true, `-t hello -b "cash rules everything around me"`, nil) |
| 1503 | if err != nil { |
| 1504 | t.Errorf("error running command `issue create`: %v", err) |
| 1505 | } |
| 1506 | |
| 1507 | assert.Equal(t, "https://github.com/OWNER/REPO/issues/12\n", output.String()) |
| 1508 | } |
| 1509 | |
| 1510 | func TestIssueCreate_recover(t *testing.T) { |
| 1511 | http := &httpmock.Registry{} |
nothing calls this directly
no test coverage detected