|
| 1 | +package cart |
| 2 | + |
| 3 | +import ( |
| 4 | + "bullet-cloud-api/internal/models" |
| 5 | + "context" |
| 6 | + |
| 7 | + "github.com/google/uuid" |
| 8 | + "github.com/stretchr/testify/mock" |
| 9 | +) |
| 10 | + |
| 11 | +// MockCartRepository is a mock type for the CartRepository type |
| 12 | +type MockCartRepository struct { |
| 13 | + mock.Mock |
| 14 | +} |
| 15 | + |
| 16 | +// GetOrCreateCartByUserID mocks base method |
| 17 | +func (_m *MockCartRepository) GetOrCreateCartByUserID(ctx context.Context, userID uuid.UUID) (*models.Cart, error) { |
| 18 | + ret := _m.Called(ctx, userID) |
| 19 | + |
| 20 | + var r0 *models.Cart |
| 21 | + if rf, ok := ret.Get(0).(func(context.Context, uuid.UUID) *models.Cart); ok { |
| 22 | + r0 = rf(ctx, userID) |
| 23 | + } else { |
| 24 | + if ret.Get(0) != nil { |
| 25 | + r0 = ret.Get(0).(*models.Cart) |
| 26 | + } |
| 27 | + } |
| 28 | + |
| 29 | + var r1 error |
| 30 | + if rf, ok := ret.Get(1).(func(context.Context, uuid.UUID) error); ok { |
| 31 | + r1 = rf(ctx, userID) |
| 32 | + } else { |
| 33 | + r1 = ret.Error(1) |
| 34 | + } |
| 35 | + |
| 36 | + return r0, r1 |
| 37 | +} |
| 38 | + |
| 39 | +// GetCartItems mocks base method |
| 40 | +func (_m *MockCartRepository) GetCartItems(ctx context.Context, cartID uuid.UUID) ([]models.CartItem, error) { |
| 41 | + ret := _m.Called(ctx, cartID) |
| 42 | + |
| 43 | + var r0 []models.CartItem |
| 44 | + if rf, ok := ret.Get(0).(func(context.Context, uuid.UUID) []models.CartItem); ok { |
| 45 | + r0 = rf(ctx, cartID) |
| 46 | + } else { |
| 47 | + if ret.Get(0) != nil { |
| 48 | + r0 = ret.Get(0).([]models.CartItem) |
| 49 | + } |
| 50 | + } |
| 51 | + |
| 52 | + var r1 error |
| 53 | + if rf, ok := ret.Get(1).(func(context.Context, uuid.UUID) error); ok { |
| 54 | + r1 = rf(ctx, cartID) |
| 55 | + } else { |
| 56 | + r1 = ret.Error(1) |
| 57 | + } |
| 58 | + |
| 59 | + return r0, r1 |
| 60 | +} |
| 61 | + |
| 62 | +// AddItem mocks base method |
| 63 | +func (_m *MockCartRepository) AddItem(ctx context.Context, cartID uuid.UUID, productID uuid.UUID, quantity int, price float64) (*models.CartItem, error) { |
| 64 | + ret := _m.Called(ctx, cartID, productID, quantity, price) |
| 65 | + |
| 66 | + var r0 *models.CartItem |
| 67 | + if rf, ok := ret.Get(0).(func(context.Context, uuid.UUID, uuid.UUID, int, float64) *models.CartItem); ok { |
| 68 | + r0 = rf(ctx, cartID, productID, quantity, price) |
| 69 | + } else { |
| 70 | + if ret.Get(0) != nil { |
| 71 | + r0 = ret.Get(0).(*models.CartItem) |
| 72 | + } |
| 73 | + } |
| 74 | + |
| 75 | + var r1 error |
| 76 | + if rf, ok := ret.Get(1).(func(context.Context, uuid.UUID, uuid.UUID, int, float64) error); ok { |
| 77 | + r1 = rf(ctx, cartID, productID, quantity, price) |
| 78 | + } else { |
| 79 | + r1 = ret.Error(1) |
| 80 | + } |
| 81 | + |
| 82 | + return r0, r1 |
| 83 | +} |
| 84 | + |
| 85 | +// UpdateItemQuantity mocks base method |
| 86 | +func (_m *MockCartRepository) UpdateItemQuantity(ctx context.Context, cartID, productID uuid.UUID, quantity int) (*models.CartItem, error) { |
| 87 | + ret := _m.Called(ctx, cartID, productID, quantity) |
| 88 | + |
| 89 | + var r0 *models.CartItem |
| 90 | + if rf, ok := ret.Get(0).(func(context.Context, uuid.UUID, uuid.UUID, int) *models.CartItem); ok { |
| 91 | + r0 = rf(ctx, cartID, productID, quantity) |
| 92 | + } else { |
| 93 | + if ret.Get(0) != nil { |
| 94 | + r0 = ret.Get(0).(*models.CartItem) |
| 95 | + } |
| 96 | + } |
| 97 | + |
| 98 | + var r1 error |
| 99 | + if rf, ok := ret.Get(1).(func(context.Context, uuid.UUID, uuid.UUID, int) error); ok { |
| 100 | + r1 = rf(ctx, cartID, productID, quantity) |
| 101 | + } else { |
| 102 | + r1 = ret.Error(1) |
| 103 | + } |
| 104 | + |
| 105 | + return r0, r1 |
| 106 | +} |
| 107 | + |
| 108 | +// UpdateItem mocks base method - KEEPING OLD WRONG ONE FOR NOW TO AVOID BREAKING OLD TESTS THAT MIGHT STILL USE IT |
| 109 | +// DELETE THIS OLD ONE LATER |
| 110 | +func (_m *MockCartRepository) UpdateItem(ctx context.Context, cartID uuid.UUID, productID uuid.UUID, quantity int) (*models.CartItem, error) { |
| 111 | + ret := _m.Called(ctx, cartID, productID, quantity) |
| 112 | + |
| 113 | + var r0 *models.CartItem |
| 114 | + if rf, ok := ret.Get(0).(func(context.Context, uuid.UUID, uuid.UUID, int) *models.CartItem); ok { |
| 115 | + r0 = rf(ctx, cartID, productID, quantity) |
| 116 | + } else { |
| 117 | + if ret.Get(0) != nil { |
| 118 | + r0 = ret.Get(0).(*models.CartItem) |
| 119 | + } |
| 120 | + } |
| 121 | + |
| 122 | + var r1 error |
| 123 | + if rf, ok := ret.Get(1).(func(context.Context, uuid.UUID, uuid.UUID, int) error); ok { |
| 124 | + r1 = rf(ctx, cartID, productID, quantity) |
| 125 | + } else { |
| 126 | + r1 = ret.Error(1) |
| 127 | + } |
| 128 | + |
| 129 | + return r0, r1 |
| 130 | +} |
| 131 | + |
| 132 | +// DeleteItem mocks base method |
| 133 | +func (_m *MockCartRepository) DeleteItem(ctx context.Context, cartID uuid.UUID, productID uuid.UUID) error { |
| 134 | + ret := _m.Called(ctx, cartID, productID) |
| 135 | + |
| 136 | + var r0 error |
| 137 | + if rf, ok := ret.Get(0).(func(context.Context, uuid.UUID, uuid.UUID) error); ok { |
| 138 | + r0 = rf(ctx, cartID, productID) |
| 139 | + } else { |
| 140 | + r0 = ret.Error(0) |
| 141 | + } |
| 142 | + |
| 143 | + return r0 |
| 144 | +} |
| 145 | + |
| 146 | +// RemoveItem mocks base method |
| 147 | +func (_m *MockCartRepository) RemoveItem(ctx context.Context, cartID, productID uuid.UUID) error { |
| 148 | + ret := _m.Called(ctx, cartID, productID) |
| 149 | + |
| 150 | + var r0 error |
| 151 | + if rf, ok := ret.Get(0).(func(context.Context, uuid.UUID, uuid.UUID) error); ok { |
| 152 | + r0 = rf(ctx, cartID, productID) |
| 153 | + } else { |
| 154 | + r0 = ret.Error(0) |
| 155 | + } |
| 156 | + |
| 157 | + return r0 |
| 158 | +} |
| 159 | + |
| 160 | +// ClearCart mocks base method |
| 161 | +func (_m *MockCartRepository) ClearCart(ctx context.Context, cartID uuid.UUID) error { |
| 162 | + ret := _m.Called(ctx, cartID) |
| 163 | + |
| 164 | + var r0 error |
| 165 | + if rf, ok := ret.Get(0).(func(context.Context, uuid.UUID) error); ok { |
| 166 | + r0 = rf(ctx, cartID) |
| 167 | + } else { |
| 168 | + r0 = ret.Error(0) |
| 169 | + } |
| 170 | + |
| 171 | + return r0 |
| 172 | +} |
| 173 | + |
| 174 | +// FindCartItem mocks base method |
| 175 | +func (_m *MockCartRepository) FindCartItem(ctx context.Context, cartID uuid.UUID, productID uuid.UUID) (*models.CartItem, error) { |
| 176 | + ret := _m.Called(ctx, cartID, productID) |
| 177 | + |
| 178 | + var r0 *models.CartItem |
| 179 | + if rf, ok := ret.Get(0).(func(context.Context, uuid.UUID, uuid.UUID) *models.CartItem); ok { |
| 180 | + r0 = rf(ctx, cartID, productID) |
| 181 | + } else { |
| 182 | + if ret.Get(0) != nil { |
| 183 | + r0 = ret.Get(0).(*models.CartItem) |
| 184 | + } |
| 185 | + } |
| 186 | + |
| 187 | + var r1 error |
| 188 | + if rf, ok := ret.Get(1).(func(context.Context, uuid.UUID, uuid.UUID) error); ok { |
| 189 | + r1 = rf(ctx, cartID, productID) |
| 190 | + } else { |
| 191 | + r1 = ret.Error(1) |
| 192 | + } |
| 193 | + |
| 194 | + return r0, r1 |
| 195 | +} |
0 commit comments