Skip to content

Commit 12f1278

Browse files
committed
update Test_GetDiscussion
1 parent e15b340 commit 12f1278

File tree

1 file changed

+6
-13
lines changed

1 file changed

+6
-13
lines changed

pkg/github/discussions_test.go

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,6 @@ func Test_GetDiscussion(t *testing.T) {
200200
Discussion struct {
201201
Number githubv4.Int
202202
Body githubv4.String
203-
State githubv4.String
204203
CreatedAt githubv4.DateTime
205204
URL githubv4.String `graphql:"url"`
206205
Category struct {
@@ -218,7 +217,7 @@ func Test_GetDiscussion(t *testing.T) {
218217
name string
219218
response githubv4mock.GQLResponse
220219
expectError bool
221-
expected *github.Issue
220+
expected *github.Discussion
222221
errContains string
223222
}{
224223
{
@@ -227,23 +226,19 @@ func Test_GetDiscussion(t *testing.T) {
227226
"repository": map[string]any{"discussion": map[string]any{
228227
"number": 1,
229228
"body": "This is a test discussion",
230-
"state": "open",
231229
"url": "https://github.com/owner/repo/discussions/1",
232230
"createdAt": "2025-04-25T12:00:00Z",
233231
"category": map[string]any{"name": "General"},
234232
}},
235233
}),
236234
expectError: false,
237-
expected: &github.Issue{
235+
expected: &github.Discussion{
238236
HTMLURL: github.Ptr("https://github.com/owner/repo/discussions/1"),
239237
Number: github.Ptr(1),
240238
Body: github.Ptr("This is a test discussion"),
241-
State: github.Ptr("open"),
242239
CreatedAt: &github.Timestamp{Time: time.Date(2025, 4, 25, 12, 0, 0, 0, time.UTC)},
243-
Labels: []*github.Label{
244-
{
245-
Name: github.Ptr("category:General"),
246-
},
240+
DiscussionCategory: &github.DiscussionCategory{
241+
Name: github.Ptr("General"),
247242
},
248243
},
249244
},
@@ -272,15 +267,13 @@ func Test_GetDiscussion(t *testing.T) {
272267
}
273268

274269
require.NoError(t, err)
275-
var out github.Issue
270+
var out github.Discussion
276271
require.NoError(t, json.Unmarshal([]byte(text), &out))
277272
assert.Equal(t, *tc.expected.HTMLURL, *out.HTMLURL)
278273
assert.Equal(t, *tc.expected.Number, *out.Number)
279274
assert.Equal(t, *tc.expected.Body, *out.Body)
280-
assert.Equal(t, *tc.expected.State, *out.State)
281275
// Check category label
282-
require.Len(t, out.Labels, 1)
283-
assert.Equal(t, *tc.expected.Labels[0].Name, *out.Labels[0].Name)
276+
assert.Equal(t, *tc.expected.DiscussionCategory.Name, *out.DiscussionCategory.Name)
284277
})
285278
}
286279
}

0 commit comments

Comments
 (0)