MCPcopy Index your code
hub / github.com/github/github-mcp-server / Test_ProjectsList_ListProjectItems

Function Test_ProjectsList_ListProjectItems

pkg/github/projects_test.go:330–367  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

328}
329
330func Test_ProjectsList_ListProjectItems(t *testing.T) {
331 toolDef := ProjectsList(translations.NullTranslationHelper)
332
333 items := []map[string]any{verbosePullRequestProjectItemFixture()}
334
335 t.Run("success organization", func(t *testing.T) {
336 mockedClient := MockHTTPClientWithHandlers(map[string]http.HandlerFunc{
337 GetOrgsProjectsV2ItemsByProject: mockResponse(t, http.StatusOK, items),
338 })
339
340 client := mustNewGHClient(t, mockedClient)
341 deps := BaseDeps{
342 Client: client,
343 }
344 handler := toolDef.Handler(deps)
345 request := createMCPRequest(map[string]any{
346 "method": "list_project_items",
347 "owner": "octo-org",
348 "owner_type": "org",
349 "project_number": float64(1),
350 })
351 result, err := handler(ContextWithDeps(context.Background(), deps), &request)
352
353 require.NoError(t, err)
354 require.False(t, result.IsError)
355
356 textContent := getTextResult(t, result)
357 var response map[string]any
358 err = json.Unmarshal([]byte(textContent.Text), &response)
359 require.NoError(t, err)
360 itemsList, ok := response["items"].([]any)
361 require.True(t, ok)
362 assert.Equal(t, 1, len(itemsList))
363 item, ok := itemsList[0].(map[string]any)
364 require.True(t, ok)
365 assertMinimalPullRequestProjectItem(t, textContent.Text, item)
366 })
367}
368
369func Test_detectOwnerType(t *testing.T) {
370 t.Run("uses organization account type", func(t *testing.T) {

Callers

nothing calls this directly

Calls 10

ProjectsListFunction · 0.85
mockResponseFunction · 0.85
mustNewGHClientFunction · 0.85
createMCPRequestFunction · 0.85
ContextWithDepsFunction · 0.85
getTextResultFunction · 0.85
HandlerMethod · 0.45

Tested by

no test coverage detected