|
| 1 | +package botsfwmodels |
| 2 | + |
| 3 | +import ( |
| 4 | + "testing" |
| 5 | +) |
| 6 | + |
| 7 | +func TestNewBotRecordsMaker(t *testing.T) { |
| 8 | + type args struct { |
| 9 | + platform string |
| 10 | + makeAppUserDto func(botID string) (appUser AppUserData, err error) |
| 11 | + makeBotUserDto func(botID string) (botUser BotUserData, err error) |
| 12 | + makeBotChatDto func(botID string) (botChat BotChatData, err error) |
| 13 | + } |
| 14 | + |
| 15 | + makeAppUserDto := func(botID string) (appUser AppUserData, err error) { |
| 16 | + return nil, nil |
| 17 | + } |
| 18 | + |
| 19 | + makeBotUserDto := func(botID string) (botUser BotUserData, err error) { |
| 20 | + return nil, nil |
| 21 | + } |
| 22 | + |
| 23 | + makeBotChatDto := func(botID string) (botChat BotChatData, err error) { |
| 24 | + return nil, nil |
| 25 | + } |
| 26 | + |
| 27 | + tests := []struct { |
| 28 | + name string |
| 29 | + args args |
| 30 | + want BotRecordsMaker |
| 31 | + }{ |
| 32 | + { |
| 33 | + name: "TestNewBotRecordsMaker", |
| 34 | + args: args{ |
| 35 | + platform: "test", |
| 36 | + makeAppUserDto: makeAppUserDto, |
| 37 | + makeBotUserDto: makeBotUserDto, |
| 38 | + makeBotChatDto: makeBotChatDto, |
| 39 | + }, |
| 40 | + want: botRecordsMaker{ |
| 41 | + platform: "test", |
| 42 | + makeAppUserDto: makeAppUserDto, |
| 43 | + makeBotUserDto: makeBotUserDto, |
| 44 | + makeBotChatDto: makeBotChatDto, |
| 45 | + }, |
| 46 | + }, |
| 47 | + } |
| 48 | + for _, tt := range tests { |
| 49 | + t.Run(tt.name, func(t *testing.T) { |
| 50 | + got := NewBotRecordsMaker(tt.args.platform, tt.args.makeAppUserDto, tt.args.makeBotUserDto, tt.args.makeBotChatDto) |
| 51 | + if _, err := got.MakeAppUserDto("test"); err != nil { |
| 52 | + t.Error(err) |
| 53 | + } |
| 54 | + if _, err := got.MakeBotUserDto("test"); err != nil { |
| 55 | + t.Error(err) |
| 56 | + } |
| 57 | + if _, err := got.MakeBotChatDto("test"); err != nil { |
| 58 | + t.Error(err) |
| 59 | + } |
| 60 | + }) |
| 61 | + } |
| 62 | +} |
0 commit comments