(t *testing.T)
| 1534 | } |
| 1535 | |
| 1536 | func TestIssueCreate(t *testing.T) { |
| 1537 | http := &httpmock.Registry{} |
| 1538 | defer http.Verify(t) |
| 1539 | |
| 1540 | http.Register( |
| 1541 | httpmock.GraphQL(`query IssueRepositoryInfo\b`), |
| 1542 | httpmock.StringResponse(` |
| 1543 | { "data": { "repository": { |
| 1544 | "id": "REPOID", |
| 1545 | "hasIssuesEnabled": true |
| 1546 | } } }`), |
| 1547 | ) |
| 1548 | http.Register( |
| 1549 | httpmock.GraphQL(`mutation IssueCreate\b`), |
| 1550 | httpmock.GraphQLMutation(` |
| 1551 | { "data": { "createIssue": { "issue": { |
| 1552 | "URL": "https://github.com/OWNER/REPO/issues/12" |
| 1553 | } } } }`, |
| 1554 | func(inputs map[string]any) { |
| 1555 | assert.Equal(t, inputs["repositoryId"], "REPOID") |
| 1556 | assert.Equal(t, inputs["title"], "hello") |
| 1557 | assert.Equal(t, inputs["body"], "cash rules everything around me") |
| 1558 | }), |
| 1559 | ) |
| 1560 | |
| 1561 | output, err := runCommand(http, true, `-t hello -b "cash rules everything around me"`, nil) |
| 1562 | if err != nil { |
| 1563 | t.Errorf("error running command `issue create`: %v", err) |
| 1564 | } |
| 1565 | |
| 1566 | assert.Equal(t, "https://github.com/OWNER/REPO/issues/12\n", output.String()) |
| 1567 | } |
| 1568 | |
| 1569 | func TestIssueCreate_recover(t *testing.T) { |
| 1570 | http := &httpmock.Registry{} |
nothing calls this directly
no test coverage detected