(t *testing.T)
| 287 | } |
| 288 | |
| 289 | func TestProjectsV2IgnorableError(t *testing.T) { |
| 290 | var tests = []struct { |
| 291 | name string |
| 292 | errMsg string |
| 293 | expectOut bool |
| 294 | }{ |
| 295 | { |
| 296 | name: "read scope error", |
| 297 | errMsg: "field requires one of the following scopes: ['read:project']", |
| 298 | expectOut: true, |
| 299 | }, |
| 300 | { |
| 301 | name: "repository projectsV2 field error", |
| 302 | errMsg: "Field 'projectsV2' doesn't exist on type 'Repository'", |
| 303 | expectOut: true, |
| 304 | }, |
| 305 | { |
| 306 | name: "organization projectsV2 field error", |
| 307 | errMsg: "Field 'projectsV2' doesn't exist on type 'Organization'", |
| 308 | expectOut: true, |
| 309 | }, |
| 310 | { |
| 311 | name: "issue projectItems field error", |
| 312 | errMsg: "Field 'projectItems' doesn't exist on type 'Issue'", |
| 313 | expectOut: true, |
| 314 | }, |
| 315 | { |
| 316 | name: "pullRequest projectItems field error", |
| 317 | errMsg: "Field 'projectItems' doesn't exist on type 'PullRequest'", |
| 318 | expectOut: true, |
| 319 | }, |
| 320 | { |
| 321 | name: "resource not accessible by integration", |
| 322 | errMsg: "Resource not accessible by integration", |
| 323 | expectOut: true, |
| 324 | }, |
| 325 | { |
| 326 | name: "resource not accessible by personal access token", |
| 327 | errMsg: "Resource not accessible by personal access token", |
| 328 | expectOut: true, |
| 329 | }, |
| 330 | { |
| 331 | name: "resource not accessible by integration with path context", |
| 332 | errMsg: "GraphQL: Resource not accessible by integration (repository.pullRequest.projectItems.nodes.0)", |
| 333 | expectOut: true, |
| 334 | }, |
| 335 | { |
| 336 | name: "other error", |
| 337 | errMsg: "some other graphql error message", |
| 338 | expectOut: false, |
| 339 | }, |
| 340 | } |
| 341 | for _, tt := range tests { |
| 342 | t.Run(tt.name, func(t *testing.T) { |
| 343 | err := errors.New(tt.errMsg) |
| 344 | out := ProjectsV2IgnorableError(err) |
| 345 | assert.Equal(t, tt.expectOut, out) |
| 346 | }) |
nothing calls this directly
no test coverage detected