Skip to content

Commit 7082815

Browse files
fix missing test cases and bad rename
1 parent 6b25869 commit 7082815

File tree

2 files changed

+40
-16
lines changed

2 files changed

+40
-16
lines changed

e2e/e2e_test.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1537,7 +1537,7 @@ func TestPullRequestReviewDeletion(t *testing.T) {
15371537
require.Len(t, noReviews, 0, "expected to find no reviews")
15381538
}
15391539

1540-
func ListNotifications(t *testing.T) {
1540+
func TestListNotifications(t *testing.T) {
15411541
t.Parallel()
15421542
client := setupMCPClient(t)
15431543
ctx := context.Background()
@@ -1560,7 +1560,7 @@ func ListNotifications(t *testing.T) {
15601560
require.NoError(t, err, "expected to unmarshal text content successfully")
15611561
}
15621562

1563-
func ManageNotificationSubscription(t *testing.T) {
1563+
func TestManageNotificationSubscription(t *testing.T) {
15641564
skipIfGlobalMutationNotOptedIn(t)
15651565
t.Parallel()
15661566
client := setupMCPClient(t)
@@ -1652,7 +1652,7 @@ func ManageNotificationSubscription(t *testing.T) {
16521652
require.Equal(t, 204, resp2.StatusCode)
16531653
}
16541654

1655-
func ManageRepositoryNotificationSubscription(t *testing.T) {
1655+
func TestManageRepositoryNotificationSubscription(t *testing.T) {
16561656
skipIfGlobalMutationNotOptedIn(t)
16571657
t.Parallel()
16581658
client := setupMCPClient(t)
@@ -1730,7 +1730,7 @@ func ManageRepositoryNotificationSubscription(t *testing.T) {
17301730
require.Equal(t, 204, resp2.StatusCode)
17311731
}
17321732

1733-
func DismissNotification(t *testing.T) {
1733+
func TestDismissNotification(t *testing.T) {
17341734
skipIfGlobalMutationNotOptedIn(t)
17351735
t.Parallel()
17361736
client := setupMCPClient(t)
@@ -1771,7 +1771,7 @@ func DismissNotification(t *testing.T) {
17711771
require.Contains(t, textContent.Text, "read")
17721772
}
17731773

1774-
func MarkAllNotificationsRead(t *testing.T) {
1774+
func TestMarkAllNotificationsRead(t *testing.T) {
17751775
skipIfGlobalMutationNotOptedIn(t)
17761776
t.Parallel()
17771777
client := setupMCPClient(t)
@@ -1798,7 +1798,7 @@ func nowMinusOneHourRFC3339() string {
17981798
return time.Now().UTC().Add(-1 * time.Hour).Format(time.RFC3339)
17991799
}
18001800

1801-
func GetNotificationDetails(t *testing.T) {
1801+
func TestGetNotificationDetails(t *testing.T) {
18021802
t.Parallel()
18031803
client := setupMCPClient(t)
18041804
ctx := context.Background()

pkg/github/notifications_test.go

Lines changed: 34 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -291,16 +291,18 @@ func Test_ManageRepositoryNotificationSubscription(t *testing.T) {
291291
assert.ElementsMatch(t, tool.InputSchema.Required, []string{"owner", "repo", "action"})
292292

293293
mockSub := &github.Subscription{Ignored: github.Ptr(true)}
294+
mockWatchSub := &github.Subscription{Ignored: github.Ptr(false), Subscribed: github.Ptr(true)}
294295

295296
tests := []struct {
296-
name string
297-
mockedClient *http.Client
298-
requestArgs map[string]interface{}
299-
expectError bool
300-
expectIgnored *bool
301-
expectDeleted bool
302-
expectInvalid bool
303-
expectedErrMsg string
297+
name string
298+
mockedClient *http.Client
299+
requestArgs map[string]interface{}
300+
expectError bool
301+
expectIgnored *bool
302+
expectSubscribed *bool
303+
expectDeleted bool
304+
expectInvalid bool
305+
expectedErrMsg string
304306
}{
305307
{
306308
name: "ignore subscription",
@@ -318,6 +320,23 @@ func Test_ManageRepositoryNotificationSubscription(t *testing.T) {
318320
expectError: false,
319321
expectIgnored: github.Ptr(true),
320322
},
323+
{
324+
name: "watch subscription",
325+
mockedClient: mock.NewMockedHTTPClient(
326+
mock.WithRequestMatch(
327+
mock.PutReposSubscriptionByOwnerByRepo,
328+
mockWatchSub,
329+
),
330+
),
331+
requestArgs: map[string]interface{}{
332+
"owner": "owner",
333+
"repo": "repo",
334+
"action": "watch",
335+
},
336+
expectError: false,
337+
expectIgnored: github.Ptr(false),
338+
expectSubscribed: github.Ptr(true),
339+
},
321340
{
322341
name: "delete subscription",
323342
mockedClient: mock.NewMockedHTTPClient(
@@ -400,11 +419,16 @@ func Test_ManageRepositoryNotificationSubscription(t *testing.T) {
400419

401420
require.NoError(t, err)
402421
textContent := getTextResult(t, result)
403-
if tc.expectIgnored != nil {
422+
if tc.expectIgnored != nil || tc.expectSubscribed != nil {
404423
var returned github.Subscription
405424
err = json.Unmarshal([]byte(textContent.Text), &returned)
406425
require.NoError(t, err)
407-
assert.Equal(t, *tc.expectIgnored, *returned.Ignored)
426+
if tc.expectIgnored != nil {
427+
assert.Equal(t, *tc.expectIgnored, *returned.Ignored)
428+
}
429+
if tc.expectSubscribed != nil {
430+
assert.Equal(t, *tc.expectSubscribed, *returned.Subscribed)
431+
}
408432
}
409433
if tc.expectDeleted {
410434
assert.Contains(t, textContent.Text, "deleted")

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy