/
room_store_mock.go
55 lines (44 loc) · 2.03 KB
/
room_store_mock.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
package mocks
import (
"context"
"time"
"github.com/ArtyomArtamonov/msg/internal/model"
"github.com/ArtyomArtamonov/msg/internal/utils"
"github.com/google/uuid"
"github.com/stretchr/testify/mock"
)
type RoomStoreMock struct {
mock.Mock
}
func (m *RoomStoreMock) Add(ctx context.Context, room *model.Room) error {
args := m.Called(ctx, room)
return utils.Unwrap[error](args.Get(0))
}
func (m *RoomStoreMock) AddAndSendMessage(ctx context.Context, room *model.Room, message *model.Message) (*model.Room, error) {
args := m.Called(ctx, room, message)
return utils.Unwrap[*model.Room](args.Get(0)), utils.Unwrap[error](args.Get(1))
}
func (m *RoomStoreMock) Get(ctx context.Context, id uuid.UUID) (*model.Room, error) {
args := m.Called(ctx, id)
return utils.Unwrap[*model.Room](args.Get(0)), utils.Unwrap[error](args.Get(1))
}
func (m *RoomStoreMock) FindDialogRoom(ctx context.Context, userId1, userId2 uuid.UUID) (*model.Room, error) {
args := m.Called(ctx, userId1, userId2)
return utils.Unwrap[*model.Room](args.Get(0)), utils.Unwrap[error](args.Get(1))
}
func (m *RoomStoreMock) UsersInRoom(ctx context.Context, id uuid.UUID) ([]uuid.UUID, error) {
args := m.Called(ctx, id)
return utils.Unwrap[[]uuid.UUID](args.Get(0)), utils.Unwrap[error](args.Get(1))
}
func (m *RoomStoreMock) FindByIds(ctx context.Context, userIds ...uuid.UUID) ([]model.User, error) {
args := m.Called(ctx, userIds)
return utils.Unwrap[[]model.User](args.Get(0)), utils.Unwrap[error](args.Get(1))
}
func (m *RoomStoreMock) ListRooms(ctx context.Context, userId uuid.UUID, lastMessageDate time.Time, pageSize int) ([]model.Room, error) {
args := m.Called(ctx, userId, lastMessageDate, pageSize)
return utils.Unwrap[[]model.Room](args.Get(0)), utils.Unwrap[error](args.Get(1))
}
func (m *RoomStoreMock) ListRoomsFirst(ctx context.Context, userId uuid.UUID, pageSize int) ([]model.Room, error) {
args := m.Called(ctx, userId, pageSize)
return utils.Unwrap[[]model.Room](args.Get(0)), utils.Unwrap[error](args.Get(1))
}