File tree Expand file tree Collapse file tree 1 file changed +39
-0
lines changed
Expand file tree Collapse file tree 1 file changed +39
-0
lines changed Original file line number Diff line number Diff line change 1+ package channel
2+
3+ import (
4+ "context"
5+ "testing"
6+
7+ "github.com/priyanshujain/openbotkit/source/scheduler"
8+ )
9+
10+ func TestNewPusherUnsupported (t * testing.T ) {
11+ _ , err := NewPusher ("unknown" , scheduler.ChannelMeta {})
12+ if err == nil {
13+ t .Fatal ("expected error for unsupported channel type" )
14+ }
15+ }
16+
17+ func TestTelegramPusherImplementsInterface (t * testing.T ) {
18+ var _ Pusher = (* TelegramPusher )(nil )
19+ }
20+
21+ func TestSlackPusherImplementsInterface (t * testing.T ) {
22+ var _ Pusher = (* SlackPusher )(nil )
23+ }
24+
25+ type mockPusher struct {
26+ messages []string
27+ }
28+
29+ func (m * mockPusher ) Push (_ context.Context , message string ) error {
30+ m .messages = append (m .messages , message )
31+ return nil
32+ }
33+
34+ func TestMockPusherImplementsInterface (t * testing.T ) {
35+ var p Pusher = & mockPusher {}
36+ if err := p .Push (context .Background (), "test" ); err != nil {
37+ t .Fatal (err )
38+ }
39+ }
You can’t perform that action at this time.
0 commit comments