(t *testing.T)
| 1641 | } |
| 1642 | |
| 1643 | func Test_ListIssues(t *testing.T) { |
| 1644 | // Verify tool definition |
| 1645 | serverTool := ListIssues(translations.NullTranslationHelper) |
| 1646 | tool := serverTool.Tool |
| 1647 | require.NoError(t, toolsnaps.Test(tool.Name, tool)) |
| 1648 | require.Empty(t, serverTool.FeatureFlagEnable) |
| 1649 | |
| 1650 | assert.Equal(t, "list_issues", tool.Name) |
| 1651 | assert.NotEmpty(t, tool.Description) |
| 1652 | assert.Contains(t, tool.InputSchema.(*jsonschema.Schema).Properties, "owner") |
| 1653 | assert.Contains(t, tool.InputSchema.(*jsonschema.Schema).Properties, "repo") |
| 1654 | assert.Contains(t, tool.InputSchema.(*jsonschema.Schema).Properties, "state") |
| 1655 | assert.Contains(t, tool.InputSchema.(*jsonschema.Schema).Properties, "labels") |
| 1656 | assert.Contains(t, tool.InputSchema.(*jsonschema.Schema).Properties, "orderBy") |
| 1657 | assert.Contains(t, tool.InputSchema.(*jsonschema.Schema).Properties, "direction") |
| 1658 | assert.Contains(t, tool.InputSchema.(*jsonschema.Schema).Properties, "since") |
| 1659 | assert.Contains(t, tool.InputSchema.(*jsonschema.Schema).Properties, "after") |
| 1660 | assert.Contains(t, tool.InputSchema.(*jsonschema.Schema).Properties, "perPage") |
| 1661 | assert.ElementsMatch(t, tool.InputSchema.(*jsonschema.Schema).Required, []string{"owner", "repo"}) |
| 1662 | |
| 1663 | // Mock issues data |
| 1664 | mockIssuesAll := []map[string]any{ |
| 1665 | { |
| 1666 | "number": 123, |
| 1667 | "title": "First Issue", |
| 1668 | "body": "This is the first test issue", |
| 1669 | "state": "OPEN", |
| 1670 | "databaseId": 1001, |
| 1671 | "createdAt": "2023-01-01T00:00:00Z", |
| 1672 | "updatedAt": "2023-01-01T00:00:00Z", |
| 1673 | "author": map[string]any{"login": "user1"}, |
| 1674 | "labels": map[string]any{ |
| 1675 | "nodes": []map[string]any{ |
| 1676 | {"name": "bug", "id": "label1", "description": "Bug label"}, |
| 1677 | }, |
| 1678 | }, |
| 1679 | "comments": map[string]any{ |
| 1680 | "totalCount": 5, |
| 1681 | }, |
| 1682 | "issueFieldValues": map[string]any{ |
| 1683 | "nodes": []map[string]any{ |
| 1684 | { |
| 1685 | "__typename": "IssueFieldSingleSelectValue", |
| 1686 | "field": map[string]any{"name": "priority"}, |
| 1687 | "value": "P1", |
| 1688 | }, |
| 1689 | }, |
| 1690 | }, |
| 1691 | }, |
| 1692 | { |
| 1693 | "number": 456, |
| 1694 | "title": "Second Issue", |
| 1695 | "body": "This is the second test issue", |
| 1696 | "state": "OPEN", |
| 1697 | "databaseId": 1002, |
| 1698 | "createdAt": "2023-02-01T00:00:00Z", |
| 1699 | "updatedAt": "2023-02-01T00:00:00Z", |
| 1700 | "author": map[string]any{"login": "user2"}, |
nothing calls this directly
no test coverage detected