(t *testing.T)
| 213 | ) |
| 214 | |
| 215 | func Test_ListDiscussions(t *testing.T) { |
| 216 | toolDef := ListDiscussions(translations.NullTranslationHelper) |
| 217 | tool := toolDef.Tool |
| 218 | require.NoError(t, toolsnaps.Test(tool.Name, tool)) |
| 219 | |
| 220 | assert.Equal(t, "list_discussions", tool.Name) |
| 221 | assert.NotEmpty(t, tool.Description) |
| 222 | schema, ok := tool.InputSchema.(*jsonschema.Schema) |
| 223 | require.True(t, ok, "InputSchema should be *jsonschema.Schema") |
| 224 | assert.Contains(t, schema.Properties, "owner") |
| 225 | assert.Contains(t, schema.Properties, "repo") |
| 226 | assert.Contains(t, schema.Properties, "orderBy") |
| 227 | assert.Contains(t, schema.Properties, "direction") |
| 228 | assert.ElementsMatch(t, schema.Required, []string{"owner"}) |
| 229 | |
| 230 | // Variables matching what GraphQL receives after JSON marshaling/unmarshaling |
| 231 | varsListAll := map[string]any{ |
| 232 | "owner": "owner", |
| 233 | "repo": "repo", |
| 234 | "first": float64(30), |
| 235 | "after": (*string)(nil), |
| 236 | } |
| 237 | |
| 238 | varsRepoNotFound := map[string]any{ |
| 239 | "owner": "owner", |
| 240 | "repo": "nonexistent-repo", |
| 241 | "first": float64(30), |
| 242 | "after": (*string)(nil), |
| 243 | } |
| 244 | |
| 245 | varsDiscussionsFiltered := map[string]any{ |
| 246 | "owner": "owner", |
| 247 | "repo": "repo", |
| 248 | "categoryId": "DIC_kwDOABC123", |
| 249 | "first": float64(30), |
| 250 | "after": (*string)(nil), |
| 251 | } |
| 252 | |
| 253 | varsOrderByCreatedAsc := map[string]any{ |
| 254 | "owner": "owner", |
| 255 | "repo": "repo", |
| 256 | "orderByField": "CREATED_AT", |
| 257 | "orderByDirection": "ASC", |
| 258 | "first": float64(30), |
| 259 | "after": (*string)(nil), |
| 260 | } |
| 261 | |
| 262 | varsOrderByUpdatedDesc := map[string]any{ |
| 263 | "owner": "owner", |
| 264 | "repo": "repo", |
| 265 | "orderByField": "UPDATED_AT", |
| 266 | "orderByDirection": "DESC", |
| 267 | "first": float64(30), |
| 268 | "after": (*string)(nil), |
| 269 | } |
| 270 | |
| 271 | varsCategoryWithOrder := map[string]any{ |
| 272 | "owner": "owner", |
nothing calls this directly
no test coverage detected