-
Notifications
You must be signed in to change notification settings - Fork 154
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[MM-974]: Added testcase fore more functions in webhook.go #857
base: MM-956
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 👍
for _, tc := range tests { | ||
t.Run(tc.name, func(t *testing.T) { | ||
tc.setup() | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add mockAPI.ExpectedCalls = nil
name: "private repo, no permission for author", | ||
event: GetMockPullRequestReviewEvent(actionSubmitted, "approved", MockRepo, true, "authorUser", "reviewerUser"), | ||
setup: func() { | ||
mockKvStore.EXPECT().Get("reviewerUser_githubusername", gomock.Any()).DoAndReturn(func(key string, value interface{}) error { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Create util for return value/func
name: "no subscribed channels for repository", | ||
event: GetMockStarEvent(MockRepo, MockOrg, false, MockSender), | ||
setup: func() { | ||
mockKvStore.EXPECT().Get("subscriptions", gomock.Any()).Return(nil).Times(1) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Replace gomock.an() whereever possible
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we can use anythingOfType instead
setup: func() { | ||
mockKvStore.EXPECT().Get("subscriptions", gomock.Any()).DoAndReturn(func(key string, value interface{}) error { | ||
if v, ok := value.(**Subscriptions); ok { | ||
*v = &Subscriptions{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Util for this
Summary
Added testcase for more functions in webhook.go
Original PR
#855