diff --git a/botsfwmodels/bot_records_maker.go b/botsfwmodels/bot_records_maker.go index cf42808..3aaf50a 100644 --- a/botsfwmodels/bot_records_maker.go +++ b/botsfwmodels/bot_records_maker.go @@ -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 diff --git a/botsfwmodels/bot_records_maker_test.go b/botsfwmodels/bot_records_maker_test.go new file mode 100644 index 0000000..c93b6f9 --- /dev/null +++ b/botsfwmodels/bot_records_maker_test.go @@ -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) + } + }) + } +}