Skip to content

Commit 0fccfb0

Browse files
authored
Extend list_issues tests to cover Date/Number/Text field value variants
1 parent b57cd61 commit 0fccfb0

1 file changed

Lines changed: 29 additions & 5 deletions

File tree

pkg/github/issues_test.go

Lines changed: 29 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1091,7 +1091,23 @@ func Test_ListIssues(t *testing.T) {
10911091
"totalCount": 3,
10921092
},
10931093
"issueFieldValues": map[string]any{
1094-
"nodes": []map[string]any{},
1094+
"nodes": []map[string]any{
1095+
{
1096+
"__typename": "IssueFieldDateValue",
1097+
"field": map[string]any{"name": "due"},
1098+
"value": "2026-06-01",
1099+
},
1100+
{
1101+
"__typename": "IssueFieldNumberValue",
1102+
"field": map[string]any{"name": "estimate"},
1103+
"valueNumber": 2.5,
1104+
},
1105+
{
1106+
"__typename": "IssueFieldTextValue",
1107+
"field": map[string]any{"name": "notes"},
1108+
"value": "needs triage",
1109+
},
1110+
},
10951111
},
10961112
},
10971113
}
@@ -1364,11 +1380,19 @@ func Test_ListIssues(t *testing.T) {
13641380
assert.NotEmpty(t, label, "Label should be a non-empty string")
13651381
}
13661382

1367-
// Field values should be flattened to {field, value} pairs. Issue #123 in the mock
1368-
// data has a SingleSelectValue for "priority"; all others have an empty list.
1369-
if issue.Number == 123 {
1383+
// Field values should be flattened to {field, value} pairs. Issue #123 has a
1384+
// SingleSelectValue; issue #456 exercises the Date/Number/Text branches
1385+
// (including float formatting); #789 has no field values.
1386+
switch issue.Number {
1387+
case 123:
13701388
assert.Equal(t, []MinimalIssueFieldValue{{Field: "priority", Value: "P1"}}, issue.FieldValues)
1371-
} else {
1389+
case 456:
1390+
assert.Equal(t, []MinimalIssueFieldValue{
1391+
{Field: "due", Value: "2026-06-01"},
1392+
{Field: "estimate", Value: "2.5"},
1393+
{Field: "notes", Value: "needs triage"},
1394+
}, issue.FieldValues)
1395+
default:
13721396
assert.Empty(t, issue.FieldValues)
13731397
}
13741398
}

0 commit comments

Comments
 (0)