This commit is contained in:
2023-08-13 21:13:17 +07:00
parent bdc89bea14
commit 6ce7cee5bc
5 changed files with 20 additions and 8 deletions
+1 -1
View File
@@ -26,7 +26,7 @@ func NewBotAll(
}
}
func (bot *botAll) Process(ctx context.Context, msg messenger.Message) error {
func (bot *botAll) Process(ctx context.Context, msg *messenger.Message) error {
if err := bot.storage.UpsertUser(ctx, storage.User{ChatID: msg.ChatID, UserID: msg.UserID}); err != nil {
return err
}
+5 -5
View File
@@ -18,7 +18,7 @@ func Test_botAll_Process(t *testing.T) {
name string
messenger func(ctrl *gomock.Controller) messenger.IMessenger
storage func(ctrl *gomock.Controller) storage.IStorage
msg messenger.Message
msg *messenger.Message
wantErr bool
}{
{
@@ -34,7 +34,7 @@ func Test_botAll_Process(t *testing.T) {
m.EXPECT().GetAllUsersByChatID(gomock.Any(), gomock.Any()).Times(0)
return m
},
msg: messenger.Message{
msg: &messenger.Message{
ChatID: "123",
UserID: "username",
Text: "hello",
@@ -57,7 +57,7 @@ func Test_botAll_Process(t *testing.T) {
Times(1)
return m
},
msg: messenger.Message{
msg: &messenger.Message{
ChatID: "123",
UserID: "username",
Text: "hello @all",
@@ -91,7 +91,7 @@ func Test_botAll_Process(t *testing.T) {
Times(1)
return m
},
msg: messenger.Message{
msg: &messenger.Message{
ChatID: "123",
UserID: "username",
Text: "hello @all",
@@ -126,7 +126,7 @@ func Test_botAll_Process(t *testing.T) {
Times(1)
return m
},
msg: messenger.Message{
msg: &messenger.Message{
ChatID: "123",
UserID: "username",
Text: "hello @all",
+1 -1
View File
@@ -7,5 +7,5 @@ import (
)
type IBot interface {
Process(ctx context.Context, msg messenger.Message) error
Process(ctx context.Context, msg *messenger.Message) error
}