(t *testing.T)
| 1517 | } |
| 1518 | |
| 1519 | func TestIssueCreate(t *testing.T) { |
| 1520 | http := &httpmock.Registry{} |
| 1521 | defer http.Verify(t) |
| 1522 | |
| 1523 | http.Register( |
| 1524 | httpmock.GraphQL(`query IssueRepositoryInfo\b`), |
| 1525 | httpmock.StringResponse(` |
| 1526 | { "data": { "repository": { |
| 1527 | "id": "REPOID", |
| 1528 | "hasIssuesEnabled": true |
| 1529 | } } }`), |
| 1530 | ) |
| 1531 | http.Register( |
| 1532 | httpmock.GraphQL(`mutation IssueCreate\b`), |
| 1533 | httpmock.GraphQLMutation(` |
| 1534 | { "data": { "createIssue": { "issue": { |
| 1535 | "URL": "https://github.com/OWNER/REPO/issues/12" |
| 1536 | } } } }`, |
| 1537 | func(inputs map[string]any) { |
| 1538 | assert.Equal(t, inputs["repositoryId"], "REPOID") |
| 1539 | assert.Equal(t, inputs["title"], "hello") |
| 1540 | assert.Equal(t, inputs["body"], "cash rules everything around me") |
| 1541 | }), |
| 1542 | ) |
| 1543 | |
| 1544 | output, err := runCommand(http, true, `-t hello -b "cash rules everything around me"`, nil) |
| 1545 | if err != nil { |
| 1546 | t.Errorf("error running command `issue create`: %v", err) |
| 1547 | } |
| 1548 | |
| 1549 | assert.Equal(t, "https://github.com/OWNER/REPO/issues/12\n", output.String()) |
| 1550 | } |
| 1551 | |
| 1552 | func TestIssueCreate_recover(t *testing.T) { |
| 1553 | http := &httpmock.Registry{} |
nothing calls this directly
no test coverage detected