From 41ff877c5d7b8708e216fe66ee0a71a6d3b6909c Mon Sep 17 00:00:00 2001 From: Fedorov Vladimir Date: Mon, 14 Aug 2023 00:43:22 +0700 Subject: [PATCH] fix tests --- internal/services/bot/bot_all/bot_test.go | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/internal/services/bot/bot_all/bot_test.go b/internal/services/bot/bot_all/bot_test.go index 8876e1b..511f650 100644 --- a/internal/services/bot/bot_all/bot_test.go +++ b/internal/services/bot/bot_all/bot_test.go @@ -30,7 +30,7 @@ func Test_botAll_Process(t *testing.T) { }, storage: func(ctrl *gomock.Controller) storage.IStorage { m := storage_mocks.NewMockIStorage(ctrl) - m.EXPECT().UpsertUser(gomock.Any(), storage.User{ChatID: "123", UserID: "username"}).Times(1) + m.EXPECT().UpsertUser(gomock.Any(), &storage.User{ChatID: "123", UserID: "username"}).Times(1) m.EXPECT().GetAllUsersByChatID(gomock.Any(), gomock.Any()).Times(0) return m }, @@ -50,10 +50,10 @@ func Test_botAll_Process(t *testing.T) { }, storage: func(ctrl *gomock.Controller) storage.IStorage { m := storage_mocks.NewMockIStorage(ctrl) - m.EXPECT().UpsertUser(gomock.Any(), storage.User{ChatID: "123", UserID: "username"}).Times(1) + m.EXPECT().UpsertUser(gomock.Any(), &storage.User{ChatID: "123", UserID: "username"}).Times(1) m.EXPECT(). GetAllUsersByChatID(gomock.Any(), gomock.Any()). - Return([]storage.User{{UserID: "username"}}, nil). + Return([]*storage.User{{UserID: "username"}}, nil). Times(1) return m }, @@ -73,7 +73,7 @@ func Test_botAll_Process(t *testing.T) { gomock.Any(), &messenger.Message{ ChatID: "123", - Text: "username2", + Text: "@username2", }, ). Times(1) @@ -81,10 +81,10 @@ func Test_botAll_Process(t *testing.T) { }, storage: func(ctrl *gomock.Controller) storage.IStorage { m := storage_mocks.NewMockIStorage(ctrl) - m.EXPECT().UpsertUser(gomock.Any(), storage.User{ChatID: "123", UserID: "username"}).Times(1) + m.EXPECT().UpsertUser(gomock.Any(), &storage.User{ChatID: "123", UserID: "username"}).Times(1) m.EXPECT(). GetAllUsersByChatID(gomock.Any(), gomock.Any()). - Return([]storage.User{ + Return([]*storage.User{ {UserID: "username"}, {UserID: "username2"}, }, nil). @@ -107,7 +107,7 @@ func Test_botAll_Process(t *testing.T) { gomock.Any(), &messenger.Message{ ChatID: "123", - Text: "username2 username3", + Text: "@username2 @username3", }, ). Times(1) @@ -115,10 +115,10 @@ func Test_botAll_Process(t *testing.T) { }, storage: func(ctrl *gomock.Controller) storage.IStorage { m := storage_mocks.NewMockIStorage(ctrl) - m.EXPECT().UpsertUser(gomock.Any(), storage.User{ChatID: "123", UserID: "username"}).Times(1) + m.EXPECT().UpsertUser(gomock.Any(), &storage.User{ChatID: "123", UserID: "username"}).Times(1) m.EXPECT(). GetAllUsersByChatID(gomock.Any(), gomock.Any()). - Return([]storage.User{ + Return([]*storage.User{ {UserID: "username"}, {UserID: "username2"}, {UserID: "username3"},