Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit7082815

Browse files
fix missing test cases and bad rename
1 parent6b25869 commit7082815

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-
funcListNotifications(t*testing.T) {
1540+
funcTestListNotifications(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-
funcManageNotificationSubscription(t*testing.T) {
1563+
funcTestManageNotificationSubscription(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-
funcManageRepositoryNotificationSubscription(t*testing.T) {
1655+
funcTestManageRepositoryNotificationSubscription(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-
funcDismissNotification(t*testing.T) {
1733+
funcTestDismissNotification(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-
funcMarkAllNotificationsRead(t*testing.T) {
1774+
funcTestMarkAllNotificationsRead(t*testing.T) {
17751775
skipIfGlobalMutationNotOptedIn(t)
17761776
t.Parallel()
17771777
client:=setupMCPClient(t)
@@ -1798,7 +1798,7 @@ func nowMinusOneHourRFC3339() string {
17981798
returntime.Now().UTC().Add(-1*time.Hour).Format(time.RFC3339)
17991799
}
18001800

1801-
funcGetNotificationDetails(t*testing.T) {
1801+
funcTestGetNotificationDetails(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-
namestring
297-
mockedClient*http.Client
298-
requestArgsmap[string]interface{}
299-
expectErrorbool
300-
expectIgnored*bool
301-
expectDeletedbool
302-
expectInvalidbool
303-
expectedErrMsgstring
297+
namestring
298+
mockedClient*http.Client
299+
requestArgsmap[string]interface{}
300+
expectErrorbool
301+
expectIgnored*bool
302+
expectSubscribed*bool
303+
expectDeletedbool
304+
expectInvalidbool
305+
expectedErrMsgstring
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-
iftc.expectIgnored!=nil {
422+
iftc.expectIgnored!=nil||tc.expectSubscribed!=nil{
404423
varreturned github.Subscription
405424
err=json.Unmarshal([]byte(textContent.Text),&returned)
406425
require.NoError(t,err)
407-
assert.Equal(t,*tc.expectIgnored,*returned.Ignored)
426+
iftc.expectIgnored!=nil {
427+
assert.Equal(t,*tc.expectIgnored,*returned.Ignored)
428+
}
429+
iftc.expectSubscribed!=nil {
430+
assert.Equal(t,*tc.expectSubscribed,*returned.Subscribed)
431+
}
408432
}
409433
iftc.expectDeleted {
410434
assert.Contains(t,textContent.Text,"deleted")

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp