-
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-956]: Added server testcase for webhook.go #855
base: MM-918
Are you sure you want to change the base?
Conversation
) | ||
|
||
func TestPostPushEvent(t *testing.T) { | ||
mockKvStore, mockAPI, _, _, _ := GetTestSetup(t) |
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.
move inside, as it can cause some issues later
) | ||
|
||
func TestPostPushEvent(t *testing.T) { | ||
mockKvStore, mockAPI, _, _, _ := GetTestSetup(t) |
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.
mockKvStore, mockAPI, _, _, _ := GetTestSetup(t) | |
mockKVStore, mockAPI, _, _, _ := GetTestSetup(t) |
pushEvent: GetMockPushEvent(), | ||
setup: func() { | ||
mockKvStore.EXPECT().Get(SubscriptionsKey, gomock.Any()).DoAndReturn(func(key string, value interface{}) error { | ||
if v, ok := value.(**Subscriptions); ok { |
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.
Why are we using double * here?
name: "Error creating post", | ||
pushEvent: GetMockPushEvent(), | ||
setup: func() { | ||
mockKvStore.EXPECT().Get(SubscriptionsKey, 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 separate functions for the nested one. Its getting very complicated here
setup func() | ||
}{ | ||
{ | ||
name: "no subscription found", |
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.
name: "no subscription found", | |
name: "No subscription found", |
For consistency, check everywhere
Summary
Added server testcase for webhook.go