fix tests
continuous-integration/drone/push Build is passing Details

This commit is contained in:
Владимир Фёдоров 2023-08-14 00:43:22 +07:00
parent 559f494848
commit 41ff877c5d
1 changed files with 9 additions and 9 deletions

View File

@ -30,7 +30,7 @@ func Test_botAll_Process(t *testing.T) {
}, },
storage: func(ctrl *gomock.Controller) storage.IStorage { storage: func(ctrl *gomock.Controller) storage.IStorage {
m := storage_mocks.NewMockIStorage(ctrl) 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) m.EXPECT().GetAllUsersByChatID(gomock.Any(), gomock.Any()).Times(0)
return m return m
}, },
@ -50,10 +50,10 @@ func Test_botAll_Process(t *testing.T) {
}, },
storage: func(ctrl *gomock.Controller) storage.IStorage { storage: func(ctrl *gomock.Controller) storage.IStorage {
m := storage_mocks.NewMockIStorage(ctrl) 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(). m.EXPECT().
GetAllUsersByChatID(gomock.Any(), gomock.Any()). GetAllUsersByChatID(gomock.Any(), gomock.Any()).
Return([]storage.User{{UserID: "username"}}, nil). Return([]*storage.User{{UserID: "username"}}, nil).
Times(1) Times(1)
return m return m
}, },
@ -73,7 +73,7 @@ func Test_botAll_Process(t *testing.T) {
gomock.Any(), gomock.Any(),
&messenger.Message{ &messenger.Message{
ChatID: "123", ChatID: "123",
Text: "username2", Text: "@username2",
}, },
). ).
Times(1) Times(1)
@ -81,10 +81,10 @@ func Test_botAll_Process(t *testing.T) {
}, },
storage: func(ctrl *gomock.Controller) storage.IStorage { storage: func(ctrl *gomock.Controller) storage.IStorage {
m := storage_mocks.NewMockIStorage(ctrl) 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(). m.EXPECT().
GetAllUsersByChatID(gomock.Any(), gomock.Any()). GetAllUsersByChatID(gomock.Any(), gomock.Any()).
Return([]storage.User{ Return([]*storage.User{
{UserID: "username"}, {UserID: "username"},
{UserID: "username2"}, {UserID: "username2"},
}, nil). }, nil).
@ -107,7 +107,7 @@ func Test_botAll_Process(t *testing.T) {
gomock.Any(), gomock.Any(),
&messenger.Message{ &messenger.Message{
ChatID: "123", ChatID: "123",
Text: "username2 username3", Text: "@username2 @username3",
}, },
). ).
Times(1) Times(1)
@ -115,10 +115,10 @@ func Test_botAll_Process(t *testing.T) {
}, },
storage: func(ctrl *gomock.Controller) storage.IStorage { storage: func(ctrl *gomock.Controller) storage.IStorage {
m := storage_mocks.NewMockIStorage(ctrl) 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(). m.EXPECT().
GetAllUsersByChatID(gomock.Any(), gomock.Any()). GetAllUsersByChatID(gomock.Any(), gomock.Any()).
Return([]storage.User{ Return([]*storage.User{
{UserID: "username"}, {UserID: "username"},
{UserID: "username2"}, {UserID: "username2"},
{UserID: "username3"}, {UserID: "username3"},