182 lines
4.9 KiB
Go
182 lines
4.9 KiB
Go
// Code generated by mockery; DO NOT EDIT.
|
|
// github.com/vektra/mockery
|
|
// template: testify
|
|
|
|
package mocks
|
|
|
|
import (
|
|
"context"
|
|
"mtusi-messenger/internal/domain"
|
|
|
|
"github.com/google/uuid"
|
|
mock "github.com/stretchr/testify/mock"
|
|
)
|
|
|
|
// NewMockRepository creates a new instance of MockRepository. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
|
|
// The first argument is typically a *testing.T value.
|
|
func NewMockRepository(t interface {
|
|
mock.TestingT
|
|
Cleanup(func())
|
|
}) *MockRepository {
|
|
if helper, ok := t.(interface{ Helper() }); ok {
|
|
helper.Helper()
|
|
}
|
|
|
|
mock := &MockRepository{}
|
|
mock.Mock.Test(t)
|
|
|
|
t.Cleanup(func() {
|
|
if helper, ok := t.(interface{ Helper() }); ok {
|
|
helper.Helper()
|
|
}
|
|
mock.AssertExpectations(t)
|
|
})
|
|
|
|
return mock
|
|
}
|
|
|
|
// MockRepository is an autogenerated mock type for the Repository type
|
|
type MockRepository struct {
|
|
mock.Mock
|
|
}
|
|
|
|
type MockRepository_Expecter struct {
|
|
mock *mock.Mock
|
|
}
|
|
|
|
func (_m *MockRepository) EXPECT() *MockRepository_Expecter {
|
|
return &MockRepository_Expecter{mock: &_m.Mock}
|
|
}
|
|
|
|
// Create provides a mock function for the type MockRepository
|
|
func (_mock *MockRepository) Create(ctx context.Context, draft domain.UserDraft) (domain.User, error) {
|
|
ret := _mock.Called(ctx, draft)
|
|
|
|
if len(ret) == 0 {
|
|
panic("no return value specified for Create")
|
|
}
|
|
|
|
var r0 domain.User
|
|
var r1 error
|
|
if returnFunc, ok := ret.Get(0).(func(context.Context, domain.UserDraft) (domain.User, error)); ok {
|
|
return returnFunc(ctx, draft)
|
|
}
|
|
if returnFunc, ok := ret.Get(0).(func(context.Context, domain.UserDraft) domain.User); ok {
|
|
r0 = returnFunc(ctx, draft)
|
|
} else {
|
|
r0 = ret.Get(0).(domain.User)
|
|
}
|
|
if returnFunc, ok := ret.Get(1).(func(context.Context, domain.UserDraft) error); ok {
|
|
r1 = returnFunc(ctx, draft)
|
|
} else {
|
|
r1 = ret.Error(1)
|
|
}
|
|
return r0, r1
|
|
}
|
|
|
|
// MockRepository_Create_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Create'
|
|
type MockRepository_Create_Call struct {
|
|
*mock.Call
|
|
}
|
|
|
|
// Create is a helper method to define mock.On call
|
|
// - ctx context.Context
|
|
// - draft domain.UserDraft
|
|
func (_e *MockRepository_Expecter) Create(ctx any, draft any) *MockRepository_Create_Call {
|
|
return &MockRepository_Create_Call{Call: _e.mock.On("Create", ctx, draft)}
|
|
}
|
|
|
|
func (_c *MockRepository_Create_Call) Run(run func(ctx context.Context, draft domain.UserDraft)) *MockRepository_Create_Call {
|
|
_c.Call.Run(func(args mock.Arguments) {
|
|
var arg0 context.Context
|
|
if args[0] != nil {
|
|
arg0 = args[0].(context.Context)
|
|
}
|
|
var arg1 domain.UserDraft
|
|
if args[1] != nil {
|
|
arg1 = args[1].(domain.UserDraft)
|
|
}
|
|
run(
|
|
arg0,
|
|
arg1,
|
|
)
|
|
})
|
|
return _c
|
|
}
|
|
|
|
func (_c *MockRepository_Create_Call) Return(user domain.User, err error) *MockRepository_Create_Call {
|
|
_c.Call.Return(user, err)
|
|
return _c
|
|
}
|
|
|
|
func (_c *MockRepository_Create_Call) RunAndReturn(run func(ctx context.Context, draft domain.UserDraft) (domain.User, error)) *MockRepository_Create_Call {
|
|
_c.Call.Return(run)
|
|
return _c
|
|
}
|
|
|
|
// GetByID provides a mock function for the type MockRepository
|
|
func (_mock *MockRepository) GetByID(ctx context.Context, id uuid.UUID) (domain.User, error) {
|
|
ret := _mock.Called(ctx, id)
|
|
|
|
if len(ret) == 0 {
|
|
panic("no return value specified for GetByID")
|
|
}
|
|
|
|
var r0 domain.User
|
|
var r1 error
|
|
if returnFunc, ok := ret.Get(0).(func(context.Context, uuid.UUID) (domain.User, error)); ok {
|
|
return returnFunc(ctx, id)
|
|
}
|
|
if returnFunc, ok := ret.Get(0).(func(context.Context, uuid.UUID) domain.User); ok {
|
|
r0 = returnFunc(ctx, id)
|
|
} else {
|
|
r0 = ret.Get(0).(domain.User)
|
|
}
|
|
if returnFunc, ok := ret.Get(1).(func(context.Context, uuid.UUID) error); ok {
|
|
r1 = returnFunc(ctx, id)
|
|
} else {
|
|
r1 = ret.Error(1)
|
|
}
|
|
return r0, r1
|
|
}
|
|
|
|
// MockRepository_GetByID_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetByID'
|
|
type MockRepository_GetByID_Call struct {
|
|
*mock.Call
|
|
}
|
|
|
|
// GetByID is a helper method to define mock.On call
|
|
// - ctx context.Context
|
|
// - id uuid.UUID
|
|
func (_e *MockRepository_Expecter) GetByID(ctx any, id any) *MockRepository_GetByID_Call {
|
|
return &MockRepository_GetByID_Call{Call: _e.mock.On("GetByID", ctx, id)}
|
|
}
|
|
|
|
func (_c *MockRepository_GetByID_Call) Run(run func(ctx context.Context, id uuid.UUID)) *MockRepository_GetByID_Call {
|
|
_c.Call.Run(func(args mock.Arguments) {
|
|
var arg0 context.Context
|
|
if args[0] != nil {
|
|
arg0 = args[0].(context.Context)
|
|
}
|
|
var arg1 uuid.UUID
|
|
if args[1] != nil {
|
|
arg1 = args[1].(uuid.UUID)
|
|
}
|
|
run(
|
|
arg0,
|
|
arg1,
|
|
)
|
|
})
|
|
return _c
|
|
}
|
|
|
|
func (_c *MockRepository_GetByID_Call) Return(user domain.User, err error) *MockRepository_GetByID_Call {
|
|
_c.Call.Return(user, err)
|
|
return _c
|
|
}
|
|
|
|
func (_c *MockRepository_GetByID_Call) RunAndReturn(run func(ctx context.Context, id uuid.UUID) (domain.User, error)) *MockRepository_GetByID_Call {
|
|
_c.Call.Return(run)
|
|
return _c
|
|
}
|