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

Function Test_ProjectsWrite_AddProjectItem

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

Source from the content-addressed store, hash-verified

841}
842
843func Test_ProjectsWrite_AddProjectItem(t *testing.T) {
844 toolDef := ProjectsWrite(translations.NullTranslationHelper)
845
846 t.Run("success organization with issue", func(t *testing.T) {
847 mockedClient := githubv4mock.NewMockedHTTPClient(
848 // Mock resolveIssueNodeID query
849 githubv4mock.NewQueryMatcher(
850 struct {
851 Repository struct {
852 Issue struct {
853 ID githubv4.ID
854 } `graphql:"issue(number: $issueNumber)"`
855 } `graphql:"repository(owner: $owner, name: $repo)"`
856 }{},
857 map[string]any{
858 "owner": githubv4.String("item-owner"),
859 "repo": githubv4.String("item-repo"),
860 "issueNumber": githubv4.Int(123),
861 },
862 githubv4mock.DataResponse(map[string]any{
863 "repository": map[string]any{
864 "issue": map[string]any{
865 "id": "I_issue123",
866 },
867 },
868 }),
869 ),
870 // Mock project ID query for org
871 githubv4mock.NewQueryMatcher(
872 struct {
873 Organization struct {
874 ProjectV2 struct {
875 ID githubv4.ID
876 } `graphql:"projectV2(number: $projectNumber)"`
877 } `graphql:"organization(login: $owner)"`
878 }{},
879 map[string]any{
880 "owner": githubv4.String("octo-org"),
881 "projectNumber": githubv4.Int(1),
882 },
883 githubv4mock.DataResponse(map[string]any{
884 "organization": map[string]any{
885 "projectV2": map[string]any{
886 "id": "PVT_project1",
887 },
888 },
889 }),
890 ),
891 // Mock addProjectV2ItemById mutation
892 githubv4mock.NewMutationMatcher(
893 struct {
894 AddProjectV2ItemByID struct {
895 Item struct {
896 ID githubv4.ID
897 FullDatabaseID string `graphql:"fullDatabaseId"`
898 }
899 } `graphql:"addProjectV2ItemById(input: $input)"`
900 }{},

Callers

nothing calls this directly

Calls 10

NewMockedHTTPClientFunction · 0.92
NewQueryMatcherFunction · 0.92
DataResponseFunction · 0.92
NewMutationMatcherFunction · 0.92
ProjectsWriteFunction · 0.85
createMCPRequestFunction · 0.85
ContextWithDepsFunction · 0.85
getTextResultFunction · 0.85
StringMethod · 0.45
HandlerMethod · 0.45

Tested by

no test coverage detected