Add test to ensure null values are skipped

This commit is contained in:
Andy Feller 2025-12-22 10:16:21 -05:00
parent 4a106c1acf
commit 1117477da2

View file

@ -129,6 +129,17 @@ func TestProjectsV2ItemsForIssue(t *testing.T) {
},
expectError: true,
},
{
name: "skips null project items for issue",
httpStubs: func(reg *httpmock.Registry) {
reg.Register(
httpmock.GraphQL(`query IssueProjectItems\b`),
httpmock.GraphQLQuery(`{"data":{"repository":{"issue":{"projectItems":{"totalCount":1,"nodes":[null]}}}}}`,
func(query string, inputs map[string]interface{}) {}),
)
},
expectItems: ProjectItems{},
},
}
for _, tt := range tests {
@ -186,6 +197,17 @@ func TestProjectsV2ItemsForPullRequest(t *testing.T) {
},
expectError: true,
},
{
name: "skips null project items for pull request",
httpStubs: func(reg *httpmock.Registry) {
reg.Register(
httpmock.GraphQL(`query PullRequestProjectItems\b`),
httpmock.GraphQLQuery(`{"data":{"repository":{"pullRequest":{"projectItems":{"totalCount":1,"nodes":[null]}}}}}`,
func(query string, inputs map[string]interface{}) {}),
)
},
expectItems: ProjectItems{},
},
{
name: "retrieves project items that have status columns",
httpStubs: func(reg *httpmock.Registry) {