rentease/internal/service/booking/mocks_test.go
2024-12-08 12:08:54 +01:00

97 lines
2.3 KiB
Go

package booking
import (
"time"
"github.com/stretchr/testify/mock"
)
// MockStore is a mock implementation of the Store interface
type MockStore struct {
mock.Mock
}
func (m *MockStore) All() []*Line {
args := m.Called()
return args.Get(0).([]*Line)
}
func (m *MockStore) Search(value string) []*Line {
args := m.Called(value)
return args.Get(0).([]*Line)
}
func (m *MockStore) List(from, to time.Time) ([]*Line, error) {
args := m.Called(from, to)
return args.Get(0).([]*Line), args.Error(1)
}
func (m *MockStore) CardTotal(from, to time.Time) (float64, error) {
args := m.Called(from, to)
return args.Get(0).(float64), args.Error(1)
}
func (m *MockStore) Get(id int) *Booking {
args := m.Called(id)
return args.Get(0).(*Booking)
}
func (m *MockStore) Create(b *Booking) error {
args := m.Called(b)
return args.Error(0)
}
func (m *MockStore) Update(b *Booking) error {
args := m.Called(b)
return args.Error(0)
}
func (m *MockStore) Cancel(id int) error {
args := m.Called(id)
return args.Error(0)
}
func (m *MockStore) CreateItem(i *Item) error {
args := m.Called(i)
return args.Error(0)
}
func (m *MockStore) PayItem(id int) (*Item, error) {
args := m.Called(id)
return args.Get(0).(*Item), args.Error(1)
}
func (m *MockStore) GetItem(id int) (*Item, error) {
args := m.Called(id)
return args.Get(0).(*Item), args.Error(1)
}
func (m *MockStore) UpdateItem(id int, item string, paymentMethod string, paymentStatus string, qty int, price float64) (*Item, error) {
args := m.Called(id, item, paymentMethod, paymentStatus, qty, price)
return args.Get(0).(*Item), args.Error(1)
}
// MockCalendarClient is a mock implementation of the calendar.Client interface
type MockCalendarClient struct {
mock.Mock
}
func (m *MockCalendarClient) Create(calendarId, name, description string, from, to time.Time) error {
args := m.Called(calendarId, name, description, from, to)
return args.Error(0)
}
// MockPDFClient is a mock implementation of the pdf.Client interface
type MockPDFClient struct {
mock.Mock
}
func (m *MockPDFClient) BuildInvoice(context map[string]any) error {
args := m.Called(context)
return args.Error(0)
}
func (m *MockPDFClient) BuildReport(context map[string]any, period string, month, year int) error {
args := m.Called(context, period, month, year)
return args.Error(0)
}