(t *testing.T)
| 15 | ) |
| 16 | |
| 17 | func 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) |
nothing calls this directly
no test coverage detected