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-979]: Added more testcase for webhook.go #858

Open
wants to merge 1 commit into
base: MM-974
Choose a base branch
from

Conversation

Kshitij-Katiyar
Copy link
Contributor

Summary

Added more testcase for webhook.go

Original PR

#855

@Kshitij-Katiyar Kshitij-Katiyar added the 2: Dev Review Requires review by a core committer label Dec 2, 2024
@Kshitij-Katiyar Kshitij-Katiyar self-assigned this Dec 2, 2024
Copy link
Member

@wiggin77 wiggin77 left a comment

Choose a reason for hiding this comment

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

LGTM 👍

WebhookSecret: MockWebhookSecret,
EnableWebhookEventLogging: true,
})
mockAPI.On("LogDebug", "Webhook Event Log", "event", mock.Anything).Times(1)
Copy link
Contributor

Choose a reason for hiding this comment

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

Replace mock.Anything() with anythingOfType

setup: func() {
mockKvStore.EXPECT().Get("subscriptions", gomock.Any()).DoAndReturn(func(key string, value interface{}) error {
if v, ok := value.(**Subscriptions); ok {
*v = &Subscriptions{
Copy link
Contributor

Choose a reason for hiding this comment

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

Util for this

name: "PR description mentions a user, post created",
event: GetMockPRDescriptionEvent(MockRepo, MockOrg, MockSender, MockSender, actionOpened, MockProfileUsername),
setup: func() {
mockKvStore.EXPECT().Get("username_githubusername", 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.

Util for return func

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