(t *testing.T)
| 15 | ) |
| 16 | |
| 17 | func Test_IssueDependencyRead(t *testing.T) { |
| 18 | // Verify tool definition once (flag-gated variant snap) |
| 19 | serverTool := IssueDependencyRead(translations.NullTranslationHelper) |
| 20 | tool := serverTool.Tool |
| 21 | require.NoError(t, toolsnaps.Test(tool.Name+"_ff_"+FeatureFlagIssueDependencies, tool)) |
| 22 | require.Equal(t, FeatureFlagIssueDependencies, serverTool.FeatureFlagEnable) |
| 23 | |
| 24 | assert.Equal(t, "issue_dependency_read", tool.Name) |
| 25 | assert.NotEmpty(t, tool.Description) |
| 26 | assert.True(t, tool.Annotations.ReadOnlyHint) |
| 27 | schema := tool.InputSchema.(*jsonschema.Schema) |
| 28 | assert.Contains(t, schema.Properties, "method") |
| 29 | assert.Contains(t, schema.Properties, "owner") |
| 30 | assert.Contains(t, schema.Properties, "repo") |
| 31 | assert.Contains(t, schema.Properties, "issue_number") |
| 32 | assert.ElementsMatch(t, schema.Required, []string{"method", "owner", "repo", "issue_number"}) |
| 33 | |
| 34 | blockedByQuery := githubv4mock.NewQueryMatcher( |
| 35 | struct { |
| 36 | Repository struct { |
| 37 | Issue struct { |
| 38 | BlockedBy dependencyConnection `graphql:"blockedBy(first: $first, after: $after)"` |
| 39 | } `graphql:"issue(number: $issueNumber)"` |
| 40 | } `graphql:"repository(owner: $owner, name: $repo)"` |
| 41 | }{}, |
| 42 | map[string]any{ |
| 43 | "owner": githubv4.String("owner"), |
| 44 | "repo": githubv4.String("repo"), |
| 45 | "issueNumber": githubv4.Int(123), |
| 46 | "first": githubv4.Int(30), |
| 47 | "after": (*githubv4.String)(nil), |
| 48 | }, |
| 49 | githubv4mock.DataResponse(map[string]any{ |
| 50 | "repository": map[string]any{ |
| 51 | "issue": map[string]any{ |
| 52 | "blockedBy": map[string]any{ |
| 53 | "totalCount": 1, |
| 54 | "pageInfo": map[string]any{ |
| 55 | "hasNextPage": false, |
| 56 | "endCursor": "", |
| 57 | }, |
| 58 | "nodes": []map[string]any{ |
| 59 | { |
| 60 | "number": 7, |
| 61 | "title": "Blocker", |
| 62 | "state": "OPEN", |
| 63 | "url": "https://github.com/owner/repo/issues/7", |
| 64 | "repository": map[string]any{"nameWithOwner": "owner/repo"}, |
| 65 | }, |
| 66 | }, |
| 67 | }, |
| 68 | }, |
| 69 | }, |
| 70 | }), |
| 71 | ) |
| 72 | |
| 73 | blockingQuery := githubv4mock.NewQueryMatcher( |
| 74 | struct { |
nothing calls this directly
no test coverage detected