Skip to content

Commit 1117477

Browse files
committed
Add test to ensure null values are skipped
1 parent 4a106c1 commit 1117477

1 file changed

Lines changed: 22 additions & 0 deletions

File tree

api/queries_projects_v2_test.go

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,17 @@ func TestProjectsV2ItemsForIssue(t *testing.T) {
129129
},
130130
expectError: true,
131131
},
132+
{
133+
name: "skips null project items for issue",
134+
httpStubs: func(reg *httpmock.Registry) {
135+
reg.Register(
136+
httpmock.GraphQL(`query IssueProjectItems\b`),
137+
httpmock.GraphQLQuery(`{"data":{"repository":{"issue":{"projectItems":{"totalCount":1,"nodes":[null]}}}}}`,
138+
func(query string, inputs map[string]interface{}) {}),
139+
)
140+
},
141+
expectItems: ProjectItems{},
142+
},
132143
}
133144

134145
for _, tt := range tests {
@@ -186,6 +197,17 @@ func TestProjectsV2ItemsForPullRequest(t *testing.T) {
186197
},
187198
expectError: true,
188199
},
200+
{
201+
name: "skips null project items for pull request",
202+
httpStubs: func(reg *httpmock.Registry) {
203+
reg.Register(
204+
httpmock.GraphQL(`query PullRequestProjectItems\b`),
205+
httpmock.GraphQLQuery(`{"data":{"repository":{"pullRequest":{"projectItems":{"totalCount":1,"nodes":[null]}}}}}`,
206+
func(query string, inputs map[string]interface{}) {}),
207+
)
208+
},
209+
expectItems: ProjectItems{},
210+
},
189211
{
190212
name: "retrieves project items that have status columns",
191213
httpStubs: func(reg *httpmock.Registry) {

0 commit comments

Comments
 (0)