Skip to content
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

Open
wants to merge 4 commits into
base: MM-918
Choose a base branch
from

Conversation

Kshitij-Katiyar
Copy link
Contributor

Summary

Added server testcase for webhook.go

@Kshitij-Katiyar Kshitij-Katiyar added the 2: Dev Review Requires review by a core committer label Nov 25, 2024
@Kshitij-Katiyar Kshitij-Katiyar self-assigned this Nov 25, 2024
@Kshitij-Katiyar Kshitij-Katiyar changed the base branch from master to MM-918 November 25, 2024 08:02
)

func TestPostPushEvent(t *testing.T) {
mockKvStore, mockAPI, _, _, _ := GetTestSetup(t)
Copy link
Contributor

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)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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 {
Copy link
Contributor

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 {
Copy link
Contributor

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",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
name: "no subscription found",
name: "No subscription found",

For consistency, check everywhere

@raghavaggarwal2308 raghavaggarwal2308 added this to the v2.4.0 milestone Dec 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2: Dev Review Requires review by a core committer
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants