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

feat(service): Adds Mattermost service #516

Merged
merged 12 commits into from
Jun 21, 2023
26 changes: 26 additions & 0 deletions service/mattermost/mattermost_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ package mattermost
import (
"context"
"errors"
"log"
"net/http"
"testing"

"github.com/stretchr/testify/require"
Expand Down Expand Up @@ -97,3 +99,27 @@ func TestService_Send(t *testing.T) {
assert.NotNil(err)
mockClient.AssertExpectations(t)
}

EthanEFung marked this conversation as resolved.
Show resolved Hide resolved
func TestService_PreSend(t *testing.T) {
t.Parallel()
service := New(url)
service.PreSend(func(req *http.Request) error {
log.Println("sending notification")
return nil
})
service.PreSend(func(req *http.Request) error {
return errors.New("internal_error")
})
}

func TestService_PostSend(t *testing.T) {
t.Parallel()
service := New(url)
service.PostSend(func(req *http.Request, resp *http.Response) error {
log.Println("sent notification")
return nil
})
service.PostSend(func(req *http.Request, resp *http.Response) error {
return errors.New("internal_error")
})
}