1// Code generated by mockery; DO NOT EDIT.
2// github.com/vektra/mockery
3// template: testify
4
5package mocks
6
7import (
8 "context"
9 "time"
10
11 "github.com/bnema/dumber/internal/domain/entity"
12 mock "github.com/stretchr/testify/mock"
13)
14
15// NewMockSessionRepository creates a new instance of MockSessionRepository. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
16// The first argument is typically a *testing.T value.
17func NewMockSessionRepository(t interface {
18 mock.TestingT
19 Cleanup(func())
20}) *MockSessionRepository {
21 mock := &MockSessionRepository{}
22 mock.Mock.Test(t)
23
24 t.Cleanup(func() { mock.AssertExpectations(t) })
25
26 return mock
27}
28
29// MockSessionRepository is an autogenerated mock type for the SessionRepository type
30type MockSessionRepository struct {
31 mock.Mock
32}
33
34type MockSessionRepository_Expecter struct {
35 mock *mock.Mock
36}
37
38func (_m *MockSessionRepository) EXPECT() *MockSessionRepository_Expecter {
39 return &MockSessionRepository_Expecter{mock: &_m.Mock}
40}
41
42// Delete provides a mock function for the type MockSessionRepository
43func (_mock *MockSessionRepository) Delete(ctx context.Context, id entity.SessionID) error {
44 ret := _mock.Called(ctx, id)
45
46 if len(ret) == 0 {
47 panic("no return value specified for Delete")
48 }
49
50 var r0 error
51 if returnFunc, ok := ret.Get(0).(func(context.Context, entity.SessionID) error); ok {
52 r0 = returnFunc(ctx, id)
53 } else {
54 r0 = ret.Error(0)
55 }
56 return r0
57}
58
59// MockSessionRepository_Delete_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Delete'
60type MockSessionRepository_Delete_Call struct {
61 *mock.Call
62}
63
64// Delete is a helper method to define mock.On call
65// - ctx context.Context
66// - id entity.SessionID
67func (_e *MockSessionRepository_Expecter) Delete(ctx any, id any) *MockSessionRepository_Delete_Call {
68 return &MockSessionRepository_Delete_Call{Call: _e.mock.On("Delete", ctx, id)}
69}
70
71func (_c *MockSessionRepository_Delete_Call) Run(run func(ctx context.Context, id entity.SessionID)) *MockSessionRepository_Delete_Call {
72 _c.Call.Run(func(args mock.Arguments) {
73 var arg0 context.Context
74 if args[0] != nil {
75 arg0 = args[0].(context.Context)
76 }
77 var arg1 entity.SessionID
78 if args[1] != nil {
79 arg1 = args[1].(entity.SessionID)
80 }
81 run(
82 arg0,
83 arg1,
84 )
85 })
86 return _c
87}
88
89func (_c *MockSessionRepository_Delete_Call) Return(err error) *MockSessionRepository_Delete_Call {
90 _c.Call.Return(err)
91 return _c
92}
93
94func (_c *MockSessionRepository_Delete_Call) RunAndReturn(run func(ctx context.Context, id entity.SessionID) error) *MockSessionRepository_Delete_Call {
95 _c.Call.Return(run)
96 return _c
97}
98
99// DeleteExitedBefore provides a mock function for the type MockSessionRepository
100func (_mock *MockSessionRepository) DeleteExitedBefore(ctx context.Context, cutoff time.Time) (int64, error) {
101 ret := _mock.Called(ctx, cutoff)
102
103 if len(ret) == 0 {
104 panic("no return value specified for DeleteExitedBefore")
105 }
106
107 var r0 int64
108 var r1 error
109 if returnFunc, ok := ret.Get(0).(func(context.Context, time.Time) (int64, error)); ok {
110 return returnFunc(ctx, cutoff)
111 }
112 if returnFunc, ok := ret.Get(0).(func(context.Context, time.Time) int64); ok {
113 r0 = returnFunc(ctx, cutoff)
114 } else {
115 r0 = ret.Get(0).(int64)
116 }
117 if returnFunc, ok := ret.Get(1).(func(context.Context, time.Time) error); ok {
118 r1 = returnFunc(ctx, cutoff)
119 } else {
120 r1 = ret.Error(1)
121 }
122 return r0, r1
123}
124
125// MockSessionRepository_DeleteExitedBefore_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'DeleteExitedBefore'
126type MockSessionRepository_DeleteExitedBefore_Call struct {
127 *mock.Call
128}
129
130// DeleteExitedBefore is a helper method to define mock.On call
131// - ctx context.Context
132// - cutoff time.Time
133func (_e *MockSessionRepository_Expecter) DeleteExitedBefore(ctx any, cutoff any) *MockSessionRepository_DeleteExitedBefore_Call {
134 return &MockSessionRepository_DeleteExitedBefore_Call{Call: _e.mock.On("DeleteExitedBefore", ctx, cutoff)}
135}
136
137func (_c *MockSessionRepository_DeleteExitedBefore_Call) Run(run func(ctx context.Context, cutoff time.Time)) *MockSessionRepository_DeleteExitedBefore_Call {
138 _c.Call.Run(func(args mock.Arguments) {
139 var arg0 context.Context
140 if args[0] != nil {
141 arg0 = args[0].(context.Context)
142 }
143 var arg1 time.Time
144 if args[1] != nil {
145 arg1 = args[1].(time.Time)
146 }
147 run(
148 arg0,
149 arg1,
150 )
151 })
152 return _c
153}
154
155func (_c *MockSessionRepository_DeleteExitedBefore_Call) Return(n int64, err error) *MockSessionRepository_DeleteExitedBefore_Call {
156 _c.Call.Return(n, err)
157 return _c
158}
159
160func (_c *MockSessionRepository_DeleteExitedBefore_Call) RunAndReturn(run func(ctx context.Context, cutoff time.Time) (int64, error)) *MockSessionRepository_DeleteExitedBefore_Call {
161 _c.Call.Return(run)
162 return _c
163}
164
165// DeleteOldestExited provides a mock function for the type MockSessionRepository
166func (_mock *MockSessionRepository) DeleteOldestExited(ctx context.Context, keepCount int) (int64, error) {
167 ret := _mock.Called(ctx, keepCount)
168
169 if len(ret) == 0 {
170 panic("no return value specified for DeleteOldestExited")
171 }
172
173 var r0 int64
174 var r1 error
175 if returnFunc, ok := ret.Get(0).(func(context.Context, int) (int64, error)); ok {
176 return returnFunc(ctx, keepCount)
177 }
178 if returnFunc, ok := ret.Get(0).(func(context.Context, int) int64); ok {
179 r0 = returnFunc(ctx, keepCount)
180 } else {
181 r0 = ret.Get(0).(int64)
182 }
183 if returnFunc, ok := ret.Get(1).(func(context.Context, int) error); ok {
184 r1 = returnFunc(ctx, keepCount)
185 } else {
186 r1 = ret.Error(1)
187 }
188 return r0, r1
189}
190
191// MockSessionRepository_DeleteOldestExited_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'DeleteOldestExited'
192type MockSessionRepository_DeleteOldestExited_Call struct {
193 *mock.Call
194}
195
196// DeleteOldestExited is a helper method to define mock.On call
197// - ctx context.Context
198// - keepCount int
199func (_e *MockSessionRepository_Expecter) DeleteOldestExited(ctx any, keepCount any) *MockSessionRepository_DeleteOldestExited_Call {
200 return &MockSessionRepository_DeleteOldestExited_Call{Call: _e.mock.On("DeleteOldestExited", ctx, keepCount)}
201}
202
203func (_c *MockSessionRepository_DeleteOldestExited_Call) Run(run func(ctx context.Context, keepCount int)) *MockSessionRepository_DeleteOldestExited_Call {
204 _c.Call.Run(func(args mock.Arguments) {
205 var arg0 context.Context
206 if args[0] != nil {
207 arg0 = args[0].(context.Context)
208 }
209 var arg1 int
210 if args[1] != nil {
211 arg1 = args[1].(int)
212 }
213 run(
214 arg0,
215 arg1,
216 )
217 })
218 return _c
219}
220
221func (_c *MockSessionRepository_DeleteOldestExited_Call) Return(n int64, err error) *MockSessionRepository_DeleteOldestExited_Call {
222 _c.Call.Return(n, err)
223 return _c
224}
225
226func (_c *MockSessionRepository_DeleteOldestExited_Call) RunAndReturn(run func(ctx context.Context, keepCount int) (int64, error)) *MockSessionRepository_DeleteOldestExited_Call {
227 _c.Call.Return(run)
228 return _c
229}
230
231// FindByID provides a mock function for the type MockSessionRepository
232func (_mock *MockSessionRepository) FindByID(ctx context.Context, id entity.SessionID) (*entity.Session, error) {
233 ret := _mock.Called(ctx, id)
234
235 if len(ret) == 0 {
236 panic("no return value specified for FindByID")
237 }
238
239 var r0 *entity.Session
240 var r1 error
241 if returnFunc, ok := ret.Get(0).(func(context.Context, entity.SessionID) (*entity.Session, error)); ok {
242 return returnFunc(ctx, id)
243 }
244 if returnFunc, ok := ret.Get(0).(func(context.Context, entity.SessionID) *entity.Session); ok {
245 r0 = returnFunc(ctx, id)
246 } else {
247 if ret.Get(0) != nil {
248 r0 = ret.Get(0).(*entity.Session)
249 }
250 }
251 if returnFunc, ok := ret.Get(1).(func(context.Context, entity.SessionID) error); ok {
252 r1 = returnFunc(ctx, id)
253 } else {
254 r1 = ret.Error(1)
255 }
256 return r0, r1
257}
258
259// MockSessionRepository_FindByID_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'FindByID'
260type MockSessionRepository_FindByID_Call struct {
261 *mock.Call
262}
263
264// FindByID is a helper method to define mock.On call
265// - ctx context.Context
266// - id entity.SessionID
267func (_e *MockSessionRepository_Expecter) FindByID(ctx any, id any) *MockSessionRepository_FindByID_Call {
268 return &MockSessionRepository_FindByID_Call{Call: _e.mock.On("FindByID", ctx, id)}
269}
270
271func (_c *MockSessionRepository_FindByID_Call) Run(run func(ctx context.Context, id entity.SessionID)) *MockSessionRepository_FindByID_Call {
272 _c.Call.Run(func(args mock.Arguments) {
273 var arg0 context.Context
274 if args[0] != nil {
275 arg0 = args[0].(context.Context)
276 }
277 var arg1 entity.SessionID
278 if args[1] != nil {
279 arg1 = args[1].(entity.SessionID)
280 }
281 run(
282 arg0,
283 arg1,
284 )
285 })
286 return _c
287}
288
289func (_c *MockSessionRepository_FindByID_Call) Return(session *entity.Session, err error) *MockSessionRepository_FindByID_Call {
290 _c.Call.Return(session, err)
291 return _c
292}
293
294func (_c *MockSessionRepository_FindByID_Call) RunAndReturn(run func(ctx context.Context, id entity.SessionID) (*entity.Session, error)) *MockSessionRepository_FindByID_Call {
295 _c.Call.Return(run)
296 return _c
297}
298
299// GetActive provides a mock function for the type MockSessionRepository
300func (_mock *MockSessionRepository) GetActive(ctx context.Context) (*entity.Session, error) {
301 ret := _mock.Called(ctx)
302
303 if len(ret) == 0 {
304 panic("no return value specified for GetActive")
305 }
306
307 var r0 *entity.Session
308 var r1 error
309 if returnFunc, ok := ret.Get(0).(func(context.Context) (*entity.Session, error)); ok {
310 return returnFunc(ctx)
311 }
312 if returnFunc, ok := ret.Get(0).(func(context.Context) *entity.Session); ok {
313 r0 = returnFunc(ctx)
314 } else {
315 if ret.Get(0) != nil {
316 r0 = ret.Get(0).(*entity.Session)
317 }
318 }
319 if returnFunc, ok := ret.Get(1).(func(context.Context) error); ok {
320 r1 = returnFunc(ctx)
321 } else {
322 r1 = ret.Error(1)
323 }
324 return r0, r1
325}
326
327// MockSessionRepository_GetActive_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetActive'
328type MockSessionRepository_GetActive_Call struct {
329 *mock.Call
330}
331
332// GetActive is a helper method to define mock.On call
333// - ctx context.Context
334func (_e *MockSessionRepository_Expecter) GetActive(ctx any) *MockSessionRepository_GetActive_Call {
335 return &MockSessionRepository_GetActive_Call{Call: _e.mock.On("GetActive", ctx)}
336}
337
338func (_c *MockSessionRepository_GetActive_Call) Run(run func(ctx context.Context)) *MockSessionRepository_GetActive_Call {
339 _c.Call.Run(func(args mock.Arguments) {
340 var arg0 context.Context
341 if args[0] != nil {
342 arg0 = args[0].(context.Context)
343 }
344 run(
345 arg0,
346 )
347 })
348 return _c
349}
350
351func (_c *MockSessionRepository_GetActive_Call) Return(session *entity.Session, err error) *MockSessionRepository_GetActive_Call {
352 _c.Call.Return(session, err)
353 return _c
354}
355
356func (_c *MockSessionRepository_GetActive_Call) RunAndReturn(run func(ctx context.Context) (*entity.Session, error)) *MockSessionRepository_GetActive_Call {
357 _c.Call.Return(run)
358 return _c
359}
360
361// GetRecent provides a mock function for the type MockSessionRepository
362func (_mock *MockSessionRepository) GetRecent(ctx context.Context, limit int) ([]*entity.Session, error) {
363 ret := _mock.Called(ctx, limit)
364
365 if len(ret) == 0 {
366 panic("no return value specified for GetRecent")
367 }
368
369 var r0 []*entity.Session
370 var r1 error
371 if returnFunc, ok := ret.Get(0).(func(context.Context, int) ([]*entity.Session, error)); ok {
372 return returnFunc(ctx, limit)
373 }
374 if returnFunc, ok := ret.Get(0).(func(context.Context, int) []*entity.Session); ok {
375 r0 = returnFunc(ctx, limit)
376 } else {
377 if ret.Get(0) != nil {
378 r0 = ret.Get(0).([]*entity.Session)
379 }
380 }
381 if returnFunc, ok := ret.Get(1).(func(context.Context, int) error); ok {
382 r1 = returnFunc(ctx, limit)
383 } else {
384 r1 = ret.Error(1)
385 }
386 return r0, r1
387}
388
389// MockSessionRepository_GetRecent_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetRecent'
390type MockSessionRepository_GetRecent_Call struct {
391 *mock.Call
392}
393
394// GetRecent is a helper method to define mock.On call
395// - ctx context.Context
396// - limit int
397func (_e *MockSessionRepository_Expecter) GetRecent(ctx any, limit any) *MockSessionRepository_GetRecent_Call {
398 return &MockSessionRepository_GetRecent_Call{Call: _e.mock.On("GetRecent", ctx, limit)}
399}
400
401func (_c *MockSessionRepository_GetRecent_Call) Run(run func(ctx context.Context, limit int)) *MockSessionRepository_GetRecent_Call {
402 _c.Call.Run(func(args mock.Arguments) {
403 var arg0 context.Context
404 if args[0] != nil {
405 arg0 = args[0].(context.Context)
406 }
407 var arg1 int
408 if args[1] != nil {
409 arg1 = args[1].(int)
410 }
411 run(
412 arg0,
413 arg1,
414 )
415 })
416 return _c
417}
418
419func (_c *MockSessionRepository_GetRecent_Call) Return(sessions []*entity.Session, err error) *MockSessionRepository_GetRecent_Call {
420 _c.Call.Return(sessions, err)
421 return _c
422}
423
424func (_c *MockSessionRepository_GetRecent_Call) RunAndReturn(run func(ctx context.Context, limit int) ([]*entity.Session, error)) *MockSessionRepository_GetRecent_Call {
425 _c.Call.Return(run)
426 return _c
427}
428
429// MarkEnded provides a mock function for the type MockSessionRepository
430func (_mock *MockSessionRepository) MarkEnded(ctx context.Context, id entity.SessionID, endedAt time.Time) error {
431 ret := _mock.Called(ctx, id, endedAt)
432
433 if len(ret) == 0 {
434 panic("no return value specified for MarkEnded")
435 }
436
437 var r0 error
438 if returnFunc, ok := ret.Get(0).(func(context.Context, entity.SessionID, time.Time) error); ok {
439 r0 = returnFunc(ctx, id, endedAt)
440 } else {
441 r0 = ret.Error(0)
442 }
443 return r0
444}
445
446// MockSessionRepository_MarkEnded_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'MarkEnded'
447type MockSessionRepository_MarkEnded_Call struct {
448 *mock.Call
449}
450
451// MarkEnded is a helper method to define mock.On call
452// - ctx context.Context
453// - id entity.SessionID
454// - endedAt time.Time
455func (_e *MockSessionRepository_Expecter) MarkEnded(ctx any, id any, endedAt any) *MockSessionRepository_MarkEnded_Call {
456 return &MockSessionRepository_MarkEnded_Call{Call: _e.mock.On("MarkEnded", ctx, id, endedAt)}
457}
458
459func (_c *MockSessionRepository_MarkEnded_Call) Run(run func(ctx context.Context, id entity.SessionID, endedAt time.Time)) *MockSessionRepository_MarkEnded_Call {
460 _c.Call.Run(func(args mock.Arguments) {
461 var arg0 context.Context
462 if args[0] != nil {
463 arg0 = args[0].(context.Context)
464 }
465 var arg1 entity.SessionID
466 if args[1] != nil {
467 arg1 = args[1].(entity.SessionID)
468 }
469 var arg2 time.Time
470 if args[2] != nil {
471 arg2 = args[2].(time.Time)
472 }
473 run(
474 arg0,
475 arg1,
476 arg2,
477 )
478 })
479 return _c
480}
481
482func (_c *MockSessionRepository_MarkEnded_Call) Return(err error) *MockSessionRepository_MarkEnded_Call {
483 _c.Call.Return(err)
484 return _c
485}
486
487func (_c *MockSessionRepository_MarkEnded_Call) RunAndReturn(run func(ctx context.Context, id entity.SessionID, endedAt time.Time) error) *MockSessionRepository_MarkEnded_Call {
488 _c.Call.Return(run)
489 return _c
490}
491
492// Save provides a mock function for the type MockSessionRepository
493func (_mock *MockSessionRepository) Save(ctx context.Context, session *entity.Session) error {
494 ret := _mock.Called(ctx, session)
495
496 if len(ret) == 0 {
497 panic("no return value specified for Save")
498 }
499
500 var r0 error
501 if returnFunc, ok := ret.Get(0).(func(context.Context, *entity.Session) error); ok {
502 r0 = returnFunc(ctx, session)
503 } else {
504 r0 = ret.Error(0)
505 }
506 return r0
507}
508
509// MockSessionRepository_Save_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Save'
510type MockSessionRepository_Save_Call struct {
511 *mock.Call
512}
513
514// Save is a helper method to define mock.On call
515// - ctx context.Context
516// - session *entity.Session
517func (_e *MockSessionRepository_Expecter) Save(ctx any, session any) *MockSessionRepository_Save_Call {
518 return &MockSessionRepository_Save_Call{Call: _e.mock.On("Save", ctx, session)}
519}
520
521func (_c *MockSessionRepository_Save_Call) Run(run func(ctx context.Context, session *entity.Session)) *MockSessionRepository_Save_Call {
522 _c.Call.Run(func(args mock.Arguments) {
523 var arg0 context.Context
524 if args[0] != nil {
525 arg0 = args[0].(context.Context)
526 }
527 var arg1 *entity.Session
528 if args[1] != nil {
529 arg1 = args[1].(*entity.Session)
530 }
531 run(
532 arg0,
533 arg1,
534 )
535 })
536 return _c
537}
538
539func (_c *MockSessionRepository_Save_Call) Return(err error) *MockSessionRepository_Save_Call {
540 _c.Call.Return(err)
541 return _c
542}
543
544func (_c *MockSessionRepository_Save_Call) RunAndReturn(run func(ctx context.Context, session *entity.Session) error) *MockSessionRepository_Save_Call {
545 _c.Call.Return(run)
546 return _c
547}