MCPcopy
hub / github.com/github/github-mcp-server / Test_ProjectsWrite_CreateProject

Function Test_ProjectsWrite_CreateProject

pkg/github/projects_v2_test.go:17–141  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

15)
16
17func Test_ProjectsWrite_CreateProject(t *testing.T) {
18 t.Parallel()
19
20 toolDef := ProjectsWrite(translations.NullTranslationHelper)
21
22 t.Run("success user project", func(t *testing.T) {
23 t.Parallel()
24
25 mockedClient := githubv4mock.NewMockedHTTPClient(
26 githubv4mock.NewQueryMatcher(
27 struct {
28 User struct {
29 ID string
30 } `graphql:"user(login: $login)"`
31 }{},
32 map[string]any{
33 "login": githubv4.String("octocat"),
34 },
35 githubv4mock.DataResponse(map[string]any{
36 "user": map[string]any{
37 "id": "U_octocat",
38 },
39 }),
40 ),
41 githubv4mock.NewMutationMatcher(
42 struct {
43 CreateProjectV2 struct {
44 ProjectV2 struct {
45 ID string
46 Number int
47 Title string
48 URL string
49 }
50 } `graphql:"createProjectV2(input: $input)"`
51 }{},
52 githubv4.CreateProjectV2Input{
53 OwnerID: githubv4.ID("U_octocat"),
54 Title: githubv4.String("New Project"),
55 },
56 nil,
57 githubv4mock.DataResponse(map[string]any{
58 "createProjectV2": map[string]any{
59 "projectV2": map[string]any{
60 "id": "PVT_project123",
61 "number": 1,
62 "title": "New Project",
63 "url": "https://github.com/users/octocat/projects/1",
64 },
65 },
66 }),
67 ),
68 )
69
70 deps := BaseDeps{
71 GQLClient: githubv4.NewClient(mockedClient),
72 Obsv: stubExporters(),
73 }
74 handler := toolDef.Handler(deps)

Callers

nothing calls this directly

Calls 11

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

Tested by

no test coverage detected