mirror of
https://github.com/rjNemo/rentease.git
synced 2026-06-06 02:36:49 +00:00
117 lines
2.9 KiB
Go
117 lines
2.9 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)
|
|
}
|
|
|
|
func (m *MockStore) CreatePayment(p *Payment) (*Payment, error) {
|
|
args := m.Called(p)
|
|
return args.Get(0).(*Payment), args.Error(1)
|
|
}
|
|
|
|
func (m *MockStore) GetPayment(id int) (*Payment, error) {
|
|
args := m.Called(id)
|
|
return args.Get(0).(*Payment), args.Error(1)
|
|
}
|
|
|
|
func (m *MockStore) UpdatePayment(id int, amount float64, paymentMethod string) (*Payment, error) {
|
|
args := m.Called(id, amount, paymentMethod)
|
|
return args.Get(0).(*Payment), args.Error(1)
|
|
}
|
|
|
|
// MockParserClient is a mock implementation of the parser.Client interface
|
|
type MockParserClient struct {
|
|
mock.Mock
|
|
}
|
|
|
|
// 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)
|
|
}
|