Skip to content

Commit

Permalink
chore: TestNewBotRecordsMaker
Browse files Browse the repository at this point in the history
  • Loading branch information
trakhimenok committed Aug 20, 2024
1 parent 8430cd2 commit bf32f78
Show file tree
Hide file tree
Showing 2 changed files with 63 additions and 1 deletion.
2 changes: 1 addition & 1 deletion botsfwmodels/bot_records_maker.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package botsfwmodels

// BotRecordsMaker is an interface for making bot records
// This should be implemented by platform adapters
// (for example by https://github.com/bots-go-framework/bots-fw-telegram)
// (for example, by https://github.com/bots-go-framework/bots-fw-telegram)
type BotRecordsMaker interface {
Platform() string

Expand Down
62 changes: 62 additions & 0 deletions botsfwmodels/bot_records_maker_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
package botsfwmodels

import (
"testing"
)

func TestNewBotRecordsMaker(t *testing.T) {
type args struct {
platform string
makeAppUserDto func(botID string) (appUser AppUserData, err error)
makeBotUserDto func(botID string) (botUser BotUserData, err error)
makeBotChatDto func(botID string) (botChat BotChatData, err error)
}

makeAppUserDto := func(botID string) (appUser AppUserData, err error) {
return nil, nil
}

makeBotUserDto := func(botID string) (botUser BotUserData, err error) {
return nil, nil
}

makeBotChatDto := func(botID string) (botChat BotChatData, err error) {
return nil, nil
}

tests := []struct {
name string
args args
want BotRecordsMaker
}{
{
name: "TestNewBotRecordsMaker",
args: args{
platform: "test",
makeAppUserDto: makeAppUserDto,
makeBotUserDto: makeBotUserDto,
makeBotChatDto: makeBotChatDto,
},
want: botRecordsMaker{
platform: "test",
makeAppUserDto: makeAppUserDto,
makeBotUserDto: makeBotUserDto,
makeBotChatDto: makeBotChatDto,
},
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
got := NewBotRecordsMaker(tt.args.platform, tt.args.makeAppUserDto, tt.args.makeBotUserDto, tt.args.makeBotChatDto)
if _, err := got.MakeAppUserDto("test"); err != nil {
t.Error(err)
}
if _, err := got.MakeBotUserDto("test"); err != nil {
t.Error(err)
}
if _, err := got.MakeBotChatDto("test"); err != nil {
t.Error(err)
}
})
}
}

0 comments on commit bf32f78

Please sign in to comment.