detached eba3182

Merge pull request #319 from bnema/backlog/complete-runtime-config-seam

Complete runtime config seam
commit
eba31825853a11d521b7381332e258e51f40a106
author
bnema · · 2026-06-24 05:03 UTC
committer
GitHub · · 2026-06-24 05:03 UTC
merge of
237f69b + 03caa44 · diff against the first parent
signature
GPG UnverifiedB5690EEEBB952194 The key is unknown
120 files · +27188 -22441
M .mockery.yaml +69 -4
@@ -2,10 +2,51 @@ template: testify
22 template-data:
33 unroll-variadic: true
44 packages:
5+ github.com/bnema/dumber/internal/bootstrap:
6+ config:
7+ dir: '{{.InterfaceDir}}/mocks'
8+ filename: '{{ .InterfaceFile | base }}'
9+ pkgname: mocks
10+ interfaces:
11+ configChangeManager:
12+ config:
13+ structname: MockConfigChangeManager
14+ github.com/bnema/dumber/internal/cli/cmd:
15+ config:
16+ dir: '{{.InterfaceDir}}/mocks'
17+ filename: '{{ .InterfaceFile | base }}'
18+ pkgname: mocks
19+ interfaces:
20+ sessionManager:
21+ config:
22+ structname: MockSessionManager
23+ github.com/bnema/dumber/internal/infrastructure/clipboard:
24+ config:
25+ dir: '{{.InterfaceDir}}/mocks'
26+ filename: '{{ .InterfaceFile | base }}'
27+ pkgname: mocks
28+ interfaces:
29+ toolkitClipboard:
30+ config:
31+ structname: MockToolkitClipboard
32+ github.com/bnema/dumber/internal/infrastructure/systemviewsbridge:
33+ config:
34+ dir: '{{.InterfaceDir}}/mocks'
35+ filename: '{{ .InterfaceFile | base }}'
36+ pkgname: mocks
37+ interfaces:
38+ Transport: {}
39+ github.com/bnema/purego-pipewire/pipewire:
40+ config:
41+ dir: internal/infrastructure/audio/pipewire/mocks
42+ filename: '{{ .InterfaceFile | base }}'
43+ pkgname: mocks
44+ interfaces:
45+ Player: {}
546 github.com/bnema/dumber/internal/application/port:
647 config:
748 dir: '{{.InterfaceDir}}/mocks'
8- filename: mocks.go
49+ filename: '{{ .InterfaceFile | base }}'
950 pkgname: mocks
1051 interfaces:
1152 ConfigMigrator: {}
@@ -58,6 +99,12 @@ packages:
5899 DesktopIntegration: {}
59100 DownloadEventHandler: {}
60101 DownloadPreparer: {}
102+ FaviconBlobStore: {}
103+ FaviconFetcher: {}
104+ FaviconImageConverter: {}
105+ FaviconInvalidators: {}
106+ FaviconRefreshScheduler: {}
107+ FaviconRepository: {}
61108 FaviconService: {}
62109 FileSystem: {}
63110 FilterManager: {}
@@ -75,6 +122,8 @@ packages:
75122 NativeWidgetProvider: {}
76123 Notification: {}
77124 RenderingEnvManager: {}
125+ FaviconResolver: {}
126+ RuntimeConfigProvider: {}
78127 RuntimeVersionProbe: {}
79128 ScriptRefresher: {}
80129 SnapshotService: {}
@@ -95,7 +144,7 @@ packages:
95144 github.com/bnema/dumber/internal/domain/repository:
96145 config:
97146 dir: '{{.InterfaceDir}}/mocks'
98- filename: mocks.go
147+ filename: '{{ .InterfaceFile | base }}'
99148 pkgname: mocks
100149 interfaces:
101150 ContentWhitelistRepository: {}
@@ -109,7 +158,7 @@ packages:
109158 github.com/bnema/dumber/internal/infrastructure/filtering:
110159 config:
111160 dir: '{{.InterfaceDir}}/mocks'
112- filename: mocks.go
161+ filename: '{{ .InterfaceFile | base }}'
113162 pkgname: mocks
114163 interfaces:
115164 FilterDownloader: {}
@@ -117,7 +166,7 @@ packages:
117166 github.com/bnema/dumber/internal/ui/layout:
118167 config:
119168 dir: '{{.InterfaceDir}}/mocks'
120- filename: mocks.go
169+ filename: '{{ .InterfaceFile | base }}'
121170 pkgname: mocks
122171 interfaces:
123172 BoxWidget: {}
@@ -132,3 +181,19 @@ packages:
132181 SpinnerWidget: {}
133182 Widget: {}
134183 WidgetFactory: {}
184+ github.com/bnema/dumber/internal/ui/coordinator:
185+ config:
186+ dir: '{{.InterfaceDir}}/mocks'
187+ filename: '{{ .InterfaceFile | base }}'
188+ pkgname: mocks
189+ interfaces:
190+ OmniboxProvider: {}
191+ github.com/bnema/dumber/internal/ui/dialog:
192+ config:
193+ dir: '{{.InterfaceDir}}/mocks'
194+ filename: '{{ .InterfaceFile | base }}'
195+ pkgname: mocks
196+ interfaces:
197+ permissionPopup:
198+ config:
199+ structname: MockPermissionPopup
M cmd/dumber/main.go +3 -16
@@ -865,10 +865,11 @@ func buildUIDependencies(
865865
866866 focusProvider := textinput.NewFocusProvider()
867867 browserLauncher := desktop.NewBrowserLauncher(browserLaunchRelay)
868+ runtimeConfig := bootstrap.NewRuntimeConfigProvider(cfg, config.GetManager())
868869
869870 uiDeps := &ui.Dependencies{
870871 Ctx: ctx,
871- Config: cfg,
872+ RuntimeConfig: runtimeConfig,
872873 InitialURL: initialURL,
873874 RestoreSessionID: restoreSessionID,
874875 StartupCrashReports: startupCrashReports,
@@ -922,26 +923,12 @@ func buildUIDependencies(
922923 NewGTKEntryTarget: func(entry *gtk.SearchEntry) port.TextInputTarget {
923924 return textinput.NewGTKEntryTarget(entry)
924925 },
925- OnConfigChange: func(callback func()) {
926- config.GetManager().OnConfigChange(func(newCfg *config.Config) {
927- // No synchronization needed: viper fires this callback on the
928- // GTK main thread (via glib.IdleAdd), and all callers of cfg run
929- // on the same GTK main thread, so there is no concurrent access.
930- if cfg != nil && newCfg != nil {
931- *cfg = *newCfg
932- }
933- callback()
934- })
935- },
936- WatchConfig: func() error {
937- return config.GetManager().Watch()
938- },
939926 LaunchExternalURL: desktop.LaunchExternalURL,
940927 LaunchBrowserURL: func(navCtx context.Context, uri string) error {
941928 return launchStandaloneBrowserURL(navCtx, browserLauncher.LaunchURL, uri)
942929 },
943930 BrowserLaunchRelay: browserLaunchRelay,
944- ConfigMigrator: config.NewMigrator(),
931+ MigrationChecker: config.NewMigrator(),
945932 HandlerDeps: *handlerDeps,
946933 }
947934
M cmd/systemviews/bootstrap_test.go +45 -45
@@ -17,8 +17,8 @@ import (
1717 func TestNewBridgeApp_WiresHistoryService(t *testing.T) {
1818 t.Parallel()
1919
20- bridge := &fakeBridgeService{historyEntries: []*entity.HistoryEntry{{Title: "Example", URL: "https://example.com"}}}
21- app := newBridgeApp(&fakeDOM{}, "dumb://history", bridge)
20+ bridge := &bridgeServiceRecorder{historyEntries: []*entity.HistoryEntry{{Title: "Example", URL: "https://example.com"}}}
21+ app := newBridgeApp(&recordingDOM{}, "dumb://history", bridge)
2222
2323 require.NoError(t, app.LoadInitial(context.Background()))
2424 assert.True(t, bridge.calledHistory.Load())
@@ -30,7 +30,7 @@ func TestNewBridgeApp_WiresHistoryService(t *testing.T) {
3030 func TestNewBridgeApp_UsesCurrentConfigForNonConfigRoutes(t *testing.T) {
3131 t.Parallel()
3232
33- bridge := &fakeBridgeService{
33+ bridge := &bridgeServiceRecorder{
3434 historyEntries: []*entity.HistoryEntry{{Title: "Example", URL: "https://example.com"}},
3535 currentConfig: dto.SystemviewConfigPayload{
3636 Appearance: dto.WebUIAppearanceConfig{
@@ -47,7 +47,7 @@ func TestNewBridgeApp_UsesCurrentConfigForNonConfigRoutes(t *testing.T) {
4747 },
4848 },
4949 }
50- dom := &fakeDOM{mounts: make(chan string, 4)}
50+ dom := &recordingDOM{mounts: make(chan string, 4)}
5151 app := newBridgeApp(dom, "dumb://history", bridge)
5252
5353 require.NoError(t, app.Run())
@@ -62,12 +62,12 @@ func TestNewBridgeApp_UsesCurrentConfigForNonConfigRoutes(t *testing.T) {
6262 func TestNewBridgeApp_WiresFavoritesService(t *testing.T) {
6363 t.Parallel()
6464
65- bridge := &fakeBridgeService{
65+ bridge := &bridgeServiceRecorder{
6666 favorites: []*entity.Favorite{{Title: "Example", URL: "https://example.com"}},
6767 folders: []*entity.Folder{{Name: "Read Later"}},
6868 tags: []*entity.Tag{{Name: "Go"}},
6969 }
70- app := newBridgeApp(&fakeDOM{}, "dumb://favorites", bridge)
70+ app := newBridgeApp(&recordingDOM{}, "dumb://favorites", bridge)
7171
7272 require.NoError(t, app.LoadInitial(context.Background()))
7373 assert.False(t, bridge.calledHistory.Load())
@@ -79,11 +79,11 @@ func TestNewBridgeApp_WiresFavoritesService(t *testing.T) {
7979 func TestNewBridgeApp_WiresConfigService(t *testing.T) {
8080 t.Parallel()
8181
82- bridge := &fakeBridgeService{
82+ bridge := &bridgeServiceRecorder{
8383 currentConfig: dto.SystemviewConfigPayload{EngineType: "webkit"},
8484 keybindings: port.KeybindingsConfig{Groups: []port.KeybindingGroup{{DisplayName: "Default"}}},
8585 }
86- app := newBridgeApp(&fakeDOM{}, "dumb://config", bridge)
86+ app := newBridgeApp(&recordingDOM{}, "dumb://config", bridge)
8787
8888 require.NoError(t, app.LoadInitial(context.Background()))
8989 assert.False(t, bridge.calledHistory.Load())
@@ -92,12 +92,12 @@ func TestNewBridgeApp_WiresConfigService(t *testing.T) {
9292 assert.True(t, bridge.calledKeybindings.Load())
9393 }
9494
95-type fakeDOM struct {
95+type recordingDOM struct {
9696 html string
9797 mounts chan string
9898 }
9999
100-func (f *fakeDOM) Mount(html string) error {
100+func (f *recordingDOM) Mount(html string) error {
101101 f.html = html
102102 if f.mounts != nil {
103103 select {
@@ -131,9 +131,9 @@ func receiveMountContaining(t *testing.T, mounts <-chan string, values ...string
131131 }
132132 }
133133
134-// Handwritten fake intentionally tracks state across history, favorites, config,
134+// Recording fixture intentionally tracks state across history, favorites, config,
135135 // and keybindings boundaries for the composite bootstrap assertions.
136-type fakeBridgeService struct {
136+type bridgeServiceRecorder struct {
137137 calledHistory atomic.Bool
138138 calledFavorites atomic.Bool
139139 calledConfig atomic.Bool
@@ -147,112 +147,112 @@ type fakeBridgeService struct {
147147 keybindings port.KeybindingsConfig
148148 }
149149
150-func (f *fakeBridgeService) Timeline(context.Context, int, int) ([]*entity.HistoryEntry, error) {
150+func (f *bridgeServiceRecorder) Timeline(context.Context, int, int) ([]*entity.HistoryEntry, error) {
151151 f.calledHistory.Store(true)
152152 return f.historyEntries, nil
153153 }
154154
155-func (f *fakeBridgeService) TimelineByDomain(context.Context, string, int, int) ([]*entity.HistoryEntry, error) {
155+func (f *bridgeServiceRecorder) TimelineByDomain(context.Context, string, int, int) ([]*entity.HistoryEntry, error) {
156156 f.calledHistory.Store(true)
157157 return f.historyEntries, nil
158158 }
159159
160-func (f *fakeBridgeService) TimelineWindow(_ context.Context, before time.Time, _ string) (*entity.HistoryWindow, error) {
160+func (f *bridgeServiceRecorder) TimelineWindow(_ context.Context, before time.Time, _ string) (*entity.HistoryWindow, error) {
161161 f.calledHistory.Store(true)
162162 return &entity.HistoryWindow{Entries: f.historyEntries, Before: before, After: before.Add(-24 * time.Hour)}, nil
163163 }
164164
165-func (*fakeBridgeService) Search(context.Context, string, int) ([]*entity.HistoryEntry, error) {
165+func (*bridgeServiceRecorder) Search(context.Context, string, int) ([]*entity.HistoryEntry, error) {
166166 return nil, nil
167167 }
168168
169-func (*fakeBridgeService) DeleteEntry(context.Context, int64) error { return nil }
169+func (*bridgeServiceRecorder) DeleteEntry(context.Context, int64) error { return nil }
170170
171-func (*fakeBridgeService) DeleteRange(context.Context, string) error { return nil }
171+func (*bridgeServiceRecorder) DeleteRange(context.Context, string) error { return nil }
172172
173-func (*fakeBridgeService) Stats(context.Context) (*entity.HistoryStats, error) {
173+func (*bridgeServiceRecorder) Stats(context.Context) (*entity.HistoryStats, error) {
174174 return nil, nil
175175 }
176176
177-func (*fakeBridgeService) Analytics(context.Context) (*entity.HistoryAnalytics, error) {
177+func (*bridgeServiceRecorder) Analytics(context.Context) (*entity.HistoryAnalytics, error) {
178178 return nil, nil
179179 }
180180
181-func (*fakeBridgeService) DomainStats(context.Context, int) ([]*entity.DomainStat, error) {
181+func (*bridgeServiceRecorder) DomainStats(context.Context, int) ([]*entity.DomainStat, error) {
182182 return nil, nil
183183 }
184184
185-func (*fakeBridgeService) DeleteDomain(context.Context, string) error { return nil }
185+func (*bridgeServiceRecorder) DeleteDomain(context.Context, string) error { return nil }
186186
187-func (f *fakeBridgeService) List(context.Context) ([]*entity.Favorite, error) {
187+func (f *bridgeServiceRecorder) List(context.Context) ([]*entity.Favorite, error) {
188188 f.calledFavorites.Store(true)
189189 return f.favorites, nil
190190 }
191191
192-func (*fakeBridgeService) CreateFavorite(context.Context, dto.FavoriteCreateInput) (*entity.Favorite, error) {
192+func (*bridgeServiceRecorder) CreateFavorite(context.Context, dto.FavoriteCreateInput) (*entity.Favorite, error) {
193193 return nil, nil
194194 }
195195
196-func (*fakeBridgeService) UpdateFavorite(context.Context, dto.FavoriteUpdateInput) (*entity.Favorite, error) {
196+func (*bridgeServiceRecorder) UpdateFavorite(context.Context, dto.FavoriteUpdateInput) (*entity.Favorite, error) {
197197 return nil, nil
198198 }
199199
200-func (*fakeBridgeService) DeleteFavorite(context.Context, int64) error { return nil }
200+func (*bridgeServiceRecorder) DeleteFavorite(context.Context, int64) error { return nil }
201201
202-func (f *fakeBridgeService) ListFolders(context.Context) ([]*entity.Folder, error) {
202+func (f *bridgeServiceRecorder) ListFolders(context.Context) ([]*entity.Folder, error) {
203203 return f.folders, nil
204204 }
205205
206-func (f *fakeBridgeService) ListTags(context.Context) ([]*entity.Tag, error) {
206+func (f *bridgeServiceRecorder) ListTags(context.Context) ([]*entity.Tag, error) {
207207 return f.tags, nil
208208 }
209209
210-func (*fakeBridgeService) SetShortcut(context.Context, int64, *int) error { return nil }
210+func (*bridgeServiceRecorder) SetShortcut(context.Context, int64, *int) error { return nil }
211211
212-func (*fakeBridgeService) SetFolder(context.Context, int64, *int64) error { return nil }
212+func (*bridgeServiceRecorder) SetFolder(context.Context, int64, *int64) error { return nil }
213213
214-func (*fakeBridgeService) CreateFolder(context.Context, string, string, *int64) (*entity.Folder, error) {
214+func (*bridgeServiceRecorder) CreateFolder(context.Context, string, string, *int64) (*entity.Folder, error) {
215215 return nil, nil
216216 }
217217
218-func (*fakeBridgeService) UpdateFolder(context.Context, int64, string, string) error { return nil }
218+func (*bridgeServiceRecorder) UpdateFolder(context.Context, int64, string, string) error { return nil }
219219
220-func (*fakeBridgeService) DeleteFolder(context.Context, int64) error { return nil }
220+func (*bridgeServiceRecorder) DeleteFolder(context.Context, int64) error { return nil }
221221
222-func (*fakeBridgeService) CreateTag(context.Context, string, string) (*entity.Tag, error) {
222+func (*bridgeServiceRecorder) CreateTag(context.Context, string, string) (*entity.Tag, error) {
223223 return nil, nil
224224 }
225225
226-func (*fakeBridgeService) UpdateTag(context.Context, int64, string, string) error { return nil }
226+func (*bridgeServiceRecorder) UpdateTag(context.Context, int64, string, string) error { return nil }
227227
228-func (*fakeBridgeService) DeleteTag(context.Context, int64) error { return nil }
228+func (*bridgeServiceRecorder) DeleteTag(context.Context, int64) error { return nil }
229229
230-func (*fakeBridgeService) AssignTag(context.Context, int64, int64) error { return nil }
230+func (*bridgeServiceRecorder) AssignTag(context.Context, int64, int64) error { return nil }
231231
232-func (*fakeBridgeService) RemoveTag(context.Context, int64, int64) error { return nil }
232+func (*bridgeServiceRecorder) RemoveTag(context.Context, int64, int64) error { return nil }
233233
234-func (f *fakeBridgeService) Current(context.Context) (dto.SystemviewConfigPayload, error) {
234+func (f *bridgeServiceRecorder) Current(context.Context) (dto.SystemviewConfigPayload, error) {
235235 f.calledConfig.Store(true)
236236 return f.currentConfig, nil
237237 }
238238
239-func (*fakeBridgeService) Default(context.Context) (dto.SystemviewConfigPayload, error) {
239+func (*bridgeServiceRecorder) Default(context.Context) (dto.SystemviewConfigPayload, error) {
240240 return dto.SystemviewConfigPayload{}, nil
241241 }
242242
243-func (*fakeBridgeService) Save(context.Context, dto.WebUIConfig) error { return nil }
243+func (*bridgeServiceRecorder) Save(context.Context, dto.WebUIConfig) error { return nil }
244244
245-func (f *fakeBridgeService) GetKeybindings(context.Context) (port.KeybindingsConfig, error) {
245+func (f *bridgeServiceRecorder) GetKeybindings(context.Context) (port.KeybindingsConfig, error) {
246246 f.calledKeybindings.Store(true)
247247 return f.keybindings, nil
248248 }
249249
250-func (*fakeBridgeService) SetKeybinding(context.Context, port.SetKeybindingRequest) (port.SetKeybindingResponse, error) {
250+func (*bridgeServiceRecorder) SetKeybinding(context.Context, port.SetKeybindingRequest) (port.SetKeybindingResponse, error) {
251251 return port.SetKeybindingResponse{}, nil
252252 }
253253
254-func (*fakeBridgeService) ResetKeybinding(context.Context, port.ResetKeybindingRequest) error {
254+func (*bridgeServiceRecorder) ResetKeybinding(context.Context, port.ResetKeybindingRequest) error {
255255 return nil
256256 }
257257
258-func (*fakeBridgeService) ResetAllKeybindings(context.Context) error { return nil }
258+func (*bridgeServiceRecorder) ResetAllKeybindings(context.Context) error { return nil }
M internal/application/port/engine.go +3 -19
@@ -6,6 +6,8 @@ package port
66 import (
77 "context"
88 "encoding/json"
9+
10+ "github.com/bnema/dumber/internal/domain/entity"
911 )
1012
1113 // CookiePolicy controls cookie acceptance behavior for the engine's network session.
@@ -136,30 +138,12 @@ type Engine interface {
136138 UpdateAppearance(ctx context.Context, r, g, b, alpha float64) error
137139
138140 // UpdateSettings applies runtime config changes to engine internals.
139- UpdateSettings(ctx context.Context, update EngineSettingsUpdate) error
141+ UpdateSettings(ctx context.Context, update entity.EngineSettingsUpdate) error
140142
141143 // SetHandlerContext sets the base context for message handler dispatch.
142144 SetHandlerContext(ctx context.Context)
143145 }
144146
145-// EngineSettingsPayload is the engine-facing boundary view of runtime config.
146-// Add fields here only when an engine needs to react to them at runtime.
147-type EngineSettingsPayload struct {
148- DefaultUIScale float64
149-}
150-
151-// EngineSettingsUpdate carries a runtime config change to the engine.
152-//
153-// Settings exposes the typed boundary payload that engine adapters should prefer.
154-// Raw remains for legacy adapters that still consume implementation-specific
155-// config until their settings managers are narrowed to boundary fields.
156-type EngineSettingsUpdate struct {
157- Settings EngineSettingsPayload
158- // Raw holds the implementation-specific config for legacy adapters.
159- // WebKit engine currently expects *infrastructure/config.Config.
160- Raw any //nolint:iface // intentional legacy bridge; prefer Settings for new code
161-}
162-
163147 // WebUIMessageHandler handles a decoded message payload from the JS bridge.
164148 // Used by both WebKit and CEF message routers via the shared handlers package.
165149 type WebUIMessageHandler interface {
A internal/application/port/mocks/accent_picker.go +165 -0
@@ -0,0 +1,165 @@
1+// Code generated by mockery; DO NOT EDIT.
2+// github.com/vektra/mockery
3+// template: testify
4+
5+package mocks
6+
7+import (
8+ mock "github.com/stretchr/testify/mock"
9+)
10+
11+// NewMockAccentPickerUI creates a new instance of MockAccentPickerUI. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
12+// The first argument is typically a *testing.T value.
13+func NewMockAccentPickerUI(t interface {
14+ mock.TestingT
15+ Cleanup(func())
16+}) *MockAccentPickerUI {
17+ mock := &MockAccentPickerUI{}
18+ mock.Mock.Test(t)
19+
20+ t.Cleanup(func() { mock.AssertExpectations(t) })
21+
22+ return mock
23+}
24+
25+// MockAccentPickerUI is an autogenerated mock type for the AccentPickerUI type
26+type MockAccentPickerUI struct {
27+ mock.Mock
28+}
29+
30+type MockAccentPickerUI_Expecter struct {
31+ mock *mock.Mock
32+}
33+
34+func (_m *MockAccentPickerUI) EXPECT() *MockAccentPickerUI_Expecter {
35+ return &MockAccentPickerUI_Expecter{mock: &_m.Mock}
36+}
37+
38+// Hide provides a mock function for the type MockAccentPickerUI
39+func (_mock *MockAccentPickerUI) Hide() {
40+ _mock.Called()
41+ return
42+}
43+
44+// MockAccentPickerUI_Hide_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Hide'
45+type MockAccentPickerUI_Hide_Call struct {
46+ *mock.Call
47+}
48+
49+// Hide is a helper method to define mock.On call
50+func (_e *MockAccentPickerUI_Expecter) Hide() *MockAccentPickerUI_Hide_Call {
51+ return &MockAccentPickerUI_Hide_Call{Call: _e.mock.On("Hide")}
52+}
53+
54+func (_c *MockAccentPickerUI_Hide_Call) Run(run func()) *MockAccentPickerUI_Hide_Call {
55+ _c.Call.Run(func(args mock.Arguments) {
56+ run()
57+ })
58+ return _c
59+}
60+
61+func (_c *MockAccentPickerUI_Hide_Call) Return() *MockAccentPickerUI_Hide_Call {
62+ _c.Call.Return()
63+ return _c
64+}
65+
66+func (_c *MockAccentPickerUI_Hide_Call) RunAndReturn(run func()) *MockAccentPickerUI_Hide_Call {
67+ _c.Run(run)
68+ return _c
69+}
70+
71+// IsVisible provides a mock function for the type MockAccentPickerUI
72+func (_mock *MockAccentPickerUI) IsVisible() bool {
73+ ret := _mock.Called()
74+
75+ if len(ret) == 0 {
76+ panic("no return value specified for IsVisible")
77+ }
78+
79+ var r0 bool
80+ if returnFunc, ok := ret.Get(0).(func() bool); ok {
81+ r0 = returnFunc()
82+ } else {
83+ r0 = ret.Get(0).(bool)
84+ }
85+ return r0
86+}
87+
88+// MockAccentPickerUI_IsVisible_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'IsVisible'
89+type MockAccentPickerUI_IsVisible_Call struct {
90+ *mock.Call
91+}
92+
93+// IsVisible is a helper method to define mock.On call
94+func (_e *MockAccentPickerUI_Expecter) IsVisible() *MockAccentPickerUI_IsVisible_Call {
95+ return &MockAccentPickerUI_IsVisible_Call{Call: _e.mock.On("IsVisible")}
96+}
97+
98+func (_c *MockAccentPickerUI_IsVisible_Call) Run(run func()) *MockAccentPickerUI_IsVisible_Call {
99+ _c.Call.Run(func(args mock.Arguments) {
100+ run()
101+ })
102+ return _c
103+}
104+
105+func (_c *MockAccentPickerUI_IsVisible_Call) Return(b bool) *MockAccentPickerUI_IsVisible_Call {
106+ _c.Call.Return(b)
107+ return _c
108+}
109+
110+func (_c *MockAccentPickerUI_IsVisible_Call) RunAndReturn(run func() bool) *MockAccentPickerUI_IsVisible_Call {
111+ _c.Call.Return(run)
112+ return _c
113+}
114+
115+// Show provides a mock function for the type MockAccentPickerUI
116+func (_mock *MockAccentPickerUI) Show(accents []rune, selectedCallback func(accent rune), cancelCallback func()) {
117+ _mock.Called(accents, selectedCallback, cancelCallback)
118+ return
119+}
120+
121+// MockAccentPickerUI_Show_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Show'
122+type MockAccentPickerUI_Show_Call struct {
123+ *mock.Call
124+}
125+
126+// Show is a helper method to define mock.On call
127+// - accents []rune
128+// - selectedCallback func(accent rune)
129+// - cancelCallback func()
130+func (_e *MockAccentPickerUI_Expecter) Show(accents any, selectedCallback any, cancelCallback any) *MockAccentPickerUI_Show_Call {
131+ return &MockAccentPickerUI_Show_Call{Call: _e.mock.On("Show", accents, selectedCallback, cancelCallback)}
132+}
133+
134+func (_c *MockAccentPickerUI_Show_Call) Run(run func(accents []rune, selectedCallback func(accent rune), cancelCallback func())) *MockAccentPickerUI_Show_Call {
135+ _c.Call.Run(func(args mock.Arguments) {
136+ var arg0 []rune
137+ if args[0] != nil {
138+ arg0 = args[0].([]rune)
139+ }
140+ var arg1 func(accent rune)
141+ if args[1] != nil {
142+ arg1 = args[1].(func(accent rune))
143+ }
144+ var arg2 func()
145+ if args[2] != nil {
146+ arg2 = args[2].(func())
147+ }
148+ run(
149+ arg0,
150+ arg1,
151+ arg2,
152+ )
153+ })
154+ return _c
155+}
156+
157+func (_c *MockAccentPickerUI_Show_Call) Return() *MockAccentPickerUI_Show_Call {
158+ _c.Call.Return()
159+ return _c
160+}
161+
162+func (_c *MockAccentPickerUI_Show_Call) RunAndReturn(run func(accents []rune, selectedCallback func(accent rune), cancelCallback func())) *MockAccentPickerUI_Show_Call {
163+ _c.Run(run)
164+ return _c
165+}
A internal/application/port/mocks/browser_launch.go +258 -0
@@ -0,0 +1,258 @@
1+// Code generated by mockery; DO NOT EDIT.
2+// github.com/vektra/mockery
3+// template: testify
4+
5+package mocks
6+
7+import (
8+ "context"
9+ "io"
10+
11+ "github.com/bnema/dumber/internal/application/port"
12+ mock "github.com/stretchr/testify/mock"
13+)
14+
15+// NewMockBrowserWindowOpener creates a new instance of MockBrowserWindowOpener. 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.
17+func NewMockBrowserWindowOpener(t interface {
18+ mock.TestingT
19+ Cleanup(func())
20+}) *MockBrowserWindowOpener {
21+ mock := &MockBrowserWindowOpener{}
22+ mock.Mock.Test(t)
23+
24+ t.Cleanup(func() { mock.AssertExpectations(t) })
25+
26+ return mock
27+}
28+
29+// MockBrowserWindowOpener is an autogenerated mock type for the BrowserWindowOpener type
30+type MockBrowserWindowOpener struct {
31+ mock.Mock
32+}
33+
34+type MockBrowserWindowOpener_Expecter struct {
35+ mock *mock.Mock
36+}
37+
38+func (_m *MockBrowserWindowOpener) EXPECT() *MockBrowserWindowOpener_Expecter {
39+ return &MockBrowserWindowOpener_Expecter{mock: &_m.Mock}
40+}
41+
42+// OpenFreshWindow provides a mock function for the type MockBrowserWindowOpener
43+func (_mock *MockBrowserWindowOpener) OpenFreshWindow(ctx context.Context, url string) error {
44+ ret := _mock.Called(ctx, url)
45+
46+ if len(ret) == 0 {
47+ panic("no return value specified for OpenFreshWindow")
48+ }
49+
50+ var r0 error
51+ if returnFunc, ok := ret.Get(0).(func(context.Context, string) error); ok {
52+ r0 = returnFunc(ctx, url)
53+ } else {
54+ r0 = ret.Error(0)
55+ }
56+ return r0
57+}
58+
59+// MockBrowserWindowOpener_OpenFreshWindow_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'OpenFreshWindow'
60+type MockBrowserWindowOpener_OpenFreshWindow_Call struct {
61+ *mock.Call
62+}
63+
64+// OpenFreshWindow is a helper method to define mock.On call
65+// - ctx context.Context
66+// - url string
67+func (_e *MockBrowserWindowOpener_Expecter) OpenFreshWindow(ctx any, url any) *MockBrowserWindowOpener_OpenFreshWindow_Call {
68+ return &MockBrowserWindowOpener_OpenFreshWindow_Call{Call: _e.mock.On("OpenFreshWindow", ctx, url)}
69+}
70+
71+func (_c *MockBrowserWindowOpener_OpenFreshWindow_Call) Run(run func(ctx context.Context, url string)) *MockBrowserWindowOpener_OpenFreshWindow_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 string
78+ if args[1] != nil {
79+ arg1 = args[1].(string)
80+ }
81+ run(
82+ arg0,
83+ arg1,
84+ )
85+ })
86+ return _c
87+}
88+
89+func (_c *MockBrowserWindowOpener_OpenFreshWindow_Call) Return(err error) *MockBrowserWindowOpener_OpenFreshWindow_Call {
90+ _c.Call.Return(err)
91+ return _c
92+}
93+
94+func (_c *MockBrowserWindowOpener_OpenFreshWindow_Call) RunAndReturn(run func(ctx context.Context, url string) error) *MockBrowserWindowOpener_OpenFreshWindow_Call {
95+ _c.Call.Return(run)
96+ return _c
97+}
98+
99+// NewMockBrowserLaunchRelay creates a new instance of MockBrowserLaunchRelay. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
100+// The first argument is typically a *testing.T value.
101+func NewMockBrowserLaunchRelay(t interface {
102+ mock.TestingT
103+ Cleanup(func())
104+}) *MockBrowserLaunchRelay {
105+ mock := &MockBrowserLaunchRelay{}
106+ mock.Mock.Test(t)
107+
108+ t.Cleanup(func() { mock.AssertExpectations(t) })
109+
110+ return mock
111+}
112+
113+// MockBrowserLaunchRelay is an autogenerated mock type for the BrowserLaunchRelay type
114+type MockBrowserLaunchRelay struct {
115+ mock.Mock
116+}
117+
118+type MockBrowserLaunchRelay_Expecter struct {
119+ mock *mock.Mock
120+}
121+
122+func (_m *MockBrowserLaunchRelay) EXPECT() *MockBrowserLaunchRelay_Expecter {
123+ return &MockBrowserLaunchRelay_Expecter{mock: &_m.Mock}
124+}
125+
126+// DeliverOpenFreshWindow provides a mock function for the type MockBrowserLaunchRelay
127+func (_mock *MockBrowserLaunchRelay) DeliverOpenFreshWindow(ctx context.Context, url string) (bool, error) {
128+ ret := _mock.Called(ctx, url)
129+
130+ if len(ret) == 0 {
131+ panic("no return value specified for DeliverOpenFreshWindow")
132+ }
133+
134+ var r0 bool
135+ var r1 error
136+ if returnFunc, ok := ret.Get(0).(func(context.Context, string) (bool, error)); ok {
137+ return returnFunc(ctx, url)
138+ }
139+ if returnFunc, ok := ret.Get(0).(func(context.Context, string) bool); ok {
140+ r0 = returnFunc(ctx, url)
141+ } else {
142+ r0 = ret.Get(0).(bool)
143+ }
144+ if returnFunc, ok := ret.Get(1).(func(context.Context, string) error); ok {
145+ r1 = returnFunc(ctx, url)
146+ } else {
147+ r1 = ret.Error(1)
148+ }
149+ return r0, r1
150+}
151+
152+// MockBrowserLaunchRelay_DeliverOpenFreshWindow_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'DeliverOpenFreshWindow'
153+type MockBrowserLaunchRelay_DeliverOpenFreshWindow_Call struct {
154+ *mock.Call
155+}
156+
157+// DeliverOpenFreshWindow is a helper method to define mock.On call
158+// - ctx context.Context
159+// - url string
160+func (_e *MockBrowserLaunchRelay_Expecter) DeliverOpenFreshWindow(ctx any, url any) *MockBrowserLaunchRelay_DeliverOpenFreshWindow_Call {
161+ return &MockBrowserLaunchRelay_DeliverOpenFreshWindow_Call{Call: _e.mock.On("DeliverOpenFreshWindow", ctx, url)}
162+}
163+
164+func (_c *MockBrowserLaunchRelay_DeliverOpenFreshWindow_Call) Run(run func(ctx context.Context, url string)) *MockBrowserLaunchRelay_DeliverOpenFreshWindow_Call {
165+ _c.Call.Run(func(args mock.Arguments) {
166+ var arg0 context.Context
167+ if args[0] != nil {
168+ arg0 = args[0].(context.Context)
169+ }
170+ var arg1 string
171+ if args[1] != nil {
172+ arg1 = args[1].(string)
173+ }
174+ run(
175+ arg0,
176+ arg1,
177+ )
178+ })
179+ return _c
180+}
181+
182+func (_c *MockBrowserLaunchRelay_DeliverOpenFreshWindow_Call) Return(b bool, err error) *MockBrowserLaunchRelay_DeliverOpenFreshWindow_Call {
183+ _c.Call.Return(b, err)
184+ return _c
185+}
186+
187+func (_c *MockBrowserLaunchRelay_DeliverOpenFreshWindow_Call) RunAndReturn(run func(ctx context.Context, url string) (bool, error)) *MockBrowserLaunchRelay_DeliverOpenFreshWindow_Call {
188+ _c.Call.Return(run)
189+ return _c
190+}
191+
192+// Listen provides a mock function for the type MockBrowserLaunchRelay
193+func (_mock *MockBrowserLaunchRelay) Listen(ctx context.Context, opener port.BrowserWindowOpener) (io.Closer, error) {
194+ ret := _mock.Called(ctx, opener)
195+
196+ if len(ret) == 0 {
197+ panic("no return value specified for Listen")
198+ }
199+
200+ var r0 io.Closer
201+ var r1 error
202+ if returnFunc, ok := ret.Get(0).(func(context.Context, port.BrowserWindowOpener) (io.Closer, error)); ok {
203+ return returnFunc(ctx, opener)
204+ }
205+ if returnFunc, ok := ret.Get(0).(func(context.Context, port.BrowserWindowOpener) io.Closer); ok {
206+ r0 = returnFunc(ctx, opener)
207+ } else {
208+ if ret.Get(0) != nil {
209+ r0 = ret.Get(0).(io.Closer)
210+ }
211+ }
212+ if returnFunc, ok := ret.Get(1).(func(context.Context, port.BrowserWindowOpener) error); ok {
213+ r1 = returnFunc(ctx, opener)
214+ } else {
215+ r1 = ret.Error(1)
216+ }
217+ return r0, r1
218+}
219+
220+// MockBrowserLaunchRelay_Listen_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Listen'
221+type MockBrowserLaunchRelay_Listen_Call struct {
222+ *mock.Call
223+}
224+
225+// Listen is a helper method to define mock.On call
226+// - ctx context.Context
227+// - opener port.BrowserWindowOpener
228+func (_e *MockBrowserLaunchRelay_Expecter) Listen(ctx any, opener any) *MockBrowserLaunchRelay_Listen_Call {
229+ return &MockBrowserLaunchRelay_Listen_Call{Call: _e.mock.On("Listen", ctx, opener)}
230+}
231+
232+func (_c *MockBrowserLaunchRelay_Listen_Call) Run(run func(ctx context.Context, opener port.BrowserWindowOpener)) *MockBrowserLaunchRelay_Listen_Call {
233+ _c.Call.Run(func(args mock.Arguments) {
234+ var arg0 context.Context
235+ if args[0] != nil {
236+ arg0 = args[0].(context.Context)
237+ }
238+ var arg1 port.BrowserWindowOpener
239+ if args[1] != nil {
240+ arg1 = args[1].(port.BrowserWindowOpener)
241+ }
242+ run(
243+ arg0,
244+ arg1,
245+ )
246+ })
247+ return _c
248+}
249+
250+func (_c *MockBrowserLaunchRelay_Listen_Call) Return(closer io.Closer, err error) *MockBrowserLaunchRelay_Listen_Call {
251+ _c.Call.Return(closer, err)
252+ return _c
253+}
254+
255+func (_c *MockBrowserLaunchRelay_Listen_Call) RunAndReturn(run func(ctx context.Context, opener port.BrowserWindowOpener) (io.Closer, error)) *MockBrowserLaunchRelay_Listen_Call {
256+ _c.Call.Return(run)
257+ return _c
258+}
A internal/application/port/mocks/clipboard.go +324 -0
@@ -0,0 +1,324 @@
1+// Code generated by mockery; DO NOT EDIT.
2+// github.com/vektra/mockery
3+// template: testify
4+
5+package mocks
6+
7+import (
8+ "context"
9+
10+ "github.com/bnema/dumber/internal/domain/entity"
11+ mock "github.com/stretchr/testify/mock"
12+)
13+
14+// NewMockClipboard creates a new instance of MockClipboard. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
15+// The first argument is typically a *testing.T value.
16+func NewMockClipboard(t interface {
17+ mock.TestingT
18+ Cleanup(func())
19+}) *MockClipboard {
20+ mock := &MockClipboard{}
21+ mock.Mock.Test(t)
22+
23+ t.Cleanup(func() { mock.AssertExpectations(t) })
24+
25+ return mock
26+}
27+
28+// MockClipboard is an autogenerated mock type for the Clipboard type
29+type MockClipboard struct {
30+ mock.Mock
31+}
32+
33+type MockClipboard_Expecter struct {
34+ mock *mock.Mock
35+}
36+
37+func (_m *MockClipboard) EXPECT() *MockClipboard_Expecter {
38+ return &MockClipboard_Expecter{mock: &_m.Mock}
39+}
40+
41+// Clear provides a mock function for the type MockClipboard
42+func (_mock *MockClipboard) Clear(ctx context.Context) error {
43+ ret := _mock.Called(ctx)
44+
45+ if len(ret) == 0 {
46+ panic("no return value specified for Clear")
47+ }
48+
49+ var r0 error
50+ if returnFunc, ok := ret.Get(0).(func(context.Context) error); ok {
51+ r0 = returnFunc(ctx)
52+ } else {
53+ r0 = ret.Error(0)
54+ }
55+ return r0
56+}
57+
58+// MockClipboard_Clear_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Clear'
59+type MockClipboard_Clear_Call struct {
60+ *mock.Call
61+}
62+
63+// Clear is a helper method to define mock.On call
64+// - ctx context.Context
65+func (_e *MockClipboard_Expecter) Clear(ctx any) *MockClipboard_Clear_Call {
66+ return &MockClipboard_Clear_Call{Call: _e.mock.On("Clear", ctx)}
67+}
68+
69+func (_c *MockClipboard_Clear_Call) Run(run func(ctx context.Context)) *MockClipboard_Clear_Call {
70+ _c.Call.Run(func(args mock.Arguments) {
71+ var arg0 context.Context
72+ if args[0] != nil {
73+ arg0 = args[0].(context.Context)
74+ }
75+ run(
76+ arg0,
77+ )
78+ })
79+ return _c
80+}
81+
82+func (_c *MockClipboard_Clear_Call) Return(err error) *MockClipboard_Clear_Call {
83+ _c.Call.Return(err)
84+ return _c
85+}
86+
87+func (_c *MockClipboard_Clear_Call) RunAndReturn(run func(ctx context.Context) error) *MockClipboard_Clear_Call {
88+ _c.Call.Return(run)
89+ return _c
90+}
91+
92+// HasText provides a mock function for the type MockClipboard
93+func (_mock *MockClipboard) HasText(ctx context.Context) (bool, error) {
94+ ret := _mock.Called(ctx)
95+
96+ if len(ret) == 0 {
97+ panic("no return value specified for HasText")
98+ }
99+
100+ var r0 bool
101+ var r1 error
102+ if returnFunc, ok := ret.Get(0).(func(context.Context) (bool, error)); ok {
103+ return returnFunc(ctx)
104+ }
105+ if returnFunc, ok := ret.Get(0).(func(context.Context) bool); ok {
106+ r0 = returnFunc(ctx)
107+ } else {
108+ r0 = ret.Get(0).(bool)
109+ }
110+ if returnFunc, ok := ret.Get(1).(func(context.Context) error); ok {
111+ r1 = returnFunc(ctx)
112+ } else {
113+ r1 = ret.Error(1)
114+ }
115+ return r0, r1
116+}
117+
118+// MockClipboard_HasText_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'HasText'
119+type MockClipboard_HasText_Call struct {
120+ *mock.Call
121+}
122+
123+// HasText is a helper method to define mock.On call
124+// - ctx context.Context
125+func (_e *MockClipboard_Expecter) HasText(ctx any) *MockClipboard_HasText_Call {
126+ return &MockClipboard_HasText_Call{Call: _e.mock.On("HasText", ctx)}
127+}
128+
129+func (_c *MockClipboard_HasText_Call) Run(run func(ctx context.Context)) *MockClipboard_HasText_Call {
130+ _c.Call.Run(func(args mock.Arguments) {
131+ var arg0 context.Context
132+ if args[0] != nil {
133+ arg0 = args[0].(context.Context)
134+ }
135+ run(
136+ arg0,
137+ )
138+ })
139+ return _c
140+}
141+
142+func (_c *MockClipboard_HasText_Call) Return(b bool, err error) *MockClipboard_HasText_Call {
143+ _c.Call.Return(b, err)
144+ return _c
145+}
146+
147+func (_c *MockClipboard_HasText_Call) RunAndReturn(run func(ctx context.Context) (bool, error)) *MockClipboard_HasText_Call {
148+ _c.Call.Return(run)
149+ return _c
150+}
151+
152+// ReadText provides a mock function for the type MockClipboard
153+func (_mock *MockClipboard) ReadText(ctx context.Context) (string, error) {
154+ ret := _mock.Called(ctx)
155+
156+ if len(ret) == 0 {
157+ panic("no return value specified for ReadText")
158+ }
159+
160+ var r0 string
161+ var r1 error
162+ if returnFunc, ok := ret.Get(0).(func(context.Context) (string, error)); ok {
163+ return returnFunc(ctx)
164+ }
165+ if returnFunc, ok := ret.Get(0).(func(context.Context) string); ok {
166+ r0 = returnFunc(ctx)
167+ } else {
168+ r0 = ret.Get(0).(string)
169+ }
170+ if returnFunc, ok := ret.Get(1).(func(context.Context) error); ok {
171+ r1 = returnFunc(ctx)
172+ } else {
173+ r1 = ret.Error(1)
174+ }
175+ return r0, r1
176+}
177+
178+// MockClipboard_ReadText_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ReadText'
179+type MockClipboard_ReadText_Call struct {
180+ *mock.Call
181+}
182+
183+// ReadText is a helper method to define mock.On call
184+// - ctx context.Context
185+func (_e *MockClipboard_Expecter) ReadText(ctx any) *MockClipboard_ReadText_Call {
186+ return &MockClipboard_ReadText_Call{Call: _e.mock.On("ReadText", ctx)}
187+}
188+
189+func (_c *MockClipboard_ReadText_Call) Run(run func(ctx context.Context)) *MockClipboard_ReadText_Call {
190+ _c.Call.Run(func(args mock.Arguments) {
191+ var arg0 context.Context
192+ if args[0] != nil {
193+ arg0 = args[0].(context.Context)
194+ }
195+ run(
196+ arg0,
197+ )
198+ })
199+ return _c
200+}
201+
202+func (_c *MockClipboard_ReadText_Call) Return(s string, err error) *MockClipboard_ReadText_Call {
203+ _c.Call.Return(s, err)
204+ return _c
205+}
206+
207+func (_c *MockClipboard_ReadText_Call) RunAndReturn(run func(ctx context.Context) (string, error)) *MockClipboard_ReadText_Call {
208+ _c.Call.Return(run)
209+ return _c
210+}
211+
212+// WriteImage provides a mock function for the type MockClipboard
213+func (_mock *MockClipboard) WriteImage(ctx context.Context, image entity.ImageData) error {
214+ ret := _mock.Called(ctx, image)
215+
216+ if len(ret) == 0 {
217+ panic("no return value specified for WriteImage")
218+ }
219+
220+ var r0 error
221+ if returnFunc, ok := ret.Get(0).(func(context.Context, entity.ImageData) error); ok {
222+ r0 = returnFunc(ctx, image)
223+ } else {
224+ r0 = ret.Error(0)
225+ }
226+ return r0
227+}
228+
229+// MockClipboard_WriteImage_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'WriteImage'
230+type MockClipboard_WriteImage_Call struct {
231+ *mock.Call
232+}
233+
234+// WriteImage is a helper method to define mock.On call
235+// - ctx context.Context
236+// - image entity.ImageData
237+func (_e *MockClipboard_Expecter) WriteImage(ctx any, image any) *MockClipboard_WriteImage_Call {
238+ return &MockClipboard_WriteImage_Call{Call: _e.mock.On("WriteImage", ctx, image)}
239+}
240+
241+func (_c *MockClipboard_WriteImage_Call) Run(run func(ctx context.Context, image entity.ImageData)) *MockClipboard_WriteImage_Call {
242+ _c.Call.Run(func(args mock.Arguments) {
243+ var arg0 context.Context
244+ if args[0] != nil {
245+ arg0 = args[0].(context.Context)
246+ }
247+ var arg1 entity.ImageData
248+ if args[1] != nil {
249+ arg1 = args[1].(entity.ImageData)
250+ }
251+ run(
252+ arg0,
253+ arg1,
254+ )
255+ })
256+ return _c
257+}
258+
259+func (_c *MockClipboard_WriteImage_Call) Return(err error) *MockClipboard_WriteImage_Call {
260+ _c.Call.Return(err)
261+ return _c
262+}
263+
264+func (_c *MockClipboard_WriteImage_Call) RunAndReturn(run func(ctx context.Context, image entity.ImageData) error) *MockClipboard_WriteImage_Call {
265+ _c.Call.Return(run)
266+ return _c
267+}
268+
269+// WriteText provides a mock function for the type MockClipboard
270+func (_mock *MockClipboard) WriteText(ctx context.Context, text string) error {
271+ ret := _mock.Called(ctx, text)
272+
273+ if len(ret) == 0 {
274+ panic("no return value specified for WriteText")
275+ }
276+
277+ var r0 error
278+ if returnFunc, ok := ret.Get(0).(func(context.Context, string) error); ok {
279+ r0 = returnFunc(ctx, text)
280+ } else {
281+ r0 = ret.Error(0)
282+ }
283+ return r0
284+}
285+
286+// MockClipboard_WriteText_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'WriteText'
287+type MockClipboard_WriteText_Call struct {
288+ *mock.Call
289+}
290+
291+// WriteText is a helper method to define mock.On call
292+// - ctx context.Context
293+// - text string
294+func (_e *MockClipboard_Expecter) WriteText(ctx any, text any) *MockClipboard_WriteText_Call {
295+ return &MockClipboard_WriteText_Call{Call: _e.mock.On("WriteText", ctx, text)}
296+}
297+
298+func (_c *MockClipboard_WriteText_Call) Run(run func(ctx context.Context, text string)) *MockClipboard_WriteText_Call {
299+ _c.Call.Run(func(args mock.Arguments) {
300+ var arg0 context.Context
301+ if args[0] != nil {
302+ arg0 = args[0].(context.Context)
303+ }
304+ var arg1 string
305+ if args[1] != nil {
306+ arg1 = args[1].(string)
307+ }
308+ run(
309+ arg0,
310+ arg1,
311+ )
312+ })
313+ return _c
314+}
315+
316+func (_c *MockClipboard_WriteText_Call) Return(err error) *MockClipboard_WriteText_Call {
317+ _c.Call.Return(err)
318+ return _c
319+}
320+
321+func (_c *MockClipboard_WriteText_Call) RunAndReturn(run func(ctx context.Context, text string) error) *MockClipboard_WriteText_Call {
322+ _c.Call.Return(run)
323+ return _c
324+}
A internal/application/port/mocks/clipboard_events.go +153 -0
@@ -0,0 +1,153 @@
1+// Code generated by mockery; DO NOT EDIT.
2+// github.com/vektra/mockery
3+// template: testify
4+
5+package mocks
6+
7+import (
8+ "context"
9+
10+ "github.com/bnema/dumber/internal/application/dto"
11+ mock "github.com/stretchr/testify/mock"
12+)
13+
14+// NewMockClipboardTextOrchestrator creates a new instance of MockClipboardTextOrchestrator. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
15+// The first argument is typically a *testing.T value.
16+func NewMockClipboardTextOrchestrator(t interface {
17+ mock.TestingT
18+ Cleanup(func())
19+}) *MockClipboardTextOrchestrator {
20+ mock := &MockClipboardTextOrchestrator{}
21+ mock.Mock.Test(t)
22+
23+ t.Cleanup(func() { mock.AssertExpectations(t) })
24+
25+ return mock
26+}
27+
28+// MockClipboardTextOrchestrator is an autogenerated mock type for the ClipboardTextOrchestrator type
29+type MockClipboardTextOrchestrator struct {
30+ mock.Mock
31+}
32+
33+type MockClipboardTextOrchestrator_Expecter struct {
34+ mock *mock.Mock
35+}
36+
37+func (_m *MockClipboardTextOrchestrator) EXPECT() *MockClipboardTextOrchestrator_Expecter {
38+ return &MockClipboardTextOrchestrator_Expecter{mock: &_m.Mock}
39+}
40+
41+// HandleExplicitCopy provides a mock function for the type MockClipboardTextOrchestrator
42+func (_mock *MockClipboardTextOrchestrator) HandleExplicitCopy(ctx context.Context, input dto.ExplicitClipboardInput) error {
43+ ret := _mock.Called(ctx, input)
44+
45+ if len(ret) == 0 {
46+ panic("no return value specified for HandleExplicitCopy")
47+ }
48+
49+ var r0 error
50+ if returnFunc, ok := ret.Get(0).(func(context.Context, dto.ExplicitClipboardInput) error); ok {
51+ r0 = returnFunc(ctx, input)
52+ } else {
53+ r0 = ret.Error(0)
54+ }
55+ return r0
56+}
57+
58+// MockClipboardTextOrchestrator_HandleExplicitCopy_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'HandleExplicitCopy'
59+type MockClipboardTextOrchestrator_HandleExplicitCopy_Call struct {
60+ *mock.Call
61+}
62+
63+// HandleExplicitCopy is a helper method to define mock.On call
64+// - ctx context.Context
65+// - input dto.ExplicitClipboardInput
66+func (_e *MockClipboardTextOrchestrator_Expecter) HandleExplicitCopy(ctx any, input any) *MockClipboardTextOrchestrator_HandleExplicitCopy_Call {
67+ return &MockClipboardTextOrchestrator_HandleExplicitCopy_Call{Call: _e.mock.On("HandleExplicitCopy", ctx, input)}
68+}
69+
70+func (_c *MockClipboardTextOrchestrator_HandleExplicitCopy_Call) Run(run func(ctx context.Context, input dto.ExplicitClipboardInput)) *MockClipboardTextOrchestrator_HandleExplicitCopy_Call {
71+ _c.Call.Run(func(args mock.Arguments) {
72+ var arg0 context.Context
73+ if args[0] != nil {
74+ arg0 = args[0].(context.Context)
75+ }
76+ var arg1 dto.ExplicitClipboardInput
77+ if args[1] != nil {
78+ arg1 = args[1].(dto.ExplicitClipboardInput)
79+ }
80+ run(
81+ arg0,
82+ arg1,
83+ )
84+ })
85+ return _c
86+}
87+
88+func (_c *MockClipboardTextOrchestrator_HandleExplicitCopy_Call) Return(err error) *MockClipboardTextOrchestrator_HandleExplicitCopy_Call {
89+ _c.Call.Return(err)
90+ return _c
91+}
92+
93+func (_c *MockClipboardTextOrchestrator_HandleExplicitCopy_Call) RunAndReturn(run func(ctx context.Context, input dto.ExplicitClipboardInput) error) *MockClipboardTextOrchestrator_HandleExplicitCopy_Call {
94+ _c.Call.Return(run)
95+ return _c
96+}
97+
98+// HandleSelectionUpdate provides a mock function for the type MockClipboardTextOrchestrator
99+func (_mock *MockClipboardTextOrchestrator) HandleSelectionUpdate(ctx context.Context, input dto.SelectionClipboardInput) error {
100+ ret := _mock.Called(ctx, input)
101+
102+ if len(ret) == 0 {
103+ panic("no return value specified for HandleSelectionUpdate")
104+ }
105+
106+ var r0 error
107+ if returnFunc, ok := ret.Get(0).(func(context.Context, dto.SelectionClipboardInput) error); ok {
108+ r0 = returnFunc(ctx, input)
109+ } else {
110+ r0 = ret.Error(0)
111+ }
112+ return r0
113+}
114+
115+// MockClipboardTextOrchestrator_HandleSelectionUpdate_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'HandleSelectionUpdate'
116+type MockClipboardTextOrchestrator_HandleSelectionUpdate_Call struct {
117+ *mock.Call
118+}
119+
120+// HandleSelectionUpdate is a helper method to define mock.On call
121+// - ctx context.Context
122+// - input dto.SelectionClipboardInput
123+func (_e *MockClipboardTextOrchestrator_Expecter) HandleSelectionUpdate(ctx any, input any) *MockClipboardTextOrchestrator_HandleSelectionUpdate_Call {
124+ return &MockClipboardTextOrchestrator_HandleSelectionUpdate_Call{Call: _e.mock.On("HandleSelectionUpdate", ctx, input)}
125+}
126+
127+func (_c *MockClipboardTextOrchestrator_HandleSelectionUpdate_Call) Run(run func(ctx context.Context, input dto.SelectionClipboardInput)) *MockClipboardTextOrchestrator_HandleSelectionUpdate_Call {
128+ _c.Call.Run(func(args mock.Arguments) {
129+ var arg0 context.Context
130+ if args[0] != nil {
131+ arg0 = args[0].(context.Context)
132+ }
133+ var arg1 dto.SelectionClipboardInput
134+ if args[1] != nil {
135+ arg1 = args[1].(dto.SelectionClipboardInput)
136+ }
137+ run(
138+ arg0,
139+ arg1,
140+ )
141+ })
142+ return _c
143+}
144+
145+func (_c *MockClipboardTextOrchestrator_HandleSelectionUpdate_Call) Return(err error) *MockClipboardTextOrchestrator_HandleSelectionUpdate_Call {
146+ _c.Call.Return(err)
147+ return _c
148+}
149+
150+func (_c *MockClipboardTextOrchestrator_HandleSelectionUpdate_Call) RunAndReturn(run func(ctx context.Context, input dto.SelectionClipboardInput) error) *MockClipboardTextOrchestrator_HandleSelectionUpdate_Call {
151+ _c.Call.Return(run)
152+ return _c
153+}
A internal/application/port/mocks/color_scheme.go +490 -0
@@ -0,0 +1,490 @@
1+// Code generated by mockery; DO NOT EDIT.
2+// github.com/vektra/mockery
3+// template: testify
4+
5+package mocks
6+
7+import (
8+ "github.com/bnema/dumber/internal/application/port"
9+ mock "github.com/stretchr/testify/mock"
10+)
11+
12+// NewMockColorSchemeDetector creates a new instance of MockColorSchemeDetector. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
13+// The first argument is typically a *testing.T value.
14+func NewMockColorSchemeDetector(t interface {
15+ mock.TestingT
16+ Cleanup(func())
17+}) *MockColorSchemeDetector {
18+ mock := &MockColorSchemeDetector{}
19+ mock.Mock.Test(t)
20+
21+ t.Cleanup(func() { mock.AssertExpectations(t) })
22+
23+ return mock
24+}
25+
26+// MockColorSchemeDetector is an autogenerated mock type for the ColorSchemeDetector type
27+type MockColorSchemeDetector struct {
28+ mock.Mock
29+}
30+
31+type MockColorSchemeDetector_Expecter struct {
32+ mock *mock.Mock
33+}
34+
35+func (_m *MockColorSchemeDetector) EXPECT() *MockColorSchemeDetector_Expecter {
36+ return &MockColorSchemeDetector_Expecter{mock: &_m.Mock}
37+}
38+
39+// Available provides a mock function for the type MockColorSchemeDetector
40+func (_mock *MockColorSchemeDetector) Available() bool {
41+ ret := _mock.Called()
42+
43+ if len(ret) == 0 {
44+ panic("no return value specified for Available")
45+ }
46+
47+ var r0 bool
48+ if returnFunc, ok := ret.Get(0).(func() bool); ok {
49+ r0 = returnFunc()
50+ } else {
51+ r0 = ret.Get(0).(bool)
52+ }
53+ return r0
54+}
55+
56+// MockColorSchemeDetector_Available_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Available'
57+type MockColorSchemeDetector_Available_Call struct {
58+ *mock.Call
59+}
60+
61+// Available is a helper method to define mock.On call
62+func (_e *MockColorSchemeDetector_Expecter) Available() *MockColorSchemeDetector_Available_Call {
63+ return &MockColorSchemeDetector_Available_Call{Call: _e.mock.On("Available")}
64+}
65+
66+func (_c *MockColorSchemeDetector_Available_Call) Run(run func()) *MockColorSchemeDetector_Available_Call {
67+ _c.Call.Run(func(args mock.Arguments) {
68+ run()
69+ })
70+ return _c
71+}
72+
73+func (_c *MockColorSchemeDetector_Available_Call) Return(b bool) *MockColorSchemeDetector_Available_Call {
74+ _c.Call.Return(b)
75+ return _c
76+}
77+
78+func (_c *MockColorSchemeDetector_Available_Call) RunAndReturn(run func() bool) *MockColorSchemeDetector_Available_Call {
79+ _c.Call.Return(run)
80+ return _c
81+}
82+
83+// Detect provides a mock function for the type MockColorSchemeDetector
84+func (_mock *MockColorSchemeDetector) Detect() (bool, bool) {
85+ ret := _mock.Called()
86+
87+ if len(ret) == 0 {
88+ panic("no return value specified for Detect")
89+ }
90+
91+ var r0 bool
92+ var r1 bool
93+ if returnFunc, ok := ret.Get(0).(func() (bool, bool)); ok {
94+ return returnFunc()
95+ }
96+ if returnFunc, ok := ret.Get(0).(func() bool); ok {
97+ r0 = returnFunc()
98+ } else {
99+ r0 = ret.Get(0).(bool)
100+ }
101+ if returnFunc, ok := ret.Get(1).(func() bool); ok {
102+ r1 = returnFunc()
103+ } else {
104+ r1 = ret.Get(1).(bool)
105+ }
106+ return r0, r1
107+}
108+
109+// MockColorSchemeDetector_Detect_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Detect'
110+type MockColorSchemeDetector_Detect_Call struct {
111+ *mock.Call
112+}
113+
114+// Detect is a helper method to define mock.On call
115+func (_e *MockColorSchemeDetector_Expecter) Detect() *MockColorSchemeDetector_Detect_Call {
116+ return &MockColorSchemeDetector_Detect_Call{Call: _e.mock.On("Detect")}
117+}
118+
119+func (_c *MockColorSchemeDetector_Detect_Call) Run(run func()) *MockColorSchemeDetector_Detect_Call {
120+ _c.Call.Run(func(args mock.Arguments) {
121+ run()
122+ })
123+ return _c
124+}
125+
126+func (_c *MockColorSchemeDetector_Detect_Call) Return(prefersDark bool, ok bool) *MockColorSchemeDetector_Detect_Call {
127+ _c.Call.Return(prefersDark, ok)
128+ return _c
129+}
130+
131+func (_c *MockColorSchemeDetector_Detect_Call) RunAndReturn(run func() (bool, bool)) *MockColorSchemeDetector_Detect_Call {
132+ _c.Call.Return(run)
133+ return _c
134+}
135+
136+// Name provides a mock function for the type MockColorSchemeDetector
137+func (_mock *MockColorSchemeDetector) Name() string {
138+ ret := _mock.Called()
139+
140+ if len(ret) == 0 {
141+ panic("no return value specified for Name")
142+ }
143+
144+ var r0 string
145+ if returnFunc, ok := ret.Get(0).(func() string); ok {
146+ r0 = returnFunc()
147+ } else {
148+ r0 = ret.Get(0).(string)
149+ }
150+ return r0
151+}
152+
153+// MockColorSchemeDetector_Name_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Name'
154+type MockColorSchemeDetector_Name_Call struct {
155+ *mock.Call
156+}
157+
158+// Name is a helper method to define mock.On call
159+func (_e *MockColorSchemeDetector_Expecter) Name() *MockColorSchemeDetector_Name_Call {
160+ return &MockColorSchemeDetector_Name_Call{Call: _e.mock.On("Name")}
161+}
162+
163+func (_c *MockColorSchemeDetector_Name_Call) Run(run func()) *MockColorSchemeDetector_Name_Call {
164+ _c.Call.Run(func(args mock.Arguments) {
165+ run()
166+ })
167+ return _c
168+}
169+
170+func (_c *MockColorSchemeDetector_Name_Call) Return(s string) *MockColorSchemeDetector_Name_Call {
171+ _c.Call.Return(s)
172+ return _c
173+}
174+
175+func (_c *MockColorSchemeDetector_Name_Call) RunAndReturn(run func() string) *MockColorSchemeDetector_Name_Call {
176+ _c.Call.Return(run)
177+ return _c
178+}
179+
180+// Priority provides a mock function for the type MockColorSchemeDetector
181+func (_mock *MockColorSchemeDetector) Priority() int {
182+ ret := _mock.Called()
183+
184+ if len(ret) == 0 {
185+ panic("no return value specified for Priority")
186+ }
187+
188+ var r0 int
189+ if returnFunc, ok := ret.Get(0).(func() int); ok {
190+ r0 = returnFunc()
191+ } else {
192+ r0 = ret.Get(0).(int)
193+ }
194+ return r0
195+}
196+
197+// MockColorSchemeDetector_Priority_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Priority'
198+type MockColorSchemeDetector_Priority_Call struct {
199+ *mock.Call
200+}
201+
202+// Priority is a helper method to define mock.On call
203+func (_e *MockColorSchemeDetector_Expecter) Priority() *MockColorSchemeDetector_Priority_Call {
204+ return &MockColorSchemeDetector_Priority_Call{Call: _e.mock.On("Priority")}
205+}
206+
207+func (_c *MockColorSchemeDetector_Priority_Call) Run(run func()) *MockColorSchemeDetector_Priority_Call {
208+ _c.Call.Run(func(args mock.Arguments) {
209+ run()
210+ })
211+ return _c
212+}
213+
214+func (_c *MockColorSchemeDetector_Priority_Call) Return(n int) *MockColorSchemeDetector_Priority_Call {
215+ _c.Call.Return(n)
216+ return _c
217+}
218+
219+func (_c *MockColorSchemeDetector_Priority_Call) RunAndReturn(run func() int) *MockColorSchemeDetector_Priority_Call {
220+ _c.Call.Return(run)
221+ return _c
222+}
223+
224+// NewMockToolkitAvailabilityNotifier creates a new instance of MockToolkitAvailabilityNotifier. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
225+// The first argument is typically a *testing.T value.
226+func NewMockToolkitAvailabilityNotifier(t interface {
227+ mock.TestingT
228+ Cleanup(func())
229+}) *MockToolkitAvailabilityNotifier {
230+ mock := &MockToolkitAvailabilityNotifier{}
231+ mock.Mock.Test(t)
232+
233+ t.Cleanup(func() { mock.AssertExpectations(t) })
234+
235+ return mock
236+}
237+
238+// MockToolkitAvailabilityNotifier is an autogenerated mock type for the ToolkitAvailabilityNotifier type
239+type MockToolkitAvailabilityNotifier struct {
240+ mock.Mock
241+}
242+
243+type MockToolkitAvailabilityNotifier_Expecter struct {
244+ mock *mock.Mock
245+}
246+
247+func (_m *MockToolkitAvailabilityNotifier) EXPECT() *MockToolkitAvailabilityNotifier_Expecter {
248+ return &MockToolkitAvailabilityNotifier_Expecter{mock: &_m.Mock}
249+}
250+
251+// MarkAvailable provides a mock function for the type MockToolkitAvailabilityNotifier
252+func (_mock *MockToolkitAvailabilityNotifier) MarkAvailable() {
253+ _mock.Called()
254+ return
255+}
256+
257+// MockToolkitAvailabilityNotifier_MarkAvailable_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'MarkAvailable'
258+type MockToolkitAvailabilityNotifier_MarkAvailable_Call struct {
259+ *mock.Call
260+}
261+
262+// MarkAvailable is a helper method to define mock.On call
263+func (_e *MockToolkitAvailabilityNotifier_Expecter) MarkAvailable() *MockToolkitAvailabilityNotifier_MarkAvailable_Call {
264+ return &MockToolkitAvailabilityNotifier_MarkAvailable_Call{Call: _e.mock.On("MarkAvailable")}
265+}
266+
267+func (_c *MockToolkitAvailabilityNotifier_MarkAvailable_Call) Run(run func()) *MockToolkitAvailabilityNotifier_MarkAvailable_Call {
268+ _c.Call.Run(func(args mock.Arguments) {
269+ run()
270+ })
271+ return _c
272+}
273+
274+func (_c *MockToolkitAvailabilityNotifier_MarkAvailable_Call) Return() *MockToolkitAvailabilityNotifier_MarkAvailable_Call {
275+ _c.Call.Return()
276+ return _c
277+}
278+
279+func (_c *MockToolkitAvailabilityNotifier_MarkAvailable_Call) RunAndReturn(run func()) *MockToolkitAvailabilityNotifier_MarkAvailable_Call {
280+ _c.Run(run)
281+ return _c
282+}
283+
284+// NewMockColorSchemeResolver creates a new instance of MockColorSchemeResolver. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
285+// The first argument is typically a *testing.T value.
286+func NewMockColorSchemeResolver(t interface {
287+ mock.TestingT
288+ Cleanup(func())
289+}) *MockColorSchemeResolver {
290+ mock := &MockColorSchemeResolver{}
291+ mock.Mock.Test(t)
292+
293+ t.Cleanup(func() { mock.AssertExpectations(t) })
294+
295+ return mock
296+}
297+
298+// MockColorSchemeResolver is an autogenerated mock type for the ColorSchemeResolver type
299+type MockColorSchemeResolver struct {
300+ mock.Mock
301+}
302+
303+type MockColorSchemeResolver_Expecter struct {
304+ mock *mock.Mock
305+}
306+
307+func (_m *MockColorSchemeResolver) EXPECT() *MockColorSchemeResolver_Expecter {
308+ return &MockColorSchemeResolver_Expecter{mock: &_m.Mock}
309+}
310+
311+// OnChange provides a mock function for the type MockColorSchemeResolver
312+func (_mock *MockColorSchemeResolver) OnChange(callback func(port.ColorSchemePreference)) func() {
313+ ret := _mock.Called(callback)
314+
315+ if len(ret) == 0 {
316+ panic("no return value specified for OnChange")
317+ }
318+
319+ var r0 func()
320+ if returnFunc, ok := ret.Get(0).(func(func(port.ColorSchemePreference)) func()); ok {
321+ r0 = returnFunc(callback)
322+ } else {
323+ if ret.Get(0) != nil {
324+ r0 = ret.Get(0).(func())
325+ }
326+ }
327+ return r0
328+}
329+
330+// MockColorSchemeResolver_OnChange_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'OnChange'
331+type MockColorSchemeResolver_OnChange_Call struct {
332+ *mock.Call
333+}
334+
335+// OnChange is a helper method to define mock.On call
336+// - callback func(port.ColorSchemePreference)
337+func (_e *MockColorSchemeResolver_Expecter) OnChange(callback any) *MockColorSchemeResolver_OnChange_Call {
338+ return &MockColorSchemeResolver_OnChange_Call{Call: _e.mock.On("OnChange", callback)}
339+}
340+
341+func (_c *MockColorSchemeResolver_OnChange_Call) Run(run func(callback func(port.ColorSchemePreference))) *MockColorSchemeResolver_OnChange_Call {
342+ _c.Call.Run(func(args mock.Arguments) {
343+ var arg0 func(port.ColorSchemePreference)
344+ if args[0] != nil {
345+ arg0 = args[0].(func(port.ColorSchemePreference))
346+ }
347+ run(
348+ arg0,
349+ )
350+ })
351+ return _c
352+}
353+
354+func (_c *MockColorSchemeResolver_OnChange_Call) Return(fn func()) *MockColorSchemeResolver_OnChange_Call {
355+ _c.Call.Return(fn)
356+ return _c
357+}
358+
359+func (_c *MockColorSchemeResolver_OnChange_Call) RunAndReturn(run func(callback func(port.ColorSchemePreference)) func()) *MockColorSchemeResolver_OnChange_Call {
360+ _c.Call.Return(run)
361+ return _c
362+}
363+
364+// Refresh provides a mock function for the type MockColorSchemeResolver
365+func (_mock *MockColorSchemeResolver) Refresh() port.ColorSchemePreference {
366+ ret := _mock.Called()
367+
368+ if len(ret) == 0 {
369+ panic("no return value specified for Refresh")
370+ }
371+
372+ var r0 port.ColorSchemePreference
373+ if returnFunc, ok := ret.Get(0).(func() port.ColorSchemePreference); ok {
374+ r0 = returnFunc()
375+ } else {
376+ r0 = ret.Get(0).(port.ColorSchemePreference)
377+ }
378+ return r0
379+}
380+
381+// MockColorSchemeResolver_Refresh_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Refresh'
382+type MockColorSchemeResolver_Refresh_Call struct {
383+ *mock.Call
384+}
385+
386+// Refresh is a helper method to define mock.On call
387+func (_e *MockColorSchemeResolver_Expecter) Refresh() *MockColorSchemeResolver_Refresh_Call {
388+ return &MockColorSchemeResolver_Refresh_Call{Call: _e.mock.On("Refresh")}
389+}
390+
391+func (_c *MockColorSchemeResolver_Refresh_Call) Run(run func()) *MockColorSchemeResolver_Refresh_Call {
392+ _c.Call.Run(func(args mock.Arguments) {
393+ run()
394+ })
395+ return _c
396+}
397+
398+func (_c *MockColorSchemeResolver_Refresh_Call) Return(colorSchemePreference port.ColorSchemePreference) *MockColorSchemeResolver_Refresh_Call {
399+ _c.Call.Return(colorSchemePreference)
400+ return _c
401+}
402+
403+func (_c *MockColorSchemeResolver_Refresh_Call) RunAndReturn(run func() port.ColorSchemePreference) *MockColorSchemeResolver_Refresh_Call {
404+ _c.Call.Return(run)
405+ return _c
406+}
407+
408+// RegisterDetector provides a mock function for the type MockColorSchemeResolver
409+func (_mock *MockColorSchemeResolver) RegisterDetector(detector port.ColorSchemeDetector) {
410+ _mock.Called(detector)
411+ return
412+}
413+
414+// MockColorSchemeResolver_RegisterDetector_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'RegisterDetector'
415+type MockColorSchemeResolver_RegisterDetector_Call struct {
416+ *mock.Call
417+}
418+
419+// RegisterDetector is a helper method to define mock.On call
420+// - detector port.ColorSchemeDetector
421+func (_e *MockColorSchemeResolver_Expecter) RegisterDetector(detector any) *MockColorSchemeResolver_RegisterDetector_Call {
422+ return &MockColorSchemeResolver_RegisterDetector_Call{Call: _e.mock.On("RegisterDetector", detector)}
423+}
424+
425+func (_c *MockColorSchemeResolver_RegisterDetector_Call) Run(run func(detector port.ColorSchemeDetector)) *MockColorSchemeResolver_RegisterDetector_Call {
426+ _c.Call.Run(func(args mock.Arguments) {
427+ var arg0 port.ColorSchemeDetector
428+ if args[0] != nil {
429+ arg0 = args[0].(port.ColorSchemeDetector)
430+ }
431+ run(
432+ arg0,
433+ )
434+ })
435+ return _c
436+}
437+
438+func (_c *MockColorSchemeResolver_RegisterDetector_Call) Return() *MockColorSchemeResolver_RegisterDetector_Call {
439+ _c.Call.Return()
440+ return _c
441+}
442+
443+func (_c *MockColorSchemeResolver_RegisterDetector_Call) RunAndReturn(run func(detector port.ColorSchemeDetector)) *MockColorSchemeResolver_RegisterDetector_Call {
444+ _c.Run(run)
445+ return _c
446+}
447+
448+// Resolve provides a mock function for the type MockColorSchemeResolver
449+func (_mock *MockColorSchemeResolver) Resolve() port.ColorSchemePreference {
450+ ret := _mock.Called()
451+
452+ if len(ret) == 0 {
453+ panic("no return value specified for Resolve")
454+ }
455+
456+ var r0 port.ColorSchemePreference
457+ if returnFunc, ok := ret.Get(0).(func() port.ColorSchemePreference); ok {
458+ r0 = returnFunc()
459+ } else {
460+ r0 = ret.Get(0).(port.ColorSchemePreference)
461+ }
462+ return r0
463+}
464+
465+// MockColorSchemeResolver_Resolve_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Resolve'
466+type MockColorSchemeResolver_Resolve_Call struct {
467+ *mock.Call
468+}
469+
470+// Resolve is a helper method to define mock.On call
471+func (_e *MockColorSchemeResolver_Expecter) Resolve() *MockColorSchemeResolver_Resolve_Call {
472+ return &MockColorSchemeResolver_Resolve_Call{Call: _e.mock.On("Resolve")}
473+}
474+
475+func (_c *MockColorSchemeResolver_Resolve_Call) Run(run func()) *MockColorSchemeResolver_Resolve_Call {
476+ _c.Call.Run(func(args mock.Arguments) {
477+ run()
478+ })
479+ return _c
480+}
481+
482+func (_c *MockColorSchemeResolver_Resolve_Call) Return(colorSchemePreference port.ColorSchemePreference) *MockColorSchemeResolver_Resolve_Call {
483+ _c.Call.Return(colorSchemePreference)
484+ return _c
485+}
486+
487+func (_c *MockColorSchemeResolver_Resolve_Call) RunAndReturn(run func() port.ColorSchemePreference) *MockColorSchemeResolver_Resolve_Call {
488+ _c.Call.Return(run)
489+ return _c
490+}
A internal/application/port/mocks/config_migrator.go +384 -0
@@ -0,0 +1,384 @@
1+// Code generated by mockery; DO NOT EDIT.
2+// github.com/vektra/mockery
3+// template: testify
4+
5+package mocks
6+
7+import (
8+ "github.com/bnema/dumber/internal/application/port"
9+ mock "github.com/stretchr/testify/mock"
10+)
11+
12+// NewMockConfigMigrator creates a new instance of MockConfigMigrator. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
13+// The first argument is typically a *testing.T value.
14+func NewMockConfigMigrator(t interface {
15+ mock.TestingT
16+ Cleanup(func())
17+}) *MockConfigMigrator {
18+ mock := &MockConfigMigrator{}
19+ mock.Mock.Test(t)
20+
21+ t.Cleanup(func() { mock.AssertExpectations(t) })
22+
23+ return mock
24+}
25+
26+// MockConfigMigrator is an autogenerated mock type for the ConfigMigrator type
27+type MockConfigMigrator struct {
28+ mock.Mock
29+}
30+
31+type MockConfigMigrator_Expecter struct {
32+ mock *mock.Mock
33+}
34+
35+func (_m *MockConfigMigrator) EXPECT() *MockConfigMigrator_Expecter {
36+ return &MockConfigMigrator_Expecter{mock: &_m.Mock}
37+}
38+
39+// CheckMigration provides a mock function for the type MockConfigMigrator
40+func (_mock *MockConfigMigrator) CheckMigration() (*port.MigrationResult, error) {
41+ ret := _mock.Called()
42+
43+ if len(ret) == 0 {
44+ panic("no return value specified for CheckMigration")
45+ }
46+
47+ var r0 *port.MigrationResult
48+ var r1 error
49+ if returnFunc, ok := ret.Get(0).(func() (*port.MigrationResult, error)); ok {
50+ return returnFunc()
51+ }
52+ if returnFunc, ok := ret.Get(0).(func() *port.MigrationResult); ok {
53+ r0 = returnFunc()
54+ } else {
55+ if ret.Get(0) != nil {
56+ r0 = ret.Get(0).(*port.MigrationResult)
57+ }
58+ }
59+ if returnFunc, ok := ret.Get(1).(func() error); ok {
60+ r1 = returnFunc()
61+ } else {
62+ r1 = ret.Error(1)
63+ }
64+ return r0, r1
65+}
66+
67+// MockConfigMigrator_CheckMigration_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'CheckMigration'
68+type MockConfigMigrator_CheckMigration_Call struct {
69+ *mock.Call
70+}
71+
72+// CheckMigration is a helper method to define mock.On call
73+func (_e *MockConfigMigrator_Expecter) CheckMigration() *MockConfigMigrator_CheckMigration_Call {
74+ return &MockConfigMigrator_CheckMigration_Call{Call: _e.mock.On("CheckMigration")}
75+}
76+
77+func (_c *MockConfigMigrator_CheckMigration_Call) Run(run func()) *MockConfigMigrator_CheckMigration_Call {
78+ _c.Call.Run(func(args mock.Arguments) {
79+ run()
80+ })
81+ return _c
82+}
83+
84+func (_c *MockConfigMigrator_CheckMigration_Call) Return(migrationResult *port.MigrationResult, err error) *MockConfigMigrator_CheckMigration_Call {
85+ _c.Call.Return(migrationResult, err)
86+ return _c
87+}
88+
89+func (_c *MockConfigMigrator_CheckMigration_Call) RunAndReturn(run func() (*port.MigrationResult, error)) *MockConfigMigrator_CheckMigration_Call {
90+ _c.Call.Return(run)
91+ return _c
92+}
93+
94+// DetectChanges provides a mock function for the type MockConfigMigrator
95+func (_mock *MockConfigMigrator) DetectChanges() ([]port.KeyChange, error) {
96+ ret := _mock.Called()
97+
98+ if len(ret) == 0 {
99+ panic("no return value specified for DetectChanges")
100+ }
101+
102+ var r0 []port.KeyChange
103+ var r1 error
104+ if returnFunc, ok := ret.Get(0).(func() ([]port.KeyChange, error)); ok {
105+ return returnFunc()
106+ }
107+ if returnFunc, ok := ret.Get(0).(func() []port.KeyChange); ok {
108+ r0 = returnFunc()
109+ } else {
110+ if ret.Get(0) != nil {
111+ r0 = ret.Get(0).([]port.KeyChange)
112+ }
113+ }
114+ if returnFunc, ok := ret.Get(1).(func() error); ok {
115+ r1 = returnFunc()
116+ } else {
117+ r1 = ret.Error(1)
118+ }
119+ return r0, r1
120+}
121+
122+// MockConfigMigrator_DetectChanges_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'DetectChanges'
123+type MockConfigMigrator_DetectChanges_Call struct {
124+ *mock.Call
125+}
126+
127+// DetectChanges is a helper method to define mock.On call
128+func (_e *MockConfigMigrator_Expecter) DetectChanges() *MockConfigMigrator_DetectChanges_Call {
129+ return &MockConfigMigrator_DetectChanges_Call{Call: _e.mock.On("DetectChanges")}
130+}
131+
132+func (_c *MockConfigMigrator_DetectChanges_Call) Run(run func()) *MockConfigMigrator_DetectChanges_Call {
133+ _c.Call.Run(func(args mock.Arguments) {
134+ run()
135+ })
136+ return _c
137+}
138+
139+func (_c *MockConfigMigrator_DetectChanges_Call) Return(keyChanges []port.KeyChange, err error) *MockConfigMigrator_DetectChanges_Call {
140+ _c.Call.Return(keyChanges, err)
141+ return _c
142+}
143+
144+func (_c *MockConfigMigrator_DetectChanges_Call) RunAndReturn(run func() ([]port.KeyChange, error)) *MockConfigMigrator_DetectChanges_Call {
145+ _c.Call.Return(run)
146+ return _c
147+}
148+
149+// GetConfigFile provides a mock function for the type MockConfigMigrator
150+func (_mock *MockConfigMigrator) GetConfigFile() (string, error) {
151+ ret := _mock.Called()
152+
153+ if len(ret) == 0 {
154+ panic("no return value specified for GetConfigFile")
155+ }
156+
157+ var r0 string
158+ var r1 error
159+ if returnFunc, ok := ret.Get(0).(func() (string, error)); ok {
160+ return returnFunc()
161+ }
162+ if returnFunc, ok := ret.Get(0).(func() string); ok {
163+ r0 = returnFunc()
164+ } else {
165+ r0 = ret.Get(0).(string)
166+ }
167+ if returnFunc, ok := ret.Get(1).(func() error); ok {
168+ r1 = returnFunc()
169+ } else {
170+ r1 = ret.Error(1)
171+ }
172+ return r0, r1
173+}
174+
175+// MockConfigMigrator_GetConfigFile_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetConfigFile'
176+type MockConfigMigrator_GetConfigFile_Call struct {
177+ *mock.Call
178+}
179+
180+// GetConfigFile is a helper method to define mock.On call
181+func (_e *MockConfigMigrator_Expecter) GetConfigFile() *MockConfigMigrator_GetConfigFile_Call {
182+ return &MockConfigMigrator_GetConfigFile_Call{Call: _e.mock.On("GetConfigFile")}
183+}
184+
185+func (_c *MockConfigMigrator_GetConfigFile_Call) Run(run func()) *MockConfigMigrator_GetConfigFile_Call {
186+ _c.Call.Run(func(args mock.Arguments) {
187+ run()
188+ })
189+ return _c
190+}
191+
192+func (_c *MockConfigMigrator_GetConfigFile_Call) Return(s string, err error) *MockConfigMigrator_GetConfigFile_Call {
193+ _c.Call.Return(s, err)
194+ return _c
195+}
196+
197+func (_c *MockConfigMigrator_GetConfigFile_Call) RunAndReturn(run func() (string, error)) *MockConfigMigrator_GetConfigFile_Call {
198+ _c.Call.Return(run)
199+ return _c
200+}
201+
202+// GetKeyInfo provides a mock function for the type MockConfigMigrator
203+func (_mock *MockConfigMigrator) GetKeyInfo(key string) port.KeyInfo {
204+ ret := _mock.Called(key)
205+
206+ if len(ret) == 0 {
207+ panic("no return value specified for GetKeyInfo")
208+ }
209+
210+ var r0 port.KeyInfo
211+ if returnFunc, ok := ret.Get(0).(func(string) port.KeyInfo); ok {
212+ r0 = returnFunc(key)
213+ } else {
214+ r0 = ret.Get(0).(port.KeyInfo)
215+ }
216+ return r0
217+}
218+
219+// MockConfigMigrator_GetKeyInfo_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetKeyInfo'
220+type MockConfigMigrator_GetKeyInfo_Call struct {
221+ *mock.Call
222+}
223+
224+// GetKeyInfo is a helper method to define mock.On call
225+// - key string
226+func (_e *MockConfigMigrator_Expecter) GetKeyInfo(key any) *MockConfigMigrator_GetKeyInfo_Call {
227+ return &MockConfigMigrator_GetKeyInfo_Call{Call: _e.mock.On("GetKeyInfo", key)}
228+}
229+
230+func (_c *MockConfigMigrator_GetKeyInfo_Call) Run(run func(key string)) *MockConfigMigrator_GetKeyInfo_Call {
231+ _c.Call.Run(func(args mock.Arguments) {
232+ var arg0 string
233+ if args[0] != nil {
234+ arg0 = args[0].(string)
235+ }
236+ run(
237+ arg0,
238+ )
239+ })
240+ return _c
241+}
242+
243+func (_c *MockConfigMigrator_GetKeyInfo_Call) Return(keyInfo port.KeyInfo) *MockConfigMigrator_GetKeyInfo_Call {
244+ _c.Call.Return(keyInfo)
245+ return _c
246+}
247+
248+func (_c *MockConfigMigrator_GetKeyInfo_Call) RunAndReturn(run func(key string) port.KeyInfo) *MockConfigMigrator_GetKeyInfo_Call {
249+ _c.Call.Return(run)
250+ return _c
251+}
252+
253+// Migrate provides a mock function for the type MockConfigMigrator
254+func (_mock *MockConfigMigrator) Migrate() ([]string, error) {
255+ ret := _mock.Called()
256+
257+ if len(ret) == 0 {
258+ panic("no return value specified for Migrate")
259+ }
260+
261+ var r0 []string
262+ var r1 error
263+ if returnFunc, ok := ret.Get(0).(func() ([]string, error)); ok {
264+ return returnFunc()
265+ }
266+ if returnFunc, ok := ret.Get(0).(func() []string); ok {
267+ r0 = returnFunc()
268+ } else {
269+ if ret.Get(0) != nil {
270+ r0 = ret.Get(0).([]string)
271+ }
272+ }
273+ if returnFunc, ok := ret.Get(1).(func() error); ok {
274+ r1 = returnFunc()
275+ } else {
276+ r1 = ret.Error(1)
277+ }
278+ return r0, r1
279+}
280+
281+// MockConfigMigrator_Migrate_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Migrate'
282+type MockConfigMigrator_Migrate_Call struct {
283+ *mock.Call
284+}
285+
286+// Migrate is a helper method to define mock.On call
287+func (_e *MockConfigMigrator_Expecter) Migrate() *MockConfigMigrator_Migrate_Call {
288+ return &MockConfigMigrator_Migrate_Call{Call: _e.mock.On("Migrate")}
289+}
290+
291+func (_c *MockConfigMigrator_Migrate_Call) Run(run func()) *MockConfigMigrator_Migrate_Call {
292+ _c.Call.Run(func(args mock.Arguments) {
293+ run()
294+ })
295+ return _c
296+}
297+
298+func (_c *MockConfigMigrator_Migrate_Call) Return(strings []string, err error) *MockConfigMigrator_Migrate_Call {
299+ _c.Call.Return(strings, err)
300+ return _c
301+}
302+
303+func (_c *MockConfigMigrator_Migrate_Call) RunAndReturn(run func() ([]string, error)) *MockConfigMigrator_Migrate_Call {
304+ _c.Call.Return(run)
305+ return _c
306+}
307+
308+// NewMockDiffFormatter creates a new instance of MockDiffFormatter. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
309+// The first argument is typically a *testing.T value.
310+func NewMockDiffFormatter(t interface {
311+ mock.TestingT
312+ Cleanup(func())
313+}) *MockDiffFormatter {
314+ mock := &MockDiffFormatter{}
315+ mock.Mock.Test(t)
316+
317+ t.Cleanup(func() { mock.AssertExpectations(t) })
318+
319+ return mock
320+}
321+
322+// MockDiffFormatter is an autogenerated mock type for the DiffFormatter type
323+type MockDiffFormatter struct {
324+ mock.Mock
325+}
326+
327+type MockDiffFormatter_Expecter struct {
328+ mock *mock.Mock
329+}
330+
331+func (_m *MockDiffFormatter) EXPECT() *MockDiffFormatter_Expecter {
332+ return &MockDiffFormatter_Expecter{mock: &_m.Mock}
333+}
334+
335+// FormatChangesAsDiff provides a mock function for the type MockDiffFormatter
336+func (_mock *MockDiffFormatter) FormatChangesAsDiff(changes []port.KeyChange) string {
337+ ret := _mock.Called(changes)
338+
339+ if len(ret) == 0 {
340+ panic("no return value specified for FormatChangesAsDiff")
341+ }
342+
343+ var r0 string
344+ if returnFunc, ok := ret.Get(0).(func([]port.KeyChange) string); ok {
345+ r0 = returnFunc(changes)
346+ } else {
347+ r0 = ret.Get(0).(string)
348+ }
349+ return r0
350+}
351+
352+// MockDiffFormatter_FormatChangesAsDiff_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'FormatChangesAsDiff'
353+type MockDiffFormatter_FormatChangesAsDiff_Call struct {
354+ *mock.Call
355+}
356+
357+// FormatChangesAsDiff is a helper method to define mock.On call
358+// - changes []port.KeyChange
359+func (_e *MockDiffFormatter_Expecter) FormatChangesAsDiff(changes any) *MockDiffFormatter_FormatChangesAsDiff_Call {
360+ return &MockDiffFormatter_FormatChangesAsDiff_Call{Call: _e.mock.On("FormatChangesAsDiff", changes)}
361+}
362+
363+func (_c *MockDiffFormatter_FormatChangesAsDiff_Call) Run(run func(changes []port.KeyChange)) *MockDiffFormatter_FormatChangesAsDiff_Call {
364+ _c.Call.Run(func(args mock.Arguments) {
365+ var arg0 []port.KeyChange
366+ if args[0] != nil {
367+ arg0 = args[0].([]port.KeyChange)
368+ }
369+ run(
370+ arg0,
371+ )
372+ })
373+ return _c
374+}
375+
376+func (_c *MockDiffFormatter_FormatChangesAsDiff_Call) Return(s string) *MockDiffFormatter_FormatChangesAsDiff_Call {
377+ _c.Call.Return(s)
378+ return _c
379+}
380+
381+func (_c *MockDiffFormatter_FormatChangesAsDiff_Call) RunAndReturn(run func(changes []port.KeyChange) string) *MockDiffFormatter_FormatChangesAsDiff_Call {
382+ _c.Call.Return(run)
383+ return _c
384+}
A internal/application/port/mocks/config_schema.go +83 -0
@@ -0,0 +1,83 @@
1+// Code generated by mockery; DO NOT EDIT.
2+// github.com/vektra/mockery
3+// template: testify
4+
5+package mocks
6+
7+import (
8+ "github.com/bnema/dumber/internal/domain/entity"
9+ mock "github.com/stretchr/testify/mock"
10+)
11+
12+// NewMockConfigSchemaProvider creates a new instance of MockConfigSchemaProvider. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
13+// The first argument is typically a *testing.T value.
14+func NewMockConfigSchemaProvider(t interface {
15+ mock.TestingT
16+ Cleanup(func())
17+}) *MockConfigSchemaProvider {
18+ mock := &MockConfigSchemaProvider{}
19+ mock.Mock.Test(t)
20+
21+ t.Cleanup(func() { mock.AssertExpectations(t) })
22+
23+ return mock
24+}
25+
26+// MockConfigSchemaProvider is an autogenerated mock type for the ConfigSchemaProvider type
27+type MockConfigSchemaProvider struct {
28+ mock.Mock
29+}
30+
31+type MockConfigSchemaProvider_Expecter struct {
32+ mock *mock.Mock
33+}
34+
35+func (_m *MockConfigSchemaProvider) EXPECT() *MockConfigSchemaProvider_Expecter {
36+ return &MockConfigSchemaProvider_Expecter{mock: &_m.Mock}
37+}
38+
39+// GetSchema provides a mock function for the type MockConfigSchemaProvider
40+func (_mock *MockConfigSchemaProvider) GetSchema() []entity.ConfigKeyInfo {
41+ ret := _mock.Called()
42+
43+ if len(ret) == 0 {
44+ panic("no return value specified for GetSchema")
45+ }
46+
47+ var r0 []entity.ConfigKeyInfo
48+ if returnFunc, ok := ret.Get(0).(func() []entity.ConfigKeyInfo); ok {
49+ r0 = returnFunc()
50+ } else {
51+ if ret.Get(0) != nil {
52+ r0 = ret.Get(0).([]entity.ConfigKeyInfo)
53+ }
54+ }
55+ return r0
56+}
57+
58+// MockConfigSchemaProvider_GetSchema_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetSchema'
59+type MockConfigSchemaProvider_GetSchema_Call struct {
60+ *mock.Call
61+}
62+
63+// GetSchema is a helper method to define mock.On call
64+func (_e *MockConfigSchemaProvider_Expecter) GetSchema() *MockConfigSchemaProvider_GetSchema_Call {
65+ return &MockConfigSchemaProvider_GetSchema_Call{Call: _e.mock.On("GetSchema")}
66+}
67+
68+func (_c *MockConfigSchemaProvider_GetSchema_Call) Run(run func()) *MockConfigSchemaProvider_GetSchema_Call {
69+ _c.Call.Run(func(args mock.Arguments) {
70+ run()
71+ })
72+ return _c
73+}
74+
75+func (_c *MockConfigSchemaProvider_GetSchema_Call) Return(configKeyInfos []entity.ConfigKeyInfo) *MockConfigSchemaProvider_GetSchema_Call {
76+ _c.Call.Return(configKeyInfos)
77+ return _c
78+}
79+
80+func (_c *MockConfigSchemaProvider_GetSchema_Call) RunAndReturn(run func() []entity.ConfigKeyInfo) *MockConfigSchemaProvider_GetSchema_Call {
81+ _c.Call.Return(run)
82+ return _c
83+}
A internal/application/port/mocks/config_transformer.go +116 -0
@@ -0,0 +1,116 @@
1+// Code generated by mockery; DO NOT EDIT.
2+// github.com/vektra/mockery
3+// template: testify
4+
5+package mocks
6+
7+import (
8+ mock "github.com/stretchr/testify/mock"
9+)
10+
11+// NewMockConfigTransformer creates a new instance of MockConfigTransformer. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
12+// The first argument is typically a *testing.T value.
13+func NewMockConfigTransformer(t interface {
14+ mock.TestingT
15+ Cleanup(func())
16+}) *MockConfigTransformer {
17+ mock := &MockConfigTransformer{}
18+ mock.Mock.Test(t)
19+
20+ t.Cleanup(func() { mock.AssertExpectations(t) })
21+
22+ return mock
23+}
24+
25+// MockConfigTransformer is an autogenerated mock type for the ConfigTransformer type
26+type MockConfigTransformer struct {
27+ mock.Mock
28+}
29+
30+type MockConfigTransformer_Expecter struct {
31+ mock *mock.Mock
32+}
33+
34+func (_m *MockConfigTransformer) EXPECT() *MockConfigTransformer_Expecter {
35+ return &MockConfigTransformer_Expecter{mock: &_m.Mock}
36+}
37+
38+// TransformLegacyActions provides a mock function for the type MockConfigTransformer
39+func (_mock *MockConfigTransformer) TransformLegacyActions(rawConfig map[string]any) {
40+ _mock.Called(rawConfig)
41+ return
42+}
43+
44+// MockConfigTransformer_TransformLegacyActions_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'TransformLegacyActions'
45+type MockConfigTransformer_TransformLegacyActions_Call struct {
46+ *mock.Call
47+}
48+
49+// TransformLegacyActions is a helper method to define mock.On call
50+// - rawConfig map[string]any
51+func (_e *MockConfigTransformer_Expecter) TransformLegacyActions(rawConfig any) *MockConfigTransformer_TransformLegacyActions_Call {
52+ return &MockConfigTransformer_TransformLegacyActions_Call{Call: _e.mock.On("TransformLegacyActions", rawConfig)}
53+}
54+
55+func (_c *MockConfigTransformer_TransformLegacyActions_Call) Run(run func(rawConfig map[string]any)) *MockConfigTransformer_TransformLegacyActions_Call {
56+ _c.Call.Run(func(args mock.Arguments) {
57+ var arg0 map[string]any
58+ if args[0] != nil {
59+ arg0 = args[0].(map[string]any)
60+ }
61+ run(
62+ arg0,
63+ )
64+ })
65+ return _c
66+}
67+
68+func (_c *MockConfigTransformer_TransformLegacyActions_Call) Return() *MockConfigTransformer_TransformLegacyActions_Call {
69+ _c.Call.Return()
70+ return _c
71+}
72+
73+func (_c *MockConfigTransformer_TransformLegacyActions_Call) RunAndReturn(run func(rawConfig map[string]any)) *MockConfigTransformer_TransformLegacyActions_Call {
74+ _c.Run(run)
75+ return _c
76+}
77+
78+// TransformLegacyEngineConfig provides a mock function for the type MockConfigTransformer
79+func (_mock *MockConfigTransformer) TransformLegacyEngineConfig(rawConfig map[string]any) {
80+ _mock.Called(rawConfig)
81+ return
82+}
83+
84+// MockConfigTransformer_TransformLegacyEngineConfig_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'TransformLegacyEngineConfig'
85+type MockConfigTransformer_TransformLegacyEngineConfig_Call struct {
86+ *mock.Call
87+}
88+
89+// TransformLegacyEngineConfig is a helper method to define mock.On call
90+// - rawConfig map[string]any
91+func (_e *MockConfigTransformer_Expecter) TransformLegacyEngineConfig(rawConfig any) *MockConfigTransformer_TransformLegacyEngineConfig_Call {
92+ return &MockConfigTransformer_TransformLegacyEngineConfig_Call{Call: _e.mock.On("TransformLegacyEngineConfig", rawConfig)}
93+}
94+
95+func (_c *MockConfigTransformer_TransformLegacyEngineConfig_Call) Run(run func(rawConfig map[string]any)) *MockConfigTransformer_TransformLegacyEngineConfig_Call {
96+ _c.Call.Run(func(args mock.Arguments) {
97+ var arg0 map[string]any
98+ if args[0] != nil {
99+ arg0 = args[0].(map[string]any)
100+ }
101+ run(
102+ arg0,
103+ )
104+ })
105+ return _c
106+}
107+
108+func (_c *MockConfigTransformer_TransformLegacyEngineConfig_Call) Return() *MockConfigTransformer_TransformLegacyEngineConfig_Call {
109+ _c.Call.Return()
110+ return _c
111+}
112+
113+func (_c *MockConfigTransformer_TransformLegacyEngineConfig_Call) RunAndReturn(run func(rawConfig map[string]any)) *MockConfigTransformer_TransformLegacyEngineConfig_Call {
114+ _c.Run(run)
115+ return _c
116+}
A internal/application/port/mocks/content_injector.go +210 -0
@@ -0,0 +1,210 @@
1+// Code generated by mockery; DO NOT EDIT.
2+// github.com/vektra/mockery
3+// template: testify
4+
5+package mocks
6+
7+import (
8+ "context"
9+
10+ "github.com/bnema/dumber/internal/application/port"
11+ mock "github.com/stretchr/testify/mock"
12+)
13+
14+// NewMockContentInjector creates a new instance of MockContentInjector. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
15+// The first argument is typically a *testing.T value.
16+func NewMockContentInjector(t interface {
17+ mock.TestingT
18+ Cleanup(func())
19+}) *MockContentInjector {
20+ mock := &MockContentInjector{}
21+ mock.Mock.Test(t)
22+
23+ t.Cleanup(func() { mock.AssertExpectations(t) })
24+
25+ return mock
26+}
27+
28+// MockContentInjector is an autogenerated mock type for the ContentInjector type
29+type MockContentInjector struct {
30+ mock.Mock
31+}
32+
33+type MockContentInjector_Expecter struct {
34+ mock *mock.Mock
35+}
36+
37+func (_m *MockContentInjector) EXPECT() *MockContentInjector_Expecter {
38+ return &MockContentInjector_Expecter{mock: &_m.Mock}
39+}
40+
41+// InjectFindHighlightCSS provides a mock function for the type MockContentInjector
42+func (_mock *MockContentInjector) InjectFindHighlightCSS(ctx context.Context, css string) error {
43+ ret := _mock.Called(ctx, css)
44+
45+ if len(ret) == 0 {
46+ panic("no return value specified for InjectFindHighlightCSS")
47+ }
48+
49+ var r0 error
50+ if returnFunc, ok := ret.Get(0).(func(context.Context, string) error); ok {
51+ r0 = returnFunc(ctx, css)
52+ } else {
53+ r0 = ret.Error(0)
54+ }
55+ return r0
56+}
57+
58+// MockContentInjector_InjectFindHighlightCSS_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'InjectFindHighlightCSS'
59+type MockContentInjector_InjectFindHighlightCSS_Call struct {
60+ *mock.Call
61+}
62+
63+// InjectFindHighlightCSS is a helper method to define mock.On call
64+// - ctx context.Context
65+// - css string
66+func (_e *MockContentInjector_Expecter) InjectFindHighlightCSS(ctx any, css any) *MockContentInjector_InjectFindHighlightCSS_Call {
67+ return &MockContentInjector_InjectFindHighlightCSS_Call{Call: _e.mock.On("InjectFindHighlightCSS", ctx, css)}
68+}
69+
70+func (_c *MockContentInjector_InjectFindHighlightCSS_Call) Run(run func(ctx context.Context, css string)) *MockContentInjector_InjectFindHighlightCSS_Call {
71+ _c.Call.Run(func(args mock.Arguments) {
72+ var arg0 context.Context
73+ if args[0] != nil {
74+ arg0 = args[0].(context.Context)
75+ }
76+ var arg1 string
77+ if args[1] != nil {
78+ arg1 = args[1].(string)
79+ }
80+ run(
81+ arg0,
82+ arg1,
83+ )
84+ })
85+ return _c
86+}
87+
88+func (_c *MockContentInjector_InjectFindHighlightCSS_Call) Return(err error) *MockContentInjector_InjectFindHighlightCSS_Call {
89+ _c.Call.Return(err)
90+ return _c
91+}
92+
93+func (_c *MockContentInjector_InjectFindHighlightCSS_Call) RunAndReturn(run func(ctx context.Context, css string) error) *MockContentInjector_InjectFindHighlightCSS_Call {
94+ _c.Call.Return(run)
95+ return _c
96+}
97+
98+// InjectThemeCSS provides a mock function for the type MockContentInjector
99+func (_mock *MockContentInjector) InjectThemeCSS(ctx context.Context, css string) error {
100+ ret := _mock.Called(ctx, css)
101+
102+ if len(ret) == 0 {
103+ panic("no return value specified for InjectThemeCSS")
104+ }
105+
106+ var r0 error
107+ if returnFunc, ok := ret.Get(0).(func(context.Context, string) error); ok {
108+ r0 = returnFunc(ctx, css)
109+ } else {
110+ r0 = ret.Error(0)
111+ }
112+ return r0
113+}
114+
115+// MockContentInjector_InjectThemeCSS_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'InjectThemeCSS'
116+type MockContentInjector_InjectThemeCSS_Call struct {
117+ *mock.Call
118+}
119+
120+// InjectThemeCSS is a helper method to define mock.On call
121+// - ctx context.Context
122+// - css string
123+func (_e *MockContentInjector_Expecter) InjectThemeCSS(ctx any, css any) *MockContentInjector_InjectThemeCSS_Call {
124+ return &MockContentInjector_InjectThemeCSS_Call{Call: _e.mock.On("InjectThemeCSS", ctx, css)}
125+}
126+
127+func (_c *MockContentInjector_InjectThemeCSS_Call) Run(run func(ctx context.Context, css string)) *MockContentInjector_InjectThemeCSS_Call {
128+ _c.Call.Run(func(args mock.Arguments) {
129+ var arg0 context.Context
130+ if args[0] != nil {
131+ arg0 = args[0].(context.Context)
132+ }
133+ var arg1 string
134+ if args[1] != nil {
135+ arg1 = args[1].(string)
136+ }
137+ run(
138+ arg0,
139+ arg1,
140+ )
141+ })
142+ return _c
143+}
144+
145+func (_c *MockContentInjector_InjectThemeCSS_Call) Return(err error) *MockContentInjector_InjectThemeCSS_Call {
146+ _c.Call.Return(err)
147+ return _c
148+}
149+
150+func (_c *MockContentInjector_InjectThemeCSS_Call) RunAndReturn(run func(ctx context.Context, css string) error) *MockContentInjector_InjectThemeCSS_Call {
151+ _c.Call.Return(run)
152+ return _c
153+}
154+
155+// RefreshScripts provides a mock function for the type MockContentInjector
156+func (_mock *MockContentInjector) RefreshScripts(ctx context.Context, wv port.WebView) error {
157+ ret := _mock.Called(ctx, wv)
158+
159+ if len(ret) == 0 {
160+ panic("no return value specified for RefreshScripts")
161+ }
162+
163+ var r0 error
164+ if returnFunc, ok := ret.Get(0).(func(context.Context, port.WebView) error); ok {
165+ r0 = returnFunc(ctx, wv)
166+ } else {
167+ r0 = ret.Error(0)
168+ }
169+ return r0
170+}
171+
172+// MockContentInjector_RefreshScripts_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'RefreshScripts'
173+type MockContentInjector_RefreshScripts_Call struct {
174+ *mock.Call
175+}
176+
177+// RefreshScripts is a helper method to define mock.On call
178+// - ctx context.Context
179+// - wv port.WebView
180+func (_e *MockContentInjector_Expecter) RefreshScripts(ctx any, wv any) *MockContentInjector_RefreshScripts_Call {
181+ return &MockContentInjector_RefreshScripts_Call{Call: _e.mock.On("RefreshScripts", ctx, wv)}
182+}
183+
184+func (_c *MockContentInjector_RefreshScripts_Call) Run(run func(ctx context.Context, wv port.WebView)) *MockContentInjector_RefreshScripts_Call {
185+ _c.Call.Run(func(args mock.Arguments) {
186+ var arg0 context.Context
187+ if args[0] != nil {
188+ arg0 = args[0].(context.Context)
189+ }
190+ var arg1 port.WebView
191+ if args[1] != nil {
192+ arg1 = args[1].(port.WebView)
193+ }
194+ run(
195+ arg0,
196+ arg1,
197+ )
198+ })
199+ return _c
200+}
201+
202+func (_c *MockContentInjector_RefreshScripts_Call) Return(err error) *MockContentInjector_RefreshScripts_Call {
203+ _c.Call.Return(err)
204+ return _c
205+}
206+
207+func (_c *MockContentInjector_RefreshScripts_Call) RunAndReturn(run func(ctx context.Context, wv port.WebView) error) *MockContentInjector_RefreshScripts_Call {
208+ _c.Call.Return(run)
209+ return _c
210+}
A internal/application/port/mocks/context_menu.go +376 -0
@@ -0,0 +1,376 @@
1+// Code generated by mockery; DO NOT EDIT.
2+// github.com/vektra/mockery
3+// template: testify
4+
5+package mocks
6+
7+import (
8+ "context"
9+
10+ "github.com/bnema/dumber/internal/application/port"
11+ mock "github.com/stretchr/testify/mock"
12+)
13+
14+// NewMockContextMenuBuilder creates a new instance of MockContextMenuBuilder. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
15+// The first argument is typically a *testing.T value.
16+func NewMockContextMenuBuilder(t interface {
17+ mock.TestingT
18+ Cleanup(func())
19+}) *MockContextMenuBuilder {
20+ mock := &MockContextMenuBuilder{}
21+ mock.Mock.Test(t)
22+
23+ t.Cleanup(func() { mock.AssertExpectations(t) })
24+
25+ return mock
26+}
27+
28+// MockContextMenuBuilder is an autogenerated mock type for the ContextMenuBuilder type
29+type MockContextMenuBuilder struct {
30+ mock.Mock
31+}
32+
33+type MockContextMenuBuilder_Expecter struct {
34+ mock *mock.Mock
35+}
36+
37+func (_m *MockContextMenuBuilder) EXPECT() *MockContextMenuBuilder_Expecter {
38+ return &MockContextMenuBuilder_Expecter{mock: &_m.Mock}
39+}
40+
41+// Build provides a mock function for the type MockContextMenuBuilder
42+func (_mock *MockContextMenuBuilder) Build(ctx context.Context, menuContext port.MenuContext) []port.MenuItem {
43+ ret := _mock.Called(ctx, menuContext)
44+
45+ if len(ret) == 0 {
46+ panic("no return value specified for Build")
47+ }
48+
49+ var r0 []port.MenuItem
50+ if returnFunc, ok := ret.Get(0).(func(context.Context, port.MenuContext) []port.MenuItem); ok {
51+ r0 = returnFunc(ctx, menuContext)
52+ } else {
53+ if ret.Get(0) != nil {
54+ r0 = ret.Get(0).([]port.MenuItem)
55+ }
56+ }
57+ return r0
58+}
59+
60+// MockContextMenuBuilder_Build_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Build'
61+type MockContextMenuBuilder_Build_Call struct {
62+ *mock.Call
63+}
64+
65+// Build is a helper method to define mock.On call
66+// - ctx context.Context
67+// - menuContext port.MenuContext
68+func (_e *MockContextMenuBuilder_Expecter) Build(ctx any, menuContext any) *MockContextMenuBuilder_Build_Call {
69+ return &MockContextMenuBuilder_Build_Call{Call: _e.mock.On("Build", ctx, menuContext)}
70+}
71+
72+func (_c *MockContextMenuBuilder_Build_Call) Run(run func(ctx context.Context, menuContext port.MenuContext)) *MockContextMenuBuilder_Build_Call {
73+ _c.Call.Run(func(args mock.Arguments) {
74+ var arg0 context.Context
75+ if args[0] != nil {
76+ arg0 = args[0].(context.Context)
77+ }
78+ var arg1 port.MenuContext
79+ if args[1] != nil {
80+ arg1 = args[1].(port.MenuContext)
81+ }
82+ run(
83+ arg0,
84+ arg1,
85+ )
86+ })
87+ return _c
88+}
89+
90+func (_c *MockContextMenuBuilder_Build_Call) Return(menuItems []port.MenuItem) *MockContextMenuBuilder_Build_Call {
91+ _c.Call.Return(menuItems)
92+ return _c
93+}
94+
95+func (_c *MockContextMenuBuilder_Build_Call) RunAndReturn(run func(ctx context.Context, menuContext port.MenuContext) []port.MenuItem) *MockContextMenuBuilder_Build_Call {
96+ _c.Call.Return(run)
97+ return _c
98+}
99+
100+// NewMockContextMenuActionExecutor creates a new instance of MockContextMenuActionExecutor. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
101+// The first argument is typically a *testing.T value.
102+func NewMockContextMenuActionExecutor(t interface {
103+ mock.TestingT
104+ Cleanup(func())
105+}) *MockContextMenuActionExecutor {
106+ mock := &MockContextMenuActionExecutor{}
107+ mock.Mock.Test(t)
108+
109+ t.Cleanup(func() { mock.AssertExpectations(t) })
110+
111+ return mock
112+}
113+
114+// MockContextMenuActionExecutor is an autogenerated mock type for the ContextMenuActionExecutor type
115+type MockContextMenuActionExecutor struct {
116+ mock.Mock
117+}
118+
119+type MockContextMenuActionExecutor_Expecter struct {
120+ mock *mock.Mock
121+}
122+
123+func (_m *MockContextMenuActionExecutor) EXPECT() *MockContextMenuActionExecutor_Expecter {
124+ return &MockContextMenuActionExecutor_Expecter{mock: &_m.Mock}
125+}
126+
127+// ExecuteMenuAction provides a mock function for the type MockContextMenuActionExecutor
128+func (_mock *MockContextMenuActionExecutor) ExecuteMenuAction(ctx context.Context, action port.MenuAction, menuContext port.MenuContext) error {
129+ ret := _mock.Called(ctx, action, menuContext)
130+
131+ if len(ret) == 0 {
132+ panic("no return value specified for ExecuteMenuAction")
133+ }
134+
135+ var r0 error
136+ if returnFunc, ok := ret.Get(0).(func(context.Context, port.MenuAction, port.MenuContext) error); ok {
137+ r0 = returnFunc(ctx, action, menuContext)
138+ } else {
139+ r0 = ret.Error(0)
140+ }
141+ return r0
142+}
143+
144+// MockContextMenuActionExecutor_ExecuteMenuAction_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ExecuteMenuAction'
145+type MockContextMenuActionExecutor_ExecuteMenuAction_Call struct {
146+ *mock.Call
147+}
148+
149+// ExecuteMenuAction is a helper method to define mock.On call
150+// - ctx context.Context
151+// - action port.MenuAction
152+// - menuContext port.MenuContext
153+func (_e *MockContextMenuActionExecutor_Expecter) ExecuteMenuAction(ctx any, action any, menuContext any) *MockContextMenuActionExecutor_ExecuteMenuAction_Call {
154+ return &MockContextMenuActionExecutor_ExecuteMenuAction_Call{Call: _e.mock.On("ExecuteMenuAction", ctx, action, menuContext)}
155+}
156+
157+func (_c *MockContextMenuActionExecutor_ExecuteMenuAction_Call) Run(run func(ctx context.Context, action port.MenuAction, menuContext port.MenuContext)) *MockContextMenuActionExecutor_ExecuteMenuAction_Call {
158+ _c.Call.Run(func(args mock.Arguments) {
159+ var arg0 context.Context
160+ if args[0] != nil {
161+ arg0 = args[0].(context.Context)
162+ }
163+ var arg1 port.MenuAction
164+ if args[1] != nil {
165+ arg1 = args[1].(port.MenuAction)
166+ }
167+ var arg2 port.MenuContext
168+ if args[2] != nil {
169+ arg2 = args[2].(port.MenuContext)
170+ }
171+ run(
172+ arg0,
173+ arg1,
174+ arg2,
175+ )
176+ })
177+ return _c
178+}
179+
180+func (_c *MockContextMenuActionExecutor_ExecuteMenuAction_Call) Return(err error) *MockContextMenuActionExecutor_ExecuteMenuAction_Call {
181+ _c.Call.Return(err)
182+ return _c
183+}
184+
185+func (_c *MockContextMenuActionExecutor_ExecuteMenuAction_Call) RunAndReturn(run func(ctx context.Context, action port.MenuAction, menuContext port.MenuContext) error) *MockContextMenuActionExecutor_ExecuteMenuAction_Call {
186+ _c.Call.Return(run)
187+ return _c
188+}
189+
190+// NewMockContextMenuActionExecutorFactory creates a new instance of MockContextMenuActionExecutorFactory. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
191+// The first argument is typically a *testing.T value.
192+func NewMockContextMenuActionExecutorFactory(t interface {
193+ mock.TestingT
194+ Cleanup(func())
195+}) *MockContextMenuActionExecutorFactory {
196+ mock := &MockContextMenuActionExecutorFactory{}
197+ mock.Mock.Test(t)
198+
199+ t.Cleanup(func() { mock.AssertExpectations(t) })
200+
201+ return mock
202+}
203+
204+// MockContextMenuActionExecutorFactory is an autogenerated mock type for the ContextMenuActionExecutorFactory type
205+type MockContextMenuActionExecutorFactory struct {
206+ mock.Mock
207+}
208+
209+type MockContextMenuActionExecutorFactory_Expecter struct {
210+ mock *mock.Mock
211+}
212+
213+func (_m *MockContextMenuActionExecutorFactory) EXPECT() *MockContextMenuActionExecutorFactory_Expecter {
214+ return &MockContextMenuActionExecutorFactory_Expecter{mock: &_m.Mock}
215+}
216+
217+// NewContextMenuActionExecutor provides a mock function for the type MockContextMenuActionExecutorFactory
218+func (_mock *MockContextMenuActionExecutorFactory) NewContextMenuActionExecutor(clipboard port.Clipboard, resolver port.ImageDataResolver, saver port.ResolvedImageSaver, delegator port.MenuActionDelegator) port.ContextMenuActionExecutor {
219+ ret := _mock.Called(clipboard, resolver, saver, delegator)
220+
221+ if len(ret) == 0 {
222+ panic("no return value specified for NewContextMenuActionExecutor")
223+ }
224+
225+ var r0 port.ContextMenuActionExecutor
226+ if returnFunc, ok := ret.Get(0).(func(port.Clipboard, port.ImageDataResolver, port.ResolvedImageSaver, port.MenuActionDelegator) port.ContextMenuActionExecutor); ok {
227+ r0 = returnFunc(clipboard, resolver, saver, delegator)
228+ } else {
229+ if ret.Get(0) != nil {
230+ r0 = ret.Get(0).(port.ContextMenuActionExecutor)
231+ }
232+ }
233+ return r0
234+}
235+
236+// MockContextMenuActionExecutorFactory_NewContextMenuActionExecutor_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'NewContextMenuActionExecutor'
237+type MockContextMenuActionExecutorFactory_NewContextMenuActionExecutor_Call struct {
238+ *mock.Call
239+}
240+
241+// NewContextMenuActionExecutor is a helper method to define mock.On call
242+// - clipboard port.Clipboard
243+// - resolver port.ImageDataResolver
244+// - saver port.ResolvedImageSaver
245+// - delegator port.MenuActionDelegator
246+func (_e *MockContextMenuActionExecutorFactory_Expecter) NewContextMenuActionExecutor(clipboard any, resolver any, saver any, delegator any) *MockContextMenuActionExecutorFactory_NewContextMenuActionExecutor_Call {
247+ return &MockContextMenuActionExecutorFactory_NewContextMenuActionExecutor_Call{Call: _e.mock.On("NewContextMenuActionExecutor", clipboard, resolver, saver, delegator)}
248+}
249+
250+func (_c *MockContextMenuActionExecutorFactory_NewContextMenuActionExecutor_Call) Run(run func(clipboard port.Clipboard, resolver port.ImageDataResolver, saver port.ResolvedImageSaver, delegator port.MenuActionDelegator)) *MockContextMenuActionExecutorFactory_NewContextMenuActionExecutor_Call {
251+ _c.Call.Run(func(args mock.Arguments) {
252+ var arg0 port.Clipboard
253+ if args[0] != nil {
254+ arg0 = args[0].(port.Clipboard)
255+ }
256+ var arg1 port.ImageDataResolver
257+ if args[1] != nil {
258+ arg1 = args[1].(port.ImageDataResolver)
259+ }
260+ var arg2 port.ResolvedImageSaver
261+ if args[2] != nil {
262+ arg2 = args[2].(port.ResolvedImageSaver)
263+ }
264+ var arg3 port.MenuActionDelegator
265+ if args[3] != nil {
266+ arg3 = args[3].(port.MenuActionDelegator)
267+ }
268+ run(
269+ arg0,
270+ arg1,
271+ arg2,
272+ arg3,
273+ )
274+ })
275+ return _c
276+}
277+
278+func (_c *MockContextMenuActionExecutorFactory_NewContextMenuActionExecutor_Call) Return(contextMenuActionExecutor port.ContextMenuActionExecutor) *MockContextMenuActionExecutorFactory_NewContextMenuActionExecutor_Call {
279+ _c.Call.Return(contextMenuActionExecutor)
280+ return _c
281+}
282+
283+func (_c *MockContextMenuActionExecutorFactory_NewContextMenuActionExecutor_Call) RunAndReturn(run func(clipboard port.Clipboard, resolver port.ImageDataResolver, saver port.ResolvedImageSaver, delegator port.MenuActionDelegator) port.ContextMenuActionExecutor) *MockContextMenuActionExecutorFactory_NewContextMenuActionExecutor_Call {
284+ _c.Call.Return(run)
285+ return _c
286+}
287+
288+// NewMockMenuActionDelegator creates a new instance of MockMenuActionDelegator. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
289+// The first argument is typically a *testing.T value.
290+func NewMockMenuActionDelegator(t interface {
291+ mock.TestingT
292+ Cleanup(func())
293+}) *MockMenuActionDelegator {
294+ mock := &MockMenuActionDelegator{}
295+ mock.Mock.Test(t)
296+
297+ t.Cleanup(func() { mock.AssertExpectations(t) })
298+
299+ return mock
300+}
301+
302+// MockMenuActionDelegator is an autogenerated mock type for the MenuActionDelegator type
303+type MockMenuActionDelegator struct {
304+ mock.Mock
305+}
306+
307+type MockMenuActionDelegator_Expecter struct {
308+ mock *mock.Mock
309+}
310+
311+func (_m *MockMenuActionDelegator) EXPECT() *MockMenuActionDelegator_Expecter {
312+ return &MockMenuActionDelegator_Expecter{mock: &_m.Mock}
313+}
314+
315+// DelegateMenuAction provides a mock function for the type MockMenuActionDelegator
316+func (_mock *MockMenuActionDelegator) DelegateMenuAction(ctx context.Context, action port.MenuAction, menuContext port.MenuContext) error {
317+ ret := _mock.Called(ctx, action, menuContext)
318+
319+ if len(ret) == 0 {
320+ panic("no return value specified for DelegateMenuAction")
321+ }
322+
323+ var r0 error
324+ if returnFunc, ok := ret.Get(0).(func(context.Context, port.MenuAction, port.MenuContext) error); ok {
325+ r0 = returnFunc(ctx, action, menuContext)
326+ } else {
327+ r0 = ret.Error(0)
328+ }
329+ return r0
330+}
331+
332+// MockMenuActionDelegator_DelegateMenuAction_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'DelegateMenuAction'
333+type MockMenuActionDelegator_DelegateMenuAction_Call struct {
334+ *mock.Call
335+}
336+
337+// DelegateMenuAction is a helper method to define mock.On call
338+// - ctx context.Context
339+// - action port.MenuAction
340+// - menuContext port.MenuContext
341+func (_e *MockMenuActionDelegator_Expecter) DelegateMenuAction(ctx any, action any, menuContext any) *MockMenuActionDelegator_DelegateMenuAction_Call {
342+ return &MockMenuActionDelegator_DelegateMenuAction_Call{Call: _e.mock.On("DelegateMenuAction", ctx, action, menuContext)}
343+}
344+
345+func (_c *MockMenuActionDelegator_DelegateMenuAction_Call) Run(run func(ctx context.Context, action port.MenuAction, menuContext port.MenuContext)) *MockMenuActionDelegator_DelegateMenuAction_Call {
346+ _c.Call.Run(func(args mock.Arguments) {
347+ var arg0 context.Context
348+ if args[0] != nil {
349+ arg0 = args[0].(context.Context)
350+ }
351+ var arg1 port.MenuAction
352+ if args[1] != nil {
353+ arg1 = args[1].(port.MenuAction)
354+ }
355+ var arg2 port.MenuContext
356+ if args[2] != nil {
357+ arg2 = args[2].(port.MenuContext)
358+ }
359+ run(
360+ arg0,
361+ arg1,
362+ arg2,
363+ )
364+ })
365+ return _c
366+}
367+
368+func (_c *MockMenuActionDelegator_DelegateMenuAction_Call) Return(err error) *MockMenuActionDelegator_DelegateMenuAction_Call {
369+ _c.Call.Return(err)
370+ return _c
371+}
372+
373+func (_c *MockMenuActionDelegator_DelegateMenuAction_Call) RunAndReturn(run func(ctx context.Context, action port.MenuAction, menuContext port.MenuContext) error) *MockMenuActionDelegator_DelegateMenuAction_Call {
374+ _c.Call.Return(run)
375+ return _c
376+}
A internal/application/port/mocks/database.go +189 -0
@@ -0,0 +1,189 @@
1+// Code generated by mockery; DO NOT EDIT.
2+// github.com/vektra/mockery
3+// template: testify
4+
5+package mocks
6+
7+import (
8+ "context"
9+ "database/sql"
10+
11+ mock "github.com/stretchr/testify/mock"
12+)
13+
14+// NewMockDatabaseProvider creates a new instance of MockDatabaseProvider. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
15+// The first argument is typically a *testing.T value.
16+func NewMockDatabaseProvider(t interface {
17+ mock.TestingT
18+ Cleanup(func())
19+}) *MockDatabaseProvider {
20+ mock := &MockDatabaseProvider{}
21+ mock.Mock.Test(t)
22+
23+ t.Cleanup(func() { mock.AssertExpectations(t) })
24+
25+ return mock
26+}
27+
28+// MockDatabaseProvider is an autogenerated mock type for the DatabaseProvider type
29+type MockDatabaseProvider struct {
30+ mock.Mock
31+}
32+
33+type MockDatabaseProvider_Expecter struct {
34+ mock *mock.Mock
35+}
36+
37+func (_m *MockDatabaseProvider) EXPECT() *MockDatabaseProvider_Expecter {
38+ return &MockDatabaseProvider_Expecter{mock: &_m.Mock}
39+}
40+
41+// Close provides a mock function for the type MockDatabaseProvider
42+func (_mock *MockDatabaseProvider) Close() error {
43+ ret := _mock.Called()
44+
45+ if len(ret) == 0 {
46+ panic("no return value specified for Close")
47+ }
48+
49+ var r0 error
50+ if returnFunc, ok := ret.Get(0).(func() error); ok {
51+ r0 = returnFunc()
52+ } else {
53+ r0 = ret.Error(0)
54+ }
55+ return r0
56+}
57+
58+// MockDatabaseProvider_Close_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Close'
59+type MockDatabaseProvider_Close_Call struct {
60+ *mock.Call
61+}
62+
63+// Close is a helper method to define mock.On call
64+func (_e *MockDatabaseProvider_Expecter) Close() *MockDatabaseProvider_Close_Call {
65+ return &MockDatabaseProvider_Close_Call{Call: _e.mock.On("Close")}
66+}
67+
68+func (_c *MockDatabaseProvider_Close_Call) Run(run func()) *MockDatabaseProvider_Close_Call {
69+ _c.Call.Run(func(args mock.Arguments) {
70+ run()
71+ })
72+ return _c
73+}
74+
75+func (_c *MockDatabaseProvider_Close_Call) Return(err error) *MockDatabaseProvider_Close_Call {
76+ _c.Call.Return(err)
77+ return _c
78+}
79+
80+func (_c *MockDatabaseProvider_Close_Call) RunAndReturn(run func() error) *MockDatabaseProvider_Close_Call {
81+ _c.Call.Return(run)
82+ return _c
83+}
84+
85+// DB provides a mock function for the type MockDatabaseProvider
86+func (_mock *MockDatabaseProvider) DB(ctx context.Context) (*sql.DB, error) {
87+ ret := _mock.Called(ctx)
88+
89+ if len(ret) == 0 {
90+ panic("no return value specified for DB")
91+ }
92+
93+ var r0 *sql.DB
94+ var r1 error
95+ if returnFunc, ok := ret.Get(0).(func(context.Context) (*sql.DB, error)); ok {
96+ return returnFunc(ctx)
97+ }
98+ if returnFunc, ok := ret.Get(0).(func(context.Context) *sql.DB); ok {
99+ r0 = returnFunc(ctx)
100+ } else {
101+ if ret.Get(0) != nil {
102+ r0 = ret.Get(0).(*sql.DB)
103+ }
104+ }
105+ if returnFunc, ok := ret.Get(1).(func(context.Context) error); ok {
106+ r1 = returnFunc(ctx)
107+ } else {
108+ r1 = ret.Error(1)
109+ }
110+ return r0, r1
111+}
112+
113+// MockDatabaseProvider_DB_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'DB'
114+type MockDatabaseProvider_DB_Call struct {
115+ *mock.Call
116+}
117+
118+// DB is a helper method to define mock.On call
119+// - ctx context.Context
120+func (_e *MockDatabaseProvider_Expecter) DB(ctx any) *MockDatabaseProvider_DB_Call {
121+ return &MockDatabaseProvider_DB_Call{Call: _e.mock.On("DB", ctx)}
122+}
123+
124+func (_c *MockDatabaseProvider_DB_Call) Run(run func(ctx context.Context)) *MockDatabaseProvider_DB_Call {
125+ _c.Call.Run(func(args mock.Arguments) {
126+ var arg0 context.Context
127+ if args[0] != nil {
128+ arg0 = args[0].(context.Context)
129+ }
130+ run(
131+ arg0,
132+ )
133+ })
134+ return _c
135+}
136+
137+func (_c *MockDatabaseProvider_DB_Call) Return(dB *sql.DB, err error) *MockDatabaseProvider_DB_Call {
138+ _c.Call.Return(dB, err)
139+ return _c
140+}
141+
142+func (_c *MockDatabaseProvider_DB_Call) RunAndReturn(run func(ctx context.Context) (*sql.DB, error)) *MockDatabaseProvider_DB_Call {
143+ _c.Call.Return(run)
144+ return _c
145+}
146+
147+// IsInitialized provides a mock function for the type MockDatabaseProvider
148+func (_mock *MockDatabaseProvider) IsInitialized() bool {
149+ ret := _mock.Called()
150+
151+ if len(ret) == 0 {
152+ panic("no return value specified for IsInitialized")
153+ }
154+
155+ var r0 bool
156+ if returnFunc, ok := ret.Get(0).(func() bool); ok {
157+ r0 = returnFunc()
158+ } else {
159+ r0 = ret.Get(0).(bool)
160+ }
161+ return r0
162+}
163+
164+// MockDatabaseProvider_IsInitialized_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'IsInitialized'
165+type MockDatabaseProvider_IsInitialized_Call struct {
166+ *mock.Call
167+}
168+
169+// IsInitialized is a helper method to define mock.On call
170+func (_e *MockDatabaseProvider_Expecter) IsInitialized() *MockDatabaseProvider_IsInitialized_Call {
171+ return &MockDatabaseProvider_IsInitialized_Call{Call: _e.mock.On("IsInitialized")}
172+}
173+
174+func (_c *MockDatabaseProvider_IsInitialized_Call) Run(run func()) *MockDatabaseProvider_IsInitialized_Call {
175+ _c.Call.Run(func(args mock.Arguments) {
176+ run()
177+ })
178+ return _c
179+}
180+
181+func (_c *MockDatabaseProvider_IsInitialized_Call) Return(b bool) *MockDatabaseProvider_IsInitialized_Call {
182+ _c.Call.Return(b)
183+ return _c
184+}
185+
186+func (_c *MockDatabaseProvider_IsInitialized_Call) RunAndReturn(run func() bool) *MockDatabaseProvider_IsInitialized_Call {
187+ _c.Call.Return(run)
188+ return _c
189+}
A internal/application/port/mocks/desktop.go +431 -0
@@ -0,0 +1,431 @@
1+// Code generated by mockery; DO NOT EDIT.
2+// github.com/vektra/mockery
3+// template: testify
4+
5+package mocks
6+
7+import (
8+ "context"
9+
10+ "github.com/bnema/dumber/internal/application/port"
11+ mock "github.com/stretchr/testify/mock"
12+)
13+
14+// NewMockDesktopIntegration creates a new instance of MockDesktopIntegration. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
15+// The first argument is typically a *testing.T value.
16+func NewMockDesktopIntegration(t interface {
17+ mock.TestingT
18+ Cleanup(func())
19+}) *MockDesktopIntegration {
20+ mock := &MockDesktopIntegration{}
21+ mock.Mock.Test(t)
22+
23+ t.Cleanup(func() { mock.AssertExpectations(t) })
24+
25+ return mock
26+}
27+
28+// MockDesktopIntegration is an autogenerated mock type for the DesktopIntegration type
29+type MockDesktopIntegration struct {
30+ mock.Mock
31+}
32+
33+type MockDesktopIntegration_Expecter struct {
34+ mock *mock.Mock
35+}
36+
37+func (_m *MockDesktopIntegration) EXPECT() *MockDesktopIntegration_Expecter {
38+ return &MockDesktopIntegration_Expecter{mock: &_m.Mock}
39+}
40+
41+// GetStatus provides a mock function for the type MockDesktopIntegration
42+func (_mock *MockDesktopIntegration) GetStatus(ctx context.Context) (*port.DesktopIntegrationStatus, error) {
43+ ret := _mock.Called(ctx)
44+
45+ if len(ret) == 0 {
46+ panic("no return value specified for GetStatus")
47+ }
48+
49+ var r0 *port.DesktopIntegrationStatus
50+ var r1 error
51+ if returnFunc, ok := ret.Get(0).(func(context.Context) (*port.DesktopIntegrationStatus, error)); ok {
52+ return returnFunc(ctx)
53+ }
54+ if returnFunc, ok := ret.Get(0).(func(context.Context) *port.DesktopIntegrationStatus); ok {
55+ r0 = returnFunc(ctx)
56+ } else {
57+ if ret.Get(0) != nil {
58+ r0 = ret.Get(0).(*port.DesktopIntegrationStatus)
59+ }
60+ }
61+ if returnFunc, ok := ret.Get(1).(func(context.Context) error); ok {
62+ r1 = returnFunc(ctx)
63+ } else {
64+ r1 = ret.Error(1)
65+ }
66+ return r0, r1
67+}
68+
69+// MockDesktopIntegration_GetStatus_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetStatus'
70+type MockDesktopIntegration_GetStatus_Call struct {
71+ *mock.Call
72+}
73+
74+// GetStatus is a helper method to define mock.On call
75+// - ctx context.Context
76+func (_e *MockDesktopIntegration_Expecter) GetStatus(ctx any) *MockDesktopIntegration_GetStatus_Call {
77+ return &MockDesktopIntegration_GetStatus_Call{Call: _e.mock.On("GetStatus", ctx)}
78+}
79+
80+func (_c *MockDesktopIntegration_GetStatus_Call) Run(run func(ctx context.Context)) *MockDesktopIntegration_GetStatus_Call {
81+ _c.Call.Run(func(args mock.Arguments) {
82+ var arg0 context.Context
83+ if args[0] != nil {
84+ arg0 = args[0].(context.Context)
85+ }
86+ run(
87+ arg0,
88+ )
89+ })
90+ return _c
91+}
92+
93+func (_c *MockDesktopIntegration_GetStatus_Call) Return(desktopIntegrationStatus *port.DesktopIntegrationStatus, err error) *MockDesktopIntegration_GetStatus_Call {
94+ _c.Call.Return(desktopIntegrationStatus, err)
95+ return _c
96+}
97+
98+func (_c *MockDesktopIntegration_GetStatus_Call) RunAndReturn(run func(ctx context.Context) (*port.DesktopIntegrationStatus, error)) *MockDesktopIntegration_GetStatus_Call {
99+ _c.Call.Return(run)
100+ return _c
101+}
102+
103+// InstallDesktopFile provides a mock function for the type MockDesktopIntegration
104+func (_mock *MockDesktopIntegration) InstallDesktopFile(ctx context.Context) (string, error) {
105+ ret := _mock.Called(ctx)
106+
107+ if len(ret) == 0 {
108+ panic("no return value specified for InstallDesktopFile")
109+ }
110+
111+ var r0 string
112+ var r1 error
113+ if returnFunc, ok := ret.Get(0).(func(context.Context) (string, error)); ok {
114+ return returnFunc(ctx)
115+ }
116+ if returnFunc, ok := ret.Get(0).(func(context.Context) string); ok {
117+ r0 = returnFunc(ctx)
118+ } else {
119+ r0 = ret.Get(0).(string)
120+ }
121+ if returnFunc, ok := ret.Get(1).(func(context.Context) error); ok {
122+ r1 = returnFunc(ctx)
123+ } else {
124+ r1 = ret.Error(1)
125+ }
126+ return r0, r1
127+}
128+
129+// MockDesktopIntegration_InstallDesktopFile_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'InstallDesktopFile'
130+type MockDesktopIntegration_InstallDesktopFile_Call struct {
131+ *mock.Call
132+}
133+
134+// InstallDesktopFile is a helper method to define mock.On call
135+// - ctx context.Context
136+func (_e *MockDesktopIntegration_Expecter) InstallDesktopFile(ctx any) *MockDesktopIntegration_InstallDesktopFile_Call {
137+ return &MockDesktopIntegration_InstallDesktopFile_Call{Call: _e.mock.On("InstallDesktopFile", ctx)}
138+}
139+
140+func (_c *MockDesktopIntegration_InstallDesktopFile_Call) Run(run func(ctx context.Context)) *MockDesktopIntegration_InstallDesktopFile_Call {
141+ _c.Call.Run(func(args mock.Arguments) {
142+ var arg0 context.Context
143+ if args[0] != nil {
144+ arg0 = args[0].(context.Context)
145+ }
146+ run(
147+ arg0,
148+ )
149+ })
150+ return _c
151+}
152+
153+func (_c *MockDesktopIntegration_InstallDesktopFile_Call) Return(s string, err error) *MockDesktopIntegration_InstallDesktopFile_Call {
154+ _c.Call.Return(s, err)
155+ return _c
156+}
157+
158+func (_c *MockDesktopIntegration_InstallDesktopFile_Call) RunAndReturn(run func(ctx context.Context) (string, error)) *MockDesktopIntegration_InstallDesktopFile_Call {
159+ _c.Call.Return(run)
160+ return _c
161+}
162+
163+// InstallIcon provides a mock function for the type MockDesktopIntegration
164+func (_mock *MockDesktopIntegration) InstallIcon(ctx context.Context, svgData []byte) (string, error) {
165+ ret := _mock.Called(ctx, svgData)
166+
167+ if len(ret) == 0 {
168+ panic("no return value specified for InstallIcon")
169+ }
170+
171+ var r0 string
172+ var r1 error
173+ if returnFunc, ok := ret.Get(0).(func(context.Context, []byte) (string, error)); ok {
174+ return returnFunc(ctx, svgData)
175+ }
176+ if returnFunc, ok := ret.Get(0).(func(context.Context, []byte) string); ok {
177+ r0 = returnFunc(ctx, svgData)
178+ } else {
179+ r0 = ret.Get(0).(string)
180+ }
181+ if returnFunc, ok := ret.Get(1).(func(context.Context, []byte) error); ok {
182+ r1 = returnFunc(ctx, svgData)
183+ } else {
184+ r1 = ret.Error(1)
185+ }
186+ return r0, r1
187+}
188+
189+// MockDesktopIntegration_InstallIcon_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'InstallIcon'
190+type MockDesktopIntegration_InstallIcon_Call struct {
191+ *mock.Call
192+}
193+
194+// InstallIcon is a helper method to define mock.On call
195+// - ctx context.Context
196+// - svgData []byte
197+func (_e *MockDesktopIntegration_Expecter) InstallIcon(ctx any, svgData any) *MockDesktopIntegration_InstallIcon_Call {
198+ return &MockDesktopIntegration_InstallIcon_Call{Call: _e.mock.On("InstallIcon", ctx, svgData)}
199+}
200+
201+func (_c *MockDesktopIntegration_InstallIcon_Call) Run(run func(ctx context.Context, svgData []byte)) *MockDesktopIntegration_InstallIcon_Call {
202+ _c.Call.Run(func(args mock.Arguments) {
203+ var arg0 context.Context
204+ if args[0] != nil {
205+ arg0 = args[0].(context.Context)
206+ }
207+ var arg1 []byte
208+ if args[1] != nil {
209+ arg1 = args[1].([]byte)
210+ }
211+ run(
212+ arg0,
213+ arg1,
214+ )
215+ })
216+ return _c
217+}
218+
219+func (_c *MockDesktopIntegration_InstallIcon_Call) Return(s string, err error) *MockDesktopIntegration_InstallIcon_Call {
220+ _c.Call.Return(s, err)
221+ return _c
222+}
223+
224+func (_c *MockDesktopIntegration_InstallIcon_Call) RunAndReturn(run func(ctx context.Context, svgData []byte) (string, error)) *MockDesktopIntegration_InstallIcon_Call {
225+ _c.Call.Return(run)
226+ return _c
227+}
228+
229+// RemoveDesktopFile provides a mock function for the type MockDesktopIntegration
230+func (_mock *MockDesktopIntegration) RemoveDesktopFile(ctx context.Context) error {
231+ ret := _mock.Called(ctx)
232+
233+ if len(ret) == 0 {
234+ panic("no return value specified for RemoveDesktopFile")
235+ }
236+
237+ var r0 error
238+ if returnFunc, ok := ret.Get(0).(func(context.Context) error); ok {
239+ r0 = returnFunc(ctx)
240+ } else {
241+ r0 = ret.Error(0)
242+ }
243+ return r0
244+}
245+
246+// MockDesktopIntegration_RemoveDesktopFile_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'RemoveDesktopFile'
247+type MockDesktopIntegration_RemoveDesktopFile_Call struct {
248+ *mock.Call
249+}
250+
251+// RemoveDesktopFile is a helper method to define mock.On call
252+// - ctx context.Context
253+func (_e *MockDesktopIntegration_Expecter) RemoveDesktopFile(ctx any) *MockDesktopIntegration_RemoveDesktopFile_Call {
254+ return &MockDesktopIntegration_RemoveDesktopFile_Call{Call: _e.mock.On("RemoveDesktopFile", ctx)}
255+}
256+
257+func (_c *MockDesktopIntegration_RemoveDesktopFile_Call) Run(run func(ctx context.Context)) *MockDesktopIntegration_RemoveDesktopFile_Call {
258+ _c.Call.Run(func(args mock.Arguments) {
259+ var arg0 context.Context
260+ if args[0] != nil {
261+ arg0 = args[0].(context.Context)
262+ }
263+ run(
264+ arg0,
265+ )
266+ })
267+ return _c
268+}
269+
270+func (_c *MockDesktopIntegration_RemoveDesktopFile_Call) Return(err error) *MockDesktopIntegration_RemoveDesktopFile_Call {
271+ _c.Call.Return(err)
272+ return _c
273+}
274+
275+func (_c *MockDesktopIntegration_RemoveDesktopFile_Call) RunAndReturn(run func(ctx context.Context) error) *MockDesktopIntegration_RemoveDesktopFile_Call {
276+ _c.Call.Return(run)
277+ return _c
278+}
279+
280+// RemoveIcon provides a mock function for the type MockDesktopIntegration
281+func (_mock *MockDesktopIntegration) RemoveIcon(ctx context.Context) error {
282+ ret := _mock.Called(ctx)
283+
284+ if len(ret) == 0 {
285+ panic("no return value specified for RemoveIcon")
286+ }
287+
288+ var r0 error
289+ if returnFunc, ok := ret.Get(0).(func(context.Context) error); ok {
290+ r0 = returnFunc(ctx)
291+ } else {
292+ r0 = ret.Error(0)
293+ }
294+ return r0
295+}
296+
297+// MockDesktopIntegration_RemoveIcon_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'RemoveIcon'
298+type MockDesktopIntegration_RemoveIcon_Call struct {
299+ *mock.Call
300+}
301+
302+// RemoveIcon is a helper method to define mock.On call
303+// - ctx context.Context
304+func (_e *MockDesktopIntegration_Expecter) RemoveIcon(ctx any) *MockDesktopIntegration_RemoveIcon_Call {
305+ return &MockDesktopIntegration_RemoveIcon_Call{Call: _e.mock.On("RemoveIcon", ctx)}
306+}
307+
308+func (_c *MockDesktopIntegration_RemoveIcon_Call) Run(run func(ctx context.Context)) *MockDesktopIntegration_RemoveIcon_Call {
309+ _c.Call.Run(func(args mock.Arguments) {
310+ var arg0 context.Context
311+ if args[0] != nil {
312+ arg0 = args[0].(context.Context)
313+ }
314+ run(
315+ arg0,
316+ )
317+ })
318+ return _c
319+}
320+
321+func (_c *MockDesktopIntegration_RemoveIcon_Call) Return(err error) *MockDesktopIntegration_RemoveIcon_Call {
322+ _c.Call.Return(err)
323+ return _c
324+}
325+
326+func (_c *MockDesktopIntegration_RemoveIcon_Call) RunAndReturn(run func(ctx context.Context) error) *MockDesktopIntegration_RemoveIcon_Call {
327+ _c.Call.Return(run)
328+ return _c
329+}
330+
331+// SetAsDefaultBrowser provides a mock function for the type MockDesktopIntegration
332+func (_mock *MockDesktopIntegration) SetAsDefaultBrowser(ctx context.Context) error {
333+ ret := _mock.Called(ctx)
334+
335+ if len(ret) == 0 {
336+ panic("no return value specified for SetAsDefaultBrowser")
337+ }
338+
339+ var r0 error
340+ if returnFunc, ok := ret.Get(0).(func(context.Context) error); ok {
341+ r0 = returnFunc(ctx)
342+ } else {
343+ r0 = ret.Error(0)
344+ }
345+ return r0
346+}
347+
348+// MockDesktopIntegration_SetAsDefaultBrowser_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'SetAsDefaultBrowser'
349+type MockDesktopIntegration_SetAsDefaultBrowser_Call struct {
350+ *mock.Call
351+}
352+
353+// SetAsDefaultBrowser is a helper method to define mock.On call
354+// - ctx context.Context
355+func (_e *MockDesktopIntegration_Expecter) SetAsDefaultBrowser(ctx any) *MockDesktopIntegration_SetAsDefaultBrowser_Call {
356+ return &MockDesktopIntegration_SetAsDefaultBrowser_Call{Call: _e.mock.On("SetAsDefaultBrowser", ctx)}
357+}
358+
359+func (_c *MockDesktopIntegration_SetAsDefaultBrowser_Call) Run(run func(ctx context.Context)) *MockDesktopIntegration_SetAsDefaultBrowser_Call {
360+ _c.Call.Run(func(args mock.Arguments) {
361+ var arg0 context.Context
362+ if args[0] != nil {
363+ arg0 = args[0].(context.Context)
364+ }
365+ run(
366+ arg0,
367+ )
368+ })
369+ return _c
370+}
371+
372+func (_c *MockDesktopIntegration_SetAsDefaultBrowser_Call) Return(err error) *MockDesktopIntegration_SetAsDefaultBrowser_Call {
373+ _c.Call.Return(err)
374+ return _c
375+}
376+
377+func (_c *MockDesktopIntegration_SetAsDefaultBrowser_Call) RunAndReturn(run func(ctx context.Context) error) *MockDesktopIntegration_SetAsDefaultBrowser_Call {
378+ _c.Call.Return(run)
379+ return _c
380+}
381+
382+// UnsetAsDefaultBrowser provides a mock function for the type MockDesktopIntegration
383+func (_mock *MockDesktopIntegration) UnsetAsDefaultBrowser(ctx context.Context) error {
384+ ret := _mock.Called(ctx)
385+
386+ if len(ret) == 0 {
387+ panic("no return value specified for UnsetAsDefaultBrowser")
388+ }
389+
390+ var r0 error
391+ if returnFunc, ok := ret.Get(0).(func(context.Context) error); ok {
392+ r0 = returnFunc(ctx)
393+ } else {
394+ r0 = ret.Error(0)
395+ }
396+ return r0
397+}
398+
399+// MockDesktopIntegration_UnsetAsDefaultBrowser_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UnsetAsDefaultBrowser'
400+type MockDesktopIntegration_UnsetAsDefaultBrowser_Call struct {
401+ *mock.Call
402+}
403+
404+// UnsetAsDefaultBrowser is a helper method to define mock.On call
405+// - ctx context.Context
406+func (_e *MockDesktopIntegration_Expecter) UnsetAsDefaultBrowser(ctx any) *MockDesktopIntegration_UnsetAsDefaultBrowser_Call {
407+ return &MockDesktopIntegration_UnsetAsDefaultBrowser_Call{Call: _e.mock.On("UnsetAsDefaultBrowser", ctx)}
408+}
409+
410+func (_c *MockDesktopIntegration_UnsetAsDefaultBrowser_Call) Run(run func(ctx context.Context)) *MockDesktopIntegration_UnsetAsDefaultBrowser_Call {
411+ _c.Call.Run(func(args mock.Arguments) {
412+ var arg0 context.Context
413+ if args[0] != nil {
414+ arg0 = args[0].(context.Context)
415+ }
416+ run(
417+ arg0,
418+ )
419+ })
420+ return _c
421+}
422+
423+func (_c *MockDesktopIntegration_UnsetAsDefaultBrowser_Call) Return(err error) *MockDesktopIntegration_UnsetAsDefaultBrowser_Call {
424+ _c.Call.Return(err)
425+ return _c
426+}
427+
428+func (_c *MockDesktopIntegration_UnsetAsDefaultBrowser_Call) RunAndReturn(run func(ctx context.Context) error) *MockDesktopIntegration_UnsetAsDefaultBrowser_Call {
429+ _c.Call.Return(run)
430+ return _c
431+}
A internal/application/port/mocks/download.go +244 -0
@@ -0,0 +1,244 @@
1+// Code generated by mockery; DO NOT EDIT.
2+// github.com/vektra/mockery
3+// template: testify
4+
5+package mocks
6+
7+import (
8+ "context"
9+
10+ "github.com/bnema/dumber/internal/application/port"
11+ mock "github.com/stretchr/testify/mock"
12+)
13+
14+// NewMockDownloadEventHandler creates a new instance of MockDownloadEventHandler. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
15+// The first argument is typically a *testing.T value.
16+func NewMockDownloadEventHandler(t interface {
17+ mock.TestingT
18+ Cleanup(func())
19+}) *MockDownloadEventHandler {
20+ mock := &MockDownloadEventHandler{}
21+ mock.Mock.Test(t)
22+
23+ t.Cleanup(func() { mock.AssertExpectations(t) })
24+
25+ return mock
26+}
27+
28+// MockDownloadEventHandler is an autogenerated mock type for the DownloadEventHandler type
29+type MockDownloadEventHandler struct {
30+ mock.Mock
31+}
32+
33+type MockDownloadEventHandler_Expecter struct {
34+ mock *mock.Mock
35+}
36+
37+func (_m *MockDownloadEventHandler) EXPECT() *MockDownloadEventHandler_Expecter {
38+ return &MockDownloadEventHandler_Expecter{mock: &_m.Mock}
39+}
40+
41+// OnDownloadEvent provides a mock function for the type MockDownloadEventHandler
42+func (_mock *MockDownloadEventHandler) OnDownloadEvent(ctx context.Context, event port.DownloadEvent) {
43+ _mock.Called(ctx, event)
44+ return
45+}
46+
47+// MockDownloadEventHandler_OnDownloadEvent_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'OnDownloadEvent'
48+type MockDownloadEventHandler_OnDownloadEvent_Call struct {
49+ *mock.Call
50+}
51+
52+// OnDownloadEvent is a helper method to define mock.On call
53+// - ctx context.Context
54+// - event port.DownloadEvent
55+func (_e *MockDownloadEventHandler_Expecter) OnDownloadEvent(ctx any, event any) *MockDownloadEventHandler_OnDownloadEvent_Call {
56+ return &MockDownloadEventHandler_OnDownloadEvent_Call{Call: _e.mock.On("OnDownloadEvent", ctx, event)}
57+}
58+
59+func (_c *MockDownloadEventHandler_OnDownloadEvent_Call) Run(run func(ctx context.Context, event port.DownloadEvent)) *MockDownloadEventHandler_OnDownloadEvent_Call {
60+ _c.Call.Run(func(args mock.Arguments) {
61+ var arg0 context.Context
62+ if args[0] != nil {
63+ arg0 = args[0].(context.Context)
64+ }
65+ var arg1 port.DownloadEvent
66+ if args[1] != nil {
67+ arg1 = args[1].(port.DownloadEvent)
68+ }
69+ run(
70+ arg0,
71+ arg1,
72+ )
73+ })
74+ return _c
75+}
76+
77+func (_c *MockDownloadEventHandler_OnDownloadEvent_Call) Return() *MockDownloadEventHandler_OnDownloadEvent_Call {
78+ _c.Call.Return()
79+ return _c
80+}
81+
82+func (_c *MockDownloadEventHandler_OnDownloadEvent_Call) RunAndReturn(run func(ctx context.Context, event port.DownloadEvent)) *MockDownloadEventHandler_OnDownloadEvent_Call {
83+ _c.Run(run)
84+ return _c
85+}
86+
87+// NewMockDownloadResponse creates a new instance of MockDownloadResponse. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
88+// The first argument is typically a *testing.T value.
89+func NewMockDownloadResponse(t interface {
90+ mock.TestingT
91+ Cleanup(func())
92+}) *MockDownloadResponse {
93+ mock := &MockDownloadResponse{}
94+ mock.Mock.Test(t)
95+
96+ t.Cleanup(func() { mock.AssertExpectations(t) })
97+
98+ return mock
99+}
100+
101+// MockDownloadResponse is an autogenerated mock type for the DownloadResponse type
102+type MockDownloadResponse struct {
103+ mock.Mock
104+}
105+
106+type MockDownloadResponse_Expecter struct {
107+ mock *mock.Mock
108+}
109+
110+func (_m *MockDownloadResponse) EXPECT() *MockDownloadResponse_Expecter {
111+ return &MockDownloadResponse_Expecter{mock: &_m.Mock}
112+}
113+
114+// GetMimeType provides a mock function for the type MockDownloadResponse
115+func (_mock *MockDownloadResponse) GetMimeType() string {
116+ ret := _mock.Called()
117+
118+ if len(ret) == 0 {
119+ panic("no return value specified for GetMimeType")
120+ }
121+
122+ var r0 string
123+ if returnFunc, ok := ret.Get(0).(func() string); ok {
124+ r0 = returnFunc()
125+ } else {
126+ r0 = ret.Get(0).(string)
127+ }
128+ return r0
129+}
130+
131+// MockDownloadResponse_GetMimeType_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetMimeType'
132+type MockDownloadResponse_GetMimeType_Call struct {
133+ *mock.Call
134+}
135+
136+// GetMimeType is a helper method to define mock.On call
137+func (_e *MockDownloadResponse_Expecter) GetMimeType() *MockDownloadResponse_GetMimeType_Call {
138+ return &MockDownloadResponse_GetMimeType_Call{Call: _e.mock.On("GetMimeType")}
139+}
140+
141+func (_c *MockDownloadResponse_GetMimeType_Call) Run(run func()) *MockDownloadResponse_GetMimeType_Call {
142+ _c.Call.Run(func(args mock.Arguments) {
143+ run()
144+ })
145+ return _c
146+}
147+
148+func (_c *MockDownloadResponse_GetMimeType_Call) Return(s string) *MockDownloadResponse_GetMimeType_Call {
149+ _c.Call.Return(s)
150+ return _c
151+}
152+
153+func (_c *MockDownloadResponse_GetMimeType_Call) RunAndReturn(run func() string) *MockDownloadResponse_GetMimeType_Call {
154+ _c.Call.Return(run)
155+ return _c
156+}
157+
158+// GetSuggestedFilename provides a mock function for the type MockDownloadResponse
159+func (_mock *MockDownloadResponse) GetSuggestedFilename() string {
160+ ret := _mock.Called()
161+
162+ if len(ret) == 0 {
163+ panic("no return value specified for GetSuggestedFilename")
164+ }
165+
166+ var r0 string
167+ if returnFunc, ok := ret.Get(0).(func() string); ok {
168+ r0 = returnFunc()
169+ } else {
170+ r0 = ret.Get(0).(string)
171+ }
172+ return r0
173+}
174+
175+// MockDownloadResponse_GetSuggestedFilename_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetSuggestedFilename'
176+type MockDownloadResponse_GetSuggestedFilename_Call struct {
177+ *mock.Call
178+}
179+
180+// GetSuggestedFilename is a helper method to define mock.On call
181+func (_e *MockDownloadResponse_Expecter) GetSuggestedFilename() *MockDownloadResponse_GetSuggestedFilename_Call {
182+ return &MockDownloadResponse_GetSuggestedFilename_Call{Call: _e.mock.On("GetSuggestedFilename")}
183+}
184+
185+func (_c *MockDownloadResponse_GetSuggestedFilename_Call) Run(run func()) *MockDownloadResponse_GetSuggestedFilename_Call {
186+ _c.Call.Run(func(args mock.Arguments) {
187+ run()
188+ })
189+ return _c
190+}
191+
192+func (_c *MockDownloadResponse_GetSuggestedFilename_Call) Return(s string) *MockDownloadResponse_GetSuggestedFilename_Call {
193+ _c.Call.Return(s)
194+ return _c
195+}
196+
197+func (_c *MockDownloadResponse_GetSuggestedFilename_Call) RunAndReturn(run func() string) *MockDownloadResponse_GetSuggestedFilename_Call {
198+ _c.Call.Return(run)
199+ return _c
200+}
201+
202+// GetUri provides a mock function for the type MockDownloadResponse
203+func (_mock *MockDownloadResponse) GetUri() string {
204+ ret := _mock.Called()
205+
206+ if len(ret) == 0 {
207+ panic("no return value specified for GetUri")
208+ }
209+
210+ var r0 string
211+ if returnFunc, ok := ret.Get(0).(func() string); ok {
212+ r0 = returnFunc()
213+ } else {
214+ r0 = ret.Get(0).(string)
215+ }
216+ return r0
217+}
218+
219+// MockDownloadResponse_GetUri_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetUri'
220+type MockDownloadResponse_GetUri_Call struct {
221+ *mock.Call
222+}
223+
224+// GetUri is a helper method to define mock.On call
225+func (_e *MockDownloadResponse_Expecter) GetUri() *MockDownloadResponse_GetUri_Call {
226+ return &MockDownloadResponse_GetUri_Call{Call: _e.mock.On("GetUri")}
227+}
228+
229+func (_c *MockDownloadResponse_GetUri_Call) Run(run func()) *MockDownloadResponse_GetUri_Call {
230+ _c.Call.Run(func(args mock.Arguments) {
231+ run()
232+ })
233+ return _c
234+}
235+
236+func (_c *MockDownloadResponse_GetUri_Call) Return(s string) *MockDownloadResponse_GetUri_Call {
237+ _c.Call.Return(s)
238+ return _c
239+}
240+
241+func (_c *MockDownloadResponse_GetUri_Call) RunAndReturn(run func() string) *MockDownloadResponse_GetUri_Call {
242+ _c.Call.Return(run)
243+ return _c
244+}
A internal/application/port/mocks/engine.go +1659 -0
@@ -0,0 +1,1659 @@
1+// Code generated by mockery; DO NOT EDIT.
2+// github.com/vektra/mockery
3+// template: testify
4+
5+package mocks
6+
7+import (
8+ "context"
9+ "encoding/json"
10+
11+ "github.com/bnema/dumber/internal/application/port"
12+ "github.com/bnema/dumber/internal/domain/entity"
13+ mock "github.com/stretchr/testify/mock"
14+)
15+
16+// NewMockMemoryPressureApplier creates a new instance of MockMemoryPressureApplier. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
17+// The first argument is typically a *testing.T value.
18+func NewMockMemoryPressureApplier(t interface {
19+ mock.TestingT
20+ Cleanup(func())
21+}) *MockMemoryPressureApplier {
22+ mock := &MockMemoryPressureApplier{}
23+ mock.Mock.Test(t)
24+
25+ t.Cleanup(func() { mock.AssertExpectations(t) })
26+
27+ return mock
28+}
29+
30+// MockMemoryPressureApplier is an autogenerated mock type for the MemoryPressureApplier type
31+type MockMemoryPressureApplier struct {
32+ mock.Mock
33+}
34+
35+type MockMemoryPressureApplier_Expecter struct {
36+ mock *mock.Mock
37+}
38+
39+func (_m *MockMemoryPressureApplier) EXPECT() *MockMemoryPressureApplier_Expecter {
40+ return &MockMemoryPressureApplier_Expecter{mock: &_m.Mock}
41+}
42+
43+// ApplyNetworkProcessSettings provides a mock function for the type MockMemoryPressureApplier
44+func (_mock *MockMemoryPressureApplier) ApplyNetworkProcessSettings(ctx context.Context, cfg *port.MemoryPressureConfig) error {
45+ ret := _mock.Called(ctx, cfg)
46+
47+ if len(ret) == 0 {
48+ panic("no return value specified for ApplyNetworkProcessSettings")
49+ }
50+
51+ var r0 error
52+ if returnFunc, ok := ret.Get(0).(func(context.Context, *port.MemoryPressureConfig) error); ok {
53+ r0 = returnFunc(ctx, cfg)
54+ } else {
55+ r0 = ret.Error(0)
56+ }
57+ return r0
58+}
59+
60+// MockMemoryPressureApplier_ApplyNetworkProcessSettings_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ApplyNetworkProcessSettings'
61+type MockMemoryPressureApplier_ApplyNetworkProcessSettings_Call struct {
62+ *mock.Call
63+}
64+
65+// ApplyNetworkProcessSettings is a helper method to define mock.On call
66+// - ctx context.Context
67+// - cfg *port.MemoryPressureConfig
68+func (_e *MockMemoryPressureApplier_Expecter) ApplyNetworkProcessSettings(ctx any, cfg any) *MockMemoryPressureApplier_ApplyNetworkProcessSettings_Call {
69+ return &MockMemoryPressureApplier_ApplyNetworkProcessSettings_Call{Call: _e.mock.On("ApplyNetworkProcessSettings", ctx, cfg)}
70+}
71+
72+func (_c *MockMemoryPressureApplier_ApplyNetworkProcessSettings_Call) Run(run func(ctx context.Context, cfg *port.MemoryPressureConfig)) *MockMemoryPressureApplier_ApplyNetworkProcessSettings_Call {
73+ _c.Call.Run(func(args mock.Arguments) {
74+ var arg0 context.Context
75+ if args[0] != nil {
76+ arg0 = args[0].(context.Context)
77+ }
78+ var arg1 *port.MemoryPressureConfig
79+ if args[1] != nil {
80+ arg1 = args[1].(*port.MemoryPressureConfig)
81+ }
82+ run(
83+ arg0,
84+ arg1,
85+ )
86+ })
87+ return _c
88+}
89+
90+func (_c *MockMemoryPressureApplier_ApplyNetworkProcessSettings_Call) Return(err error) *MockMemoryPressureApplier_ApplyNetworkProcessSettings_Call {
91+ _c.Call.Return(err)
92+ return _c
93+}
94+
95+func (_c *MockMemoryPressureApplier_ApplyNetworkProcessSettings_Call) RunAndReturn(run func(ctx context.Context, cfg *port.MemoryPressureConfig) error) *MockMemoryPressureApplier_ApplyNetworkProcessSettings_Call {
96+ _c.Call.Return(run)
97+ return _c
98+}
99+
100+// ApplyWebProcessSettings provides a mock function for the type MockMemoryPressureApplier
101+func (_mock *MockMemoryPressureApplier) ApplyWebProcessSettings(ctx context.Context, cfg *port.MemoryPressureConfig) (any, error) {
102+ ret := _mock.Called(ctx, cfg)
103+
104+ if len(ret) == 0 {
105+ panic("no return value specified for ApplyWebProcessSettings")
106+ }
107+
108+ var r0 any
109+ var r1 error
110+ if returnFunc, ok := ret.Get(0).(func(context.Context, *port.MemoryPressureConfig) (any, error)); ok {
111+ return returnFunc(ctx, cfg)
112+ }
113+ if returnFunc, ok := ret.Get(0).(func(context.Context, *port.MemoryPressureConfig) any); ok {
114+ r0 = returnFunc(ctx, cfg)
115+ } else {
116+ if ret.Get(0) != nil {
117+ r0 = ret.Get(0).(any)
118+ }
119+ }
120+ if returnFunc, ok := ret.Get(1).(func(context.Context, *port.MemoryPressureConfig) error); ok {
121+ r1 = returnFunc(ctx, cfg)
122+ } else {
123+ r1 = ret.Error(1)
124+ }
125+ return r0, r1
126+}
127+
128+// MockMemoryPressureApplier_ApplyWebProcessSettings_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ApplyWebProcessSettings'
129+type MockMemoryPressureApplier_ApplyWebProcessSettings_Call struct {
130+ *mock.Call
131+}
132+
133+// ApplyWebProcessSettings is a helper method to define mock.On call
134+// - ctx context.Context
135+// - cfg *port.MemoryPressureConfig
136+func (_e *MockMemoryPressureApplier_Expecter) ApplyWebProcessSettings(ctx any, cfg any) *MockMemoryPressureApplier_ApplyWebProcessSettings_Call {
137+ return &MockMemoryPressureApplier_ApplyWebProcessSettings_Call{Call: _e.mock.On("ApplyWebProcessSettings", ctx, cfg)}
138+}
139+
140+func (_c *MockMemoryPressureApplier_ApplyWebProcessSettings_Call) Run(run func(ctx context.Context, cfg *port.MemoryPressureConfig)) *MockMemoryPressureApplier_ApplyWebProcessSettings_Call {
141+ _c.Call.Run(func(args mock.Arguments) {
142+ var arg0 context.Context
143+ if args[0] != nil {
144+ arg0 = args[0].(context.Context)
145+ }
146+ var arg1 *port.MemoryPressureConfig
147+ if args[1] != nil {
148+ arg1 = args[1].(*port.MemoryPressureConfig)
149+ }
150+ run(
151+ arg0,
152+ arg1,
153+ )
154+ })
155+ return _c
156+}
157+
158+func (_c *MockMemoryPressureApplier_ApplyWebProcessSettings_Call) Return(v any, err error) *MockMemoryPressureApplier_ApplyWebProcessSettings_Call {
159+ _c.Call.Return(v, err)
160+ return _c
161+}
162+
163+func (_c *MockMemoryPressureApplier_ApplyWebProcessSettings_Call) RunAndReturn(run func(ctx context.Context, cfg *port.MemoryPressureConfig) (any, error)) *MockMemoryPressureApplier_ApplyWebProcessSettings_Call {
164+ _c.Call.Return(run)
165+ return _c
166+}
167+
168+// NewMockEngine creates a new instance of MockEngine. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
169+// The first argument is typically a *testing.T value.
170+func NewMockEngine(t interface {
171+ mock.TestingT
172+ Cleanup(func())
173+}) *MockEngine {
174+ mock := &MockEngine{}
175+ mock.Mock.Test(t)
176+
177+ t.Cleanup(func() { mock.AssertExpectations(t) })
178+
179+ return mock
180+}
181+
182+// MockEngine is an autogenerated mock type for the Engine type
183+type MockEngine struct {
184+ mock.Mock
185+}
186+
187+type MockEngine_Expecter struct {
188+ mock *mock.Mock
189+}
190+
191+func (_m *MockEngine) EXPECT() *MockEngine_Expecter {
192+ return &MockEngine_Expecter{mock: &_m.Mock}
193+}
194+
195+// Close provides a mock function for the type MockEngine
196+func (_mock *MockEngine) Close() error {
197+ ret := _mock.Called()
198+
199+ if len(ret) == 0 {
200+ panic("no return value specified for Close")
201+ }
202+
203+ var r0 error
204+ if returnFunc, ok := ret.Get(0).(func() error); ok {
205+ r0 = returnFunc()
206+ } else {
207+ r0 = ret.Error(0)
208+ }
209+ return r0
210+}
211+
212+// MockEngine_Close_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Close'
213+type MockEngine_Close_Call struct {
214+ *mock.Call
215+}
216+
217+// Close is a helper method to define mock.On call
218+func (_e *MockEngine_Expecter) Close() *MockEngine_Close_Call {
219+ return &MockEngine_Close_Call{Call: _e.mock.On("Close")}
220+}
221+
222+func (_c *MockEngine_Close_Call) Run(run func()) *MockEngine_Close_Call {
223+ _c.Call.Run(func(args mock.Arguments) {
224+ run()
225+ })
226+ return _c
227+}
228+
229+func (_c *MockEngine_Close_Call) Return(err error) *MockEngine_Close_Call {
230+ _c.Call.Return(err)
231+ return _c
232+}
233+
234+func (_c *MockEngine_Close_Call) RunAndReturn(run func() error) *MockEngine_Close_Call {
235+ _c.Call.Return(run)
236+ return _c
237+}
238+
239+// ConfigureDownloads provides a mock function for the type MockEngine
240+func (_mock *MockEngine) ConfigureDownloads(ctx context.Context, downloadPath string, eventHandler port.DownloadEventHandler, preparer port.DownloadPreparer) error {
241+ ret := _mock.Called(ctx, downloadPath, eventHandler, preparer)
242+
243+ if len(ret) == 0 {
244+ panic("no return value specified for ConfigureDownloads")
245+ }
246+
247+ var r0 error
248+ if returnFunc, ok := ret.Get(0).(func(context.Context, string, port.DownloadEventHandler, port.DownloadPreparer) error); ok {
249+ r0 = returnFunc(ctx, downloadPath, eventHandler, preparer)
250+ } else {
251+ r0 = ret.Error(0)
252+ }
253+ return r0
254+}
255+
256+// MockEngine_ConfigureDownloads_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ConfigureDownloads'
257+type MockEngine_ConfigureDownloads_Call struct {
258+ *mock.Call
259+}
260+
261+// ConfigureDownloads is a helper method to define mock.On call
262+// - ctx context.Context
263+// - downloadPath string
264+// - eventHandler port.DownloadEventHandler
265+// - preparer port.DownloadPreparer
266+func (_e *MockEngine_Expecter) ConfigureDownloads(ctx any, downloadPath any, eventHandler any, preparer any) *MockEngine_ConfigureDownloads_Call {
267+ return &MockEngine_ConfigureDownloads_Call{Call: _e.mock.On("ConfigureDownloads", ctx, downloadPath, eventHandler, preparer)}
268+}
269+
270+func (_c *MockEngine_ConfigureDownloads_Call) Run(run func(ctx context.Context, downloadPath string, eventHandler port.DownloadEventHandler, preparer port.DownloadPreparer)) *MockEngine_ConfigureDownloads_Call {
271+ _c.Call.Run(func(args mock.Arguments) {
272+ var arg0 context.Context
273+ if args[0] != nil {
274+ arg0 = args[0].(context.Context)
275+ }
276+ var arg1 string
277+ if args[1] != nil {
278+ arg1 = args[1].(string)
279+ }
280+ var arg2 port.DownloadEventHandler
281+ if args[2] != nil {
282+ arg2 = args[2].(port.DownloadEventHandler)
283+ }
284+ var arg3 port.DownloadPreparer
285+ if args[3] != nil {
286+ arg3 = args[3].(port.DownloadPreparer)
287+ }
288+ run(
289+ arg0,
290+ arg1,
291+ arg2,
292+ arg3,
293+ )
294+ })
295+ return _c
296+}
297+
298+func (_c *MockEngine_ConfigureDownloads_Call) Return(err error) *MockEngine_ConfigureDownloads_Call {
299+ _c.Call.Return(err)
300+ return _c
301+}
302+
303+func (_c *MockEngine_ConfigureDownloads_Call) RunAndReturn(run func(ctx context.Context, downloadPath string, eventHandler port.DownloadEventHandler, preparer port.DownloadPreparer) error) *MockEngine_ConfigureDownloads_Call {
304+ _c.Call.Return(run)
305+ return _c
306+}
307+
308+// ContentInjector provides a mock function for the type MockEngine
309+func (_mock *MockEngine) ContentInjector() port.ContentInjector {
310+ ret := _mock.Called()
311+
312+ if len(ret) == 0 {
313+ panic("no return value specified for ContentInjector")
314+ }
315+
316+ var r0 port.ContentInjector
317+ if returnFunc, ok := ret.Get(0).(func() port.ContentInjector); ok {
318+ r0 = returnFunc()
319+ } else {
320+ if ret.Get(0) != nil {
321+ r0 = ret.Get(0).(port.ContentInjector)
322+ }
323+ }
324+ return r0
325+}
326+
327+// MockEngine_ContentInjector_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ContentInjector'
328+type MockEngine_ContentInjector_Call struct {
329+ *mock.Call
330+}
331+
332+// ContentInjector is a helper method to define mock.On call
333+func (_e *MockEngine_Expecter) ContentInjector() *MockEngine_ContentInjector_Call {
334+ return &MockEngine_ContentInjector_Call{Call: _e.mock.On("ContentInjector")}
335+}
336+
337+func (_c *MockEngine_ContentInjector_Call) Run(run func()) *MockEngine_ContentInjector_Call {
338+ _c.Call.Run(func(args mock.Arguments) {
339+ run()
340+ })
341+ return _c
342+}
343+
344+func (_c *MockEngine_ContentInjector_Call) Return(contentInjector port.ContentInjector) *MockEngine_ContentInjector_Call {
345+ _c.Call.Return(contentInjector)
346+ return _c
347+}
348+
349+func (_c *MockEngine_ContentInjector_Call) RunAndReturn(run func() port.ContentInjector) *MockEngine_ContentInjector_Call {
350+ _c.Call.Return(run)
351+ return _c
352+}
353+
354+// Factory provides a mock function for the type MockEngine
355+func (_mock *MockEngine) Factory() port.WebViewFactory {
356+ ret := _mock.Called()
357+
358+ if len(ret) == 0 {
359+ panic("no return value specified for Factory")
360+ }
361+
362+ var r0 port.WebViewFactory
363+ if returnFunc, ok := ret.Get(0).(func() port.WebViewFactory); ok {
364+ r0 = returnFunc()
365+ } else {
366+ if ret.Get(0) != nil {
367+ r0 = ret.Get(0).(port.WebViewFactory)
368+ }
369+ }
370+ return r0
371+}
372+
373+// MockEngine_Factory_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Factory'
374+type MockEngine_Factory_Call struct {
375+ *mock.Call
376+}
377+
378+// Factory is a helper method to define mock.On call
379+func (_e *MockEngine_Expecter) Factory() *MockEngine_Factory_Call {
380+ return &MockEngine_Factory_Call{Call: _e.mock.On("Factory")}
381+}
382+
383+func (_c *MockEngine_Factory_Call) Run(run func()) *MockEngine_Factory_Call {
384+ _c.Call.Run(func(args mock.Arguments) {
385+ run()
386+ })
387+ return _c
388+}
389+
390+func (_c *MockEngine_Factory_Call) Return(webViewFactory port.WebViewFactory) *MockEngine_Factory_Call {
391+ _c.Call.Return(webViewFactory)
392+ return _c
393+}
394+
395+func (_c *MockEngine_Factory_Call) RunAndReturn(run func() port.WebViewFactory) *MockEngine_Factory_Call {
396+ _c.Call.Return(run)
397+ return _c
398+}
399+
400+// FaviconDatabase provides a mock function for the type MockEngine
401+func (_mock *MockEngine) FaviconDatabase() port.FaviconDatabase {
402+ ret := _mock.Called()
403+
404+ if len(ret) == 0 {
405+ panic("no return value specified for FaviconDatabase")
406+ }
407+
408+ var r0 port.FaviconDatabase
409+ if returnFunc, ok := ret.Get(0).(func() port.FaviconDatabase); ok {
410+ r0 = returnFunc()
411+ } else {
412+ if ret.Get(0) != nil {
413+ r0 = ret.Get(0).(port.FaviconDatabase)
414+ }
415+ }
416+ return r0
417+}
418+
419+// MockEngine_FaviconDatabase_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'FaviconDatabase'
420+type MockEngine_FaviconDatabase_Call struct {
421+ *mock.Call
422+}
423+
424+// FaviconDatabase is a helper method to define mock.On call
425+func (_e *MockEngine_Expecter) FaviconDatabase() *MockEngine_FaviconDatabase_Call {
426+ return &MockEngine_FaviconDatabase_Call{Call: _e.mock.On("FaviconDatabase")}
427+}
428+
429+func (_c *MockEngine_FaviconDatabase_Call) Run(run func()) *MockEngine_FaviconDatabase_Call {
430+ _c.Call.Run(func(args mock.Arguments) {
431+ run()
432+ })
433+ return _c
434+}
435+
436+func (_c *MockEngine_FaviconDatabase_Call) Return(faviconDatabase port.FaviconDatabase) *MockEngine_FaviconDatabase_Call {
437+ _c.Call.Return(faviconDatabase)
438+ return _c
439+}
440+
441+func (_c *MockEngine_FaviconDatabase_Call) RunAndReturn(run func() port.FaviconDatabase) *MockEngine_FaviconDatabase_Call {
442+ _c.Call.Return(run)
443+ return _c
444+}
445+
446+// FilterApplier provides a mock function for the type MockEngine
447+func (_mock *MockEngine) FilterApplier() port.FilterApplier {
448+ ret := _mock.Called()
449+
450+ if len(ret) == 0 {
451+ panic("no return value specified for FilterApplier")
452+ }
453+
454+ var r0 port.FilterApplier
455+ if returnFunc, ok := ret.Get(0).(func() port.FilterApplier); ok {
456+ r0 = returnFunc()
457+ } else {
458+ if ret.Get(0) != nil {
459+ r0 = ret.Get(0).(port.FilterApplier)
460+ }
461+ }
462+ return r0
463+}
464+
465+// MockEngine_FilterApplier_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'FilterApplier'
466+type MockEngine_FilterApplier_Call struct {
467+ *mock.Call
468+}
469+
470+// FilterApplier is a helper method to define mock.On call
471+func (_e *MockEngine_Expecter) FilterApplier() *MockEngine_FilterApplier_Call {
472+ return &MockEngine_FilterApplier_Call{Call: _e.mock.On("FilterApplier")}
473+}
474+
475+func (_c *MockEngine_FilterApplier_Call) Run(run func()) *MockEngine_FilterApplier_Call {
476+ _c.Call.Run(func(args mock.Arguments) {
477+ run()
478+ })
479+ return _c
480+}
481+
482+func (_c *MockEngine_FilterApplier_Call) Return(filterApplier port.FilterApplier) *MockEngine_FilterApplier_Call {
483+ _c.Call.Return(filterApplier)
484+ return _c
485+}
486+
487+func (_c *MockEngine_FilterApplier_Call) RunAndReturn(run func() port.FilterApplier) *MockEngine_FilterApplier_Call {
488+ _c.Call.Return(run)
489+ return _c
490+}
491+
492+// InternalSchemePath provides a mock function for the type MockEngine
493+func (_mock *MockEngine) InternalSchemePath() string {
494+ ret := _mock.Called()
495+
496+ if len(ret) == 0 {
497+ panic("no return value specified for InternalSchemePath")
498+ }
499+
500+ var r0 string
501+ if returnFunc, ok := ret.Get(0).(func() string); ok {
502+ r0 = returnFunc()
503+ } else {
504+ r0 = ret.Get(0).(string)
505+ }
506+ return r0
507+}
508+
509+// MockEngine_InternalSchemePath_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'InternalSchemePath'
510+type MockEngine_InternalSchemePath_Call struct {
511+ *mock.Call
512+}
513+
514+// InternalSchemePath is a helper method to define mock.On call
515+func (_e *MockEngine_Expecter) InternalSchemePath() *MockEngine_InternalSchemePath_Call {
516+ return &MockEngine_InternalSchemePath_Call{Call: _e.mock.On("InternalSchemePath")}
517+}
518+
519+func (_c *MockEngine_InternalSchemePath_Call) Run(run func()) *MockEngine_InternalSchemePath_Call {
520+ _c.Call.Run(func(args mock.Arguments) {
521+ run()
522+ })
523+ return _c
524+}
525+
526+func (_c *MockEngine_InternalSchemePath_Call) Return(s string) *MockEngine_InternalSchemePath_Call {
527+ _c.Call.Return(s)
528+ return _c
529+}
530+
531+func (_c *MockEngine_InternalSchemePath_Call) RunAndReturn(run func() string) *MockEngine_InternalSchemePath_Call {
532+ _c.Call.Return(run)
533+ return _c
534+}
535+
536+// OnToolkitReady provides a mock function for the type MockEngine
537+func (_mock *MockEngine) OnToolkitReady(ctx context.Context) error {
538+ ret := _mock.Called(ctx)
539+
540+ if len(ret) == 0 {
541+ panic("no return value specified for OnToolkitReady")
542+ }
543+
544+ var r0 error
545+ if returnFunc, ok := ret.Get(0).(func(context.Context) error); ok {
546+ r0 = returnFunc(ctx)
547+ } else {
548+ r0 = ret.Error(0)
549+ }
550+ return r0
551+}
552+
553+// MockEngine_OnToolkitReady_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'OnToolkitReady'
554+type MockEngine_OnToolkitReady_Call struct {
555+ *mock.Call
556+}
557+
558+// OnToolkitReady is a helper method to define mock.On call
559+// - ctx context.Context
560+func (_e *MockEngine_Expecter) OnToolkitReady(ctx any) *MockEngine_OnToolkitReady_Call {
561+ return &MockEngine_OnToolkitReady_Call{Call: _e.mock.On("OnToolkitReady", ctx)}
562+}
563+
564+func (_c *MockEngine_OnToolkitReady_Call) Run(run func(ctx context.Context)) *MockEngine_OnToolkitReady_Call {
565+ _c.Call.Run(func(args mock.Arguments) {
566+ var arg0 context.Context
567+ if args[0] != nil {
568+ arg0 = args[0].(context.Context)
569+ }
570+ run(
571+ arg0,
572+ )
573+ })
574+ return _c
575+}
576+
577+func (_c *MockEngine_OnToolkitReady_Call) Return(err error) *MockEngine_OnToolkitReady_Call {
578+ _c.Call.Return(err)
579+ return _c
580+}
581+
582+func (_c *MockEngine_OnToolkitReady_Call) RunAndReturn(run func(ctx context.Context) error) *MockEngine_OnToolkitReady_Call {
583+ _c.Call.Return(run)
584+ return _c
585+}
586+
587+// Pool provides a mock function for the type MockEngine
588+func (_mock *MockEngine) Pool() port.WebViewPool {
589+ ret := _mock.Called()
590+
591+ if len(ret) == 0 {
592+ panic("no return value specified for Pool")
593+ }
594+
595+ var r0 port.WebViewPool
596+ if returnFunc, ok := ret.Get(0).(func() port.WebViewPool); ok {
597+ r0 = returnFunc()
598+ } else {
599+ if ret.Get(0) != nil {
600+ r0 = ret.Get(0).(port.WebViewPool)
601+ }
602+ }
603+ return r0
604+}
605+
606+// MockEngine_Pool_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Pool'
607+type MockEngine_Pool_Call struct {
608+ *mock.Call
609+}
610+
611+// Pool is a helper method to define mock.On call
612+func (_e *MockEngine_Expecter) Pool() *MockEngine_Pool_Call {
613+ return &MockEngine_Pool_Call{Call: _e.mock.On("Pool")}
614+}
615+
616+func (_c *MockEngine_Pool_Call) Run(run func()) *MockEngine_Pool_Call {
617+ _c.Call.Run(func(args mock.Arguments) {
618+ run()
619+ })
620+ return _c
621+}
622+
623+func (_c *MockEngine_Pool_Call) Return(webViewPool port.WebViewPool) *MockEngine_Pool_Call {
624+ _c.Call.Return(webViewPool)
625+ return _c
626+}
627+
628+func (_c *MockEngine_Pool_Call) RunAndReturn(run func() port.WebViewPool) *MockEngine_Pool_Call {
629+ _c.Call.Return(run)
630+ return _c
631+}
632+
633+// RegisterAccentHandlers provides a mock function for the type MockEngine
634+func (_mock *MockEngine) RegisterAccentHandlers(ctx context.Context, handler port.AccentKeyHandler) error {
635+ ret := _mock.Called(ctx, handler)
636+
637+ if len(ret) == 0 {
638+ panic("no return value specified for RegisterAccentHandlers")
639+ }
640+
641+ var r0 error
642+ if returnFunc, ok := ret.Get(0).(func(context.Context, port.AccentKeyHandler) error); ok {
643+ r0 = returnFunc(ctx, handler)
644+ } else {
645+ r0 = ret.Error(0)
646+ }
647+ return r0
648+}
649+
650+// MockEngine_RegisterAccentHandlers_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'RegisterAccentHandlers'
651+type MockEngine_RegisterAccentHandlers_Call struct {
652+ *mock.Call
653+}
654+
655+// RegisterAccentHandlers is a helper method to define mock.On call
656+// - ctx context.Context
657+// - handler port.AccentKeyHandler
658+func (_e *MockEngine_Expecter) RegisterAccentHandlers(ctx any, handler any) *MockEngine_RegisterAccentHandlers_Call {
659+ return &MockEngine_RegisterAccentHandlers_Call{Call: _e.mock.On("RegisterAccentHandlers", ctx, handler)}
660+}
661+
662+func (_c *MockEngine_RegisterAccentHandlers_Call) Run(run func(ctx context.Context, handler port.AccentKeyHandler)) *MockEngine_RegisterAccentHandlers_Call {
663+ _c.Call.Run(func(args mock.Arguments) {
664+ var arg0 context.Context
665+ if args[0] != nil {
666+ arg0 = args[0].(context.Context)
667+ }
668+ var arg1 port.AccentKeyHandler
669+ if args[1] != nil {
670+ arg1 = args[1].(port.AccentKeyHandler)
671+ }
672+ run(
673+ arg0,
674+ arg1,
675+ )
676+ })
677+ return _c
678+}
679+
680+func (_c *MockEngine_RegisterAccentHandlers_Call) Return(err error) *MockEngine_RegisterAccentHandlers_Call {
681+ _c.Call.Return(err)
682+ return _c
683+}
684+
685+func (_c *MockEngine_RegisterAccentHandlers_Call) RunAndReturn(run func(ctx context.Context, handler port.AccentKeyHandler) error) *MockEngine_RegisterAccentHandlers_Call {
686+ _c.Call.Return(run)
687+ return _c
688+}
689+
690+// RegisterHandlers provides a mock function for the type MockEngine
691+func (_mock *MockEngine) RegisterHandlers(ctx context.Context, deps port.HandlerDependencies) error {
692+ ret := _mock.Called(ctx, deps)
693+
694+ if len(ret) == 0 {
695+ panic("no return value specified for RegisterHandlers")
696+ }
697+
698+ var r0 error
699+ if returnFunc, ok := ret.Get(0).(func(context.Context, port.HandlerDependencies) error); ok {
700+ r0 = returnFunc(ctx, deps)
701+ } else {
702+ r0 = ret.Error(0)
703+ }
704+ return r0
705+}
706+
707+// MockEngine_RegisterHandlers_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'RegisterHandlers'
708+type MockEngine_RegisterHandlers_Call struct {
709+ *mock.Call
710+}
711+
712+// RegisterHandlers is a helper method to define mock.On call
713+// - ctx context.Context
714+// - deps port.HandlerDependencies
715+func (_e *MockEngine_Expecter) RegisterHandlers(ctx any, deps any) *MockEngine_RegisterHandlers_Call {
716+ return &MockEngine_RegisterHandlers_Call{Call: _e.mock.On("RegisterHandlers", ctx, deps)}
717+}
718+
719+func (_c *MockEngine_RegisterHandlers_Call) Run(run func(ctx context.Context, deps port.HandlerDependencies)) *MockEngine_RegisterHandlers_Call {
720+ _c.Call.Run(func(args mock.Arguments) {
721+ var arg0 context.Context
722+ if args[0] != nil {
723+ arg0 = args[0].(context.Context)
724+ }
725+ var arg1 port.HandlerDependencies
726+ if args[1] != nil {
727+ arg1 = args[1].(port.HandlerDependencies)
728+ }
729+ run(
730+ arg0,
731+ arg1,
732+ )
733+ })
734+ return _c
735+}
736+
737+func (_c *MockEngine_RegisterHandlers_Call) Return(err error) *MockEngine_RegisterHandlers_Call {
738+ _c.Call.Return(err)
739+ return _c
740+}
741+
742+func (_c *MockEngine_RegisterHandlers_Call) RunAndReturn(run func(ctx context.Context, deps port.HandlerDependencies) error) *MockEngine_RegisterHandlers_Call {
743+ _c.Call.Return(run)
744+ return _c
745+}
746+
747+// SetHandlerContext provides a mock function for the type MockEngine
748+func (_mock *MockEngine) SetHandlerContext(ctx context.Context) {
749+ _mock.Called(ctx)
750+ return
751+}
752+
753+// MockEngine_SetHandlerContext_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'SetHandlerContext'
754+type MockEngine_SetHandlerContext_Call struct {
755+ *mock.Call
756+}
757+
758+// SetHandlerContext is a helper method to define mock.On call
759+// - ctx context.Context
760+func (_e *MockEngine_Expecter) SetHandlerContext(ctx any) *MockEngine_SetHandlerContext_Call {
761+ return &MockEngine_SetHandlerContext_Call{Call: _e.mock.On("SetHandlerContext", ctx)}
762+}
763+
764+func (_c *MockEngine_SetHandlerContext_Call) Run(run func(ctx context.Context)) *MockEngine_SetHandlerContext_Call {
765+ _c.Call.Run(func(args mock.Arguments) {
766+ var arg0 context.Context
767+ if args[0] != nil {
768+ arg0 = args[0].(context.Context)
769+ }
770+ run(
771+ arg0,
772+ )
773+ })
774+ return _c
775+}
776+
777+func (_c *MockEngine_SetHandlerContext_Call) Return() *MockEngine_SetHandlerContext_Call {
778+ _c.Call.Return()
779+ return _c
780+}
781+
782+func (_c *MockEngine_SetHandlerContext_Call) RunAndReturn(run func(ctx context.Context)) *MockEngine_SetHandlerContext_Call {
783+ _c.Run(run)
784+ return _c
785+}
786+
787+// SettingsApplier provides a mock function for the type MockEngine
788+func (_mock *MockEngine) SettingsApplier() port.SettingsApplier {
789+ ret := _mock.Called()
790+
791+ if len(ret) == 0 {
792+ panic("no return value specified for SettingsApplier")
793+ }
794+
795+ var r0 port.SettingsApplier
796+ if returnFunc, ok := ret.Get(0).(func() port.SettingsApplier); ok {
797+ r0 = returnFunc()
798+ } else {
799+ if ret.Get(0) != nil {
800+ r0 = ret.Get(0).(port.SettingsApplier)
801+ }
802+ }
803+ return r0
804+}
805+
806+// MockEngine_SettingsApplier_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'SettingsApplier'
807+type MockEngine_SettingsApplier_Call struct {
808+ *mock.Call
809+}
810+
811+// SettingsApplier is a helper method to define mock.On call
812+func (_e *MockEngine_Expecter) SettingsApplier() *MockEngine_SettingsApplier_Call {
813+ return &MockEngine_SettingsApplier_Call{Call: _e.mock.On("SettingsApplier")}
814+}
815+
816+func (_c *MockEngine_SettingsApplier_Call) Run(run func()) *MockEngine_SettingsApplier_Call {
817+ _c.Call.Run(func(args mock.Arguments) {
818+ run()
819+ })
820+ return _c
821+}
822+
823+func (_c *MockEngine_SettingsApplier_Call) Return(settingsApplier port.SettingsApplier) *MockEngine_SettingsApplier_Call {
824+ _c.Call.Return(settingsApplier)
825+ return _c
826+}
827+
828+func (_c *MockEngine_SettingsApplier_Call) RunAndReturn(run func() port.SettingsApplier) *MockEngine_SettingsApplier_Call {
829+ _c.Call.Return(run)
830+ return _c
831+}
832+
833+// UpdateAppearance provides a mock function for the type MockEngine
834+func (_mock *MockEngine) UpdateAppearance(ctx context.Context, r float64, g float64, b float64, alpha float64) error {
835+ ret := _mock.Called(ctx, r, g, b, alpha)
836+
837+ if len(ret) == 0 {
838+ panic("no return value specified for UpdateAppearance")
839+ }
840+
841+ var r0 error
842+ if returnFunc, ok := ret.Get(0).(func(context.Context, float64, float64, float64, float64) error); ok {
843+ r0 = returnFunc(ctx, r, g, b, alpha)
844+ } else {
845+ r0 = ret.Error(0)
846+ }
847+ return r0
848+}
849+
850+// MockEngine_UpdateAppearance_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UpdateAppearance'
851+type MockEngine_UpdateAppearance_Call struct {
852+ *mock.Call
853+}
854+
855+// UpdateAppearance is a helper method to define mock.On call
856+// - ctx context.Context
857+// - r float64
858+// - g float64
859+// - b float64
860+// - alpha float64
861+func (_e *MockEngine_Expecter) UpdateAppearance(ctx any, r any, g any, b any, alpha any) *MockEngine_UpdateAppearance_Call {
862+ return &MockEngine_UpdateAppearance_Call{Call: _e.mock.On("UpdateAppearance", ctx, r, g, b, alpha)}
863+}
864+
865+func (_c *MockEngine_UpdateAppearance_Call) Run(run func(ctx context.Context, r float64, g float64, b float64, alpha float64)) *MockEngine_UpdateAppearance_Call {
866+ _c.Call.Run(func(args mock.Arguments) {
867+ var arg0 context.Context
868+ if args[0] != nil {
869+ arg0 = args[0].(context.Context)
870+ }
871+ var arg1 float64
872+ if args[1] != nil {
873+ arg1 = args[1].(float64)
874+ }
875+ var arg2 float64
876+ if args[2] != nil {
877+ arg2 = args[2].(float64)
878+ }
879+ var arg3 float64
880+ if args[3] != nil {
881+ arg3 = args[3].(float64)
882+ }
883+ var arg4 float64
884+ if args[4] != nil {
885+ arg4 = args[4].(float64)
886+ }
887+ run(
888+ arg0,
889+ arg1,
890+ arg2,
891+ arg3,
892+ arg4,
893+ )
894+ })
895+ return _c
896+}
897+
898+func (_c *MockEngine_UpdateAppearance_Call) Return(err error) *MockEngine_UpdateAppearance_Call {
899+ _c.Call.Return(err)
900+ return _c
901+}
902+
903+func (_c *MockEngine_UpdateAppearance_Call) RunAndReturn(run func(ctx context.Context, r float64, g float64, b float64, alpha float64) error) *MockEngine_UpdateAppearance_Call {
904+ _c.Call.Return(run)
905+ return _c
906+}
907+
908+// UpdateSettings provides a mock function for the type MockEngine
909+func (_mock *MockEngine) UpdateSettings(ctx context.Context, update entity.EngineSettingsUpdate) error {
910+ ret := _mock.Called(ctx, update)
911+
912+ if len(ret) == 0 {
913+ panic("no return value specified for UpdateSettings")
914+ }
915+
916+ var r0 error
917+ if returnFunc, ok := ret.Get(0).(func(context.Context, entity.EngineSettingsUpdate) error); ok {
918+ r0 = returnFunc(ctx, update)
919+ } else {
920+ r0 = ret.Error(0)
921+ }
922+ return r0
923+}
924+
925+// MockEngine_UpdateSettings_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UpdateSettings'
926+type MockEngine_UpdateSettings_Call struct {
927+ *mock.Call
928+}
929+
930+// UpdateSettings is a helper method to define mock.On call
931+// - ctx context.Context
932+// - update entity.EngineSettingsUpdate
933+func (_e *MockEngine_Expecter) UpdateSettings(ctx any, update any) *MockEngine_UpdateSettings_Call {
934+ return &MockEngine_UpdateSettings_Call{Call: _e.mock.On("UpdateSettings", ctx, update)}
935+}
936+
937+func (_c *MockEngine_UpdateSettings_Call) Run(run func(ctx context.Context, update entity.EngineSettingsUpdate)) *MockEngine_UpdateSettings_Call {
938+ _c.Call.Run(func(args mock.Arguments) {
939+ var arg0 context.Context
940+ if args[0] != nil {
941+ arg0 = args[0].(context.Context)
942+ }
943+ var arg1 entity.EngineSettingsUpdate
944+ if args[1] != nil {
945+ arg1 = args[1].(entity.EngineSettingsUpdate)
946+ }
947+ run(
948+ arg0,
949+ arg1,
950+ )
951+ })
952+ return _c
953+}
954+
955+func (_c *MockEngine_UpdateSettings_Call) Return(err error) *MockEngine_UpdateSettings_Call {
956+ _c.Call.Return(err)
957+ return _c
958+}
959+
960+func (_c *MockEngine_UpdateSettings_Call) RunAndReturn(run func(ctx context.Context, update entity.EngineSettingsUpdate) error) *MockEngine_UpdateSettings_Call {
961+ _c.Call.Return(run)
962+ return _c
963+}
964+
965+// NewMockWebUIMessageHandler creates a new instance of MockWebUIMessageHandler. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
966+// The first argument is typically a *testing.T value.
967+func NewMockWebUIMessageHandler(t interface {
968+ mock.TestingT
969+ Cleanup(func())
970+}) *MockWebUIMessageHandler {
971+ mock := &MockWebUIMessageHandler{}
972+ mock.Mock.Test(t)
973+
974+ t.Cleanup(func() { mock.AssertExpectations(t) })
975+
976+ return mock
977+}
978+
979+// MockWebUIMessageHandler is an autogenerated mock type for the WebUIMessageHandler type
980+type MockWebUIMessageHandler struct {
981+ mock.Mock
982+}
983+
984+type MockWebUIMessageHandler_Expecter struct {
985+ mock *mock.Mock
986+}
987+
988+func (_m *MockWebUIMessageHandler) EXPECT() *MockWebUIMessageHandler_Expecter {
989+ return &MockWebUIMessageHandler_Expecter{mock: &_m.Mock}
990+}
991+
992+// Handle provides a mock function for the type MockWebUIMessageHandler
993+func (_mock *MockWebUIMessageHandler) Handle(ctx context.Context, webviewID port.WebViewID, payload json.RawMessage) (any, error) {
994+ ret := _mock.Called(ctx, webviewID, payload)
995+
996+ if len(ret) == 0 {
997+ panic("no return value specified for Handle")
998+ }
999+
1000+ var r0 any
1001+ var r1 error
1002+ if returnFunc, ok := ret.Get(0).(func(context.Context, port.WebViewID, json.RawMessage) (any, error)); ok {
1003+ return returnFunc(ctx, webviewID, payload)
1004+ }
1005+ if returnFunc, ok := ret.Get(0).(func(context.Context, port.WebViewID, json.RawMessage) any); ok {
1006+ r0 = returnFunc(ctx, webviewID, payload)
1007+ } else {
1008+ if ret.Get(0) != nil {
1009+ r0 = ret.Get(0).(any)
1010+ }
1011+ }
1012+ if returnFunc, ok := ret.Get(1).(func(context.Context, port.WebViewID, json.RawMessage) error); ok {
1013+ r1 = returnFunc(ctx, webviewID, payload)
1014+ } else {
1015+ r1 = ret.Error(1)
1016+ }
1017+ return r0, r1
1018+}
1019+
1020+// MockWebUIMessageHandler_Handle_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Handle'
1021+type MockWebUIMessageHandler_Handle_Call struct {
1022+ *mock.Call
1023+}
1024+
1025+// Handle is a helper method to define mock.On call
1026+// - ctx context.Context
1027+// - webviewID port.WebViewID
1028+// - payload json.RawMessage
1029+func (_e *MockWebUIMessageHandler_Expecter) Handle(ctx any, webviewID any, payload any) *MockWebUIMessageHandler_Handle_Call {
1030+ return &MockWebUIMessageHandler_Handle_Call{Call: _e.mock.On("Handle", ctx, webviewID, payload)}
1031+}
1032+
1033+func (_c *MockWebUIMessageHandler_Handle_Call) Run(run func(ctx context.Context, webviewID port.WebViewID, payload json.RawMessage)) *MockWebUIMessageHandler_Handle_Call {
1034+ _c.Call.Run(func(args mock.Arguments) {
1035+ var arg0 context.Context
1036+ if args[0] != nil {
1037+ arg0 = args[0].(context.Context)
1038+ }
1039+ var arg1 port.WebViewID
1040+ if args[1] != nil {
1041+ arg1 = args[1].(port.WebViewID)
1042+ }
1043+ var arg2 json.RawMessage
1044+ if args[2] != nil {
1045+ arg2 = args[2].(json.RawMessage)
1046+ }
1047+ run(
1048+ arg0,
1049+ arg1,
1050+ arg2,
1051+ )
1052+ })
1053+ return _c
1054+}
1055+
1056+func (_c *MockWebUIMessageHandler_Handle_Call) Return(v any, err error) *MockWebUIMessageHandler_Handle_Call {
1057+ _c.Call.Return(v, err)
1058+ return _c
1059+}
1060+
1061+func (_c *MockWebUIMessageHandler_Handle_Call) RunAndReturn(run func(ctx context.Context, webviewID port.WebViewID, payload json.RawMessage) (any, error)) *MockWebUIMessageHandler_Handle_Call {
1062+ _c.Call.Return(run)
1063+ return _c
1064+}
1065+
1066+// NewMockWebUIHandlerRouter creates a new instance of MockWebUIHandlerRouter. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
1067+// The first argument is typically a *testing.T value.
1068+func NewMockWebUIHandlerRouter(t interface {
1069+ mock.TestingT
1070+ Cleanup(func())
1071+}) *MockWebUIHandlerRouter {
1072+ mock := &MockWebUIHandlerRouter{}
1073+ mock.Mock.Test(t)
1074+
1075+ t.Cleanup(func() { mock.AssertExpectations(t) })
1076+
1077+ return mock
1078+}
1079+
1080+// MockWebUIHandlerRouter is an autogenerated mock type for the WebUIHandlerRouter type
1081+type MockWebUIHandlerRouter struct {
1082+ mock.Mock
1083+}
1084+
1085+type MockWebUIHandlerRouter_Expecter struct {
1086+ mock *mock.Mock
1087+}
1088+
1089+func (_m *MockWebUIHandlerRouter) EXPECT() *MockWebUIHandlerRouter_Expecter {
1090+ return &MockWebUIHandlerRouter_Expecter{mock: &_m.Mock}
1091+}
1092+
1093+// RegisterHandler provides a mock function for the type MockWebUIHandlerRouter
1094+func (_mock *MockWebUIHandlerRouter) RegisterHandler(msgType string, handler port.WebUIMessageHandler) error {
1095+ ret := _mock.Called(msgType, handler)
1096+
1097+ if len(ret) == 0 {
1098+ panic("no return value specified for RegisterHandler")
1099+ }
1100+
1101+ var r0 error
1102+ if returnFunc, ok := ret.Get(0).(func(string, port.WebUIMessageHandler) error); ok {
1103+ r0 = returnFunc(msgType, handler)
1104+ } else {
1105+ r0 = ret.Error(0)
1106+ }
1107+ return r0
1108+}
1109+
1110+// MockWebUIHandlerRouter_RegisterHandler_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'RegisterHandler'
1111+type MockWebUIHandlerRouter_RegisterHandler_Call struct {
1112+ *mock.Call
1113+}
1114+
1115+// RegisterHandler is a helper method to define mock.On call
1116+// - msgType string
1117+// - handler port.WebUIMessageHandler
1118+func (_e *MockWebUIHandlerRouter_Expecter) RegisterHandler(msgType any, handler any) *MockWebUIHandlerRouter_RegisterHandler_Call {
1119+ return &MockWebUIHandlerRouter_RegisterHandler_Call{Call: _e.mock.On("RegisterHandler", msgType, handler)}
1120+}
1121+
1122+func (_c *MockWebUIHandlerRouter_RegisterHandler_Call) Run(run func(msgType string, handler port.WebUIMessageHandler)) *MockWebUIHandlerRouter_RegisterHandler_Call {
1123+ _c.Call.Run(func(args mock.Arguments) {
1124+ var arg0 string
1125+ if args[0] != nil {
1126+ arg0 = args[0].(string)
1127+ }
1128+ var arg1 port.WebUIMessageHandler
1129+ if args[1] != nil {
1130+ arg1 = args[1].(port.WebUIMessageHandler)
1131+ }
1132+ run(
1133+ arg0,
1134+ arg1,
1135+ )
1136+ })
1137+ return _c
1138+}
1139+
1140+func (_c *MockWebUIHandlerRouter_RegisterHandler_Call) Return(err error) *MockWebUIHandlerRouter_RegisterHandler_Call {
1141+ _c.Call.Return(err)
1142+ return _c
1143+}
1144+
1145+func (_c *MockWebUIHandlerRouter_RegisterHandler_Call) RunAndReturn(run func(msgType string, handler port.WebUIMessageHandler) error) *MockWebUIHandlerRouter_RegisterHandler_Call {
1146+ _c.Call.Return(run)
1147+ return _c
1148+}
1149+
1150+// RegisterHandlerWithCallbacks provides a mock function for the type MockWebUIHandlerRouter
1151+func (_mock *MockWebUIHandlerRouter) RegisterHandlerWithCallbacks(msgType string, callback string, errorCallback string, worldName string, handler port.WebUIMessageHandler) error {
1152+ ret := _mock.Called(msgType, callback, errorCallback, worldName, handler)
1153+
1154+ if len(ret) == 0 {
1155+ panic("no return value specified for RegisterHandlerWithCallbacks")
1156+ }
1157+
1158+ var r0 error
1159+ if returnFunc, ok := ret.Get(0).(func(string, string, string, string, port.WebUIMessageHandler) error); ok {
1160+ r0 = returnFunc(msgType, callback, errorCallback, worldName, handler)
1161+ } else {
1162+ r0 = ret.Error(0)
1163+ }
1164+ return r0
1165+}
1166+
1167+// MockWebUIHandlerRouter_RegisterHandlerWithCallbacks_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'RegisterHandlerWithCallbacks'
1168+type MockWebUIHandlerRouter_RegisterHandlerWithCallbacks_Call struct {
1169+ *mock.Call
1170+}
1171+
1172+// RegisterHandlerWithCallbacks is a helper method to define mock.On call
1173+// - msgType string
1174+// - callback string
1175+// - errorCallback string
1176+// - worldName string
1177+// - handler port.WebUIMessageHandler
1178+func (_e *MockWebUIHandlerRouter_Expecter) RegisterHandlerWithCallbacks(msgType any, callback any, errorCallback any, worldName any, handler any) *MockWebUIHandlerRouter_RegisterHandlerWithCallbacks_Call {
1179+ return &MockWebUIHandlerRouter_RegisterHandlerWithCallbacks_Call{Call: _e.mock.On("RegisterHandlerWithCallbacks", msgType, callback, errorCallback, worldName, handler)}
1180+}
1181+
1182+func (_c *MockWebUIHandlerRouter_RegisterHandlerWithCallbacks_Call) Run(run func(msgType string, callback string, errorCallback string, worldName string, handler port.WebUIMessageHandler)) *MockWebUIHandlerRouter_RegisterHandlerWithCallbacks_Call {
1183+ _c.Call.Run(func(args mock.Arguments) {
1184+ var arg0 string
1185+ if args[0] != nil {
1186+ arg0 = args[0].(string)
1187+ }
1188+ var arg1 string
1189+ if args[1] != nil {
1190+ arg1 = args[1].(string)
1191+ }
1192+ var arg2 string
1193+ if args[2] != nil {
1194+ arg2 = args[2].(string)
1195+ }
1196+ var arg3 string
1197+ if args[3] != nil {
1198+ arg3 = args[3].(string)
1199+ }
1200+ var arg4 port.WebUIMessageHandler
1201+ if args[4] != nil {
1202+ arg4 = args[4].(port.WebUIMessageHandler)
1203+ }
1204+ run(
1205+ arg0,
1206+ arg1,
1207+ arg2,
1208+ arg3,
1209+ arg4,
1210+ )
1211+ })
1212+ return _c
1213+}
1214+
1215+func (_c *MockWebUIHandlerRouter_RegisterHandlerWithCallbacks_Call) Return(err error) *MockWebUIHandlerRouter_RegisterHandlerWithCallbacks_Call {
1216+ _c.Call.Return(err)
1217+ return _c
1218+}
1219+
1220+func (_c *MockWebUIHandlerRouter_RegisterHandlerWithCallbacks_Call) RunAndReturn(run func(msgType string, callback string, errorCallback string, worldName string, handler port.WebUIMessageHandler) error) *MockWebUIHandlerRouter_RegisterHandlerWithCallbacks_Call {
1221+ _c.Call.Return(run)
1222+ return _c
1223+}
1224+
1225+// NewMockSchemeHandler creates a new instance of MockSchemeHandler. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
1226+// The first argument is typically a *testing.T value.
1227+func NewMockSchemeHandler(t interface {
1228+ mock.TestingT
1229+ Cleanup(func())
1230+}) *MockSchemeHandler {
1231+ mock := &MockSchemeHandler{}
1232+ mock.Mock.Test(t)
1233+
1234+ t.Cleanup(func() { mock.AssertExpectations(t) })
1235+
1236+ return mock
1237+}
1238+
1239+// MockSchemeHandler is an autogenerated mock type for the SchemeHandler type
1240+type MockSchemeHandler struct {
1241+ mock.Mock
1242+}
1243+
1244+type MockSchemeHandler_Expecter struct {
1245+ mock *mock.Mock
1246+}
1247+
1248+func (_m *MockSchemeHandler) EXPECT() *MockSchemeHandler_Expecter {
1249+ return &MockSchemeHandler_Expecter{mock: &_m.Mock}
1250+}
1251+
1252+// RegisterScheme provides a mock function for the type MockSchemeHandler
1253+func (_mock *MockSchemeHandler) RegisterScheme(scheme string, handler func(uri string) ([]byte, string, error)) {
1254+ _mock.Called(scheme, handler)
1255+ return
1256+}
1257+
1258+// MockSchemeHandler_RegisterScheme_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'RegisterScheme'
1259+type MockSchemeHandler_RegisterScheme_Call struct {
1260+ *mock.Call
1261+}
1262+
1263+// RegisterScheme is a helper method to define mock.On call
1264+// - scheme string
1265+// - handler func(uri string) ([]byte, string, error)
1266+func (_e *MockSchemeHandler_Expecter) RegisterScheme(scheme any, handler any) *MockSchemeHandler_RegisterScheme_Call {
1267+ return &MockSchemeHandler_RegisterScheme_Call{Call: _e.mock.On("RegisterScheme", scheme, handler)}
1268+}
1269+
1270+func (_c *MockSchemeHandler_RegisterScheme_Call) Run(run func(scheme string, handler func(uri string) ([]byte, string, error))) *MockSchemeHandler_RegisterScheme_Call {
1271+ _c.Call.Run(func(args mock.Arguments) {
1272+ var arg0 string
1273+ if args[0] != nil {
1274+ arg0 = args[0].(string)
1275+ }
1276+ var arg1 func(uri string) ([]byte, string, error)
1277+ if args[1] != nil {
1278+ arg1 = args[1].(func(uri string) ([]byte, string, error))
1279+ }
1280+ run(
1281+ arg0,
1282+ arg1,
1283+ )
1284+ })
1285+ return _c
1286+}
1287+
1288+func (_c *MockSchemeHandler_RegisterScheme_Call) Return() *MockSchemeHandler_RegisterScheme_Call {
1289+ _c.Call.Return()
1290+ return _c
1291+}
1292+
1293+func (_c *MockSchemeHandler_RegisterScheme_Call) RunAndReturn(run func(scheme string, handler func(uri string) ([]byte, string, error))) *MockSchemeHandler_RegisterScheme_Call {
1294+ _c.Run(run)
1295+ return _c
1296+}
1297+
1298+// NewMockSettingsApplier creates a new instance of MockSettingsApplier. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
1299+// The first argument is typically a *testing.T value.
1300+func NewMockSettingsApplier(t interface {
1301+ mock.TestingT
1302+ Cleanup(func())
1303+}) *MockSettingsApplier {
1304+ mock := &MockSettingsApplier{}
1305+ mock.Mock.Test(t)
1306+
1307+ t.Cleanup(func() { mock.AssertExpectations(t) })
1308+
1309+ return mock
1310+}
1311+
1312+// MockSettingsApplier is an autogenerated mock type for the SettingsApplier type
1313+type MockSettingsApplier struct {
1314+ mock.Mock
1315+}
1316+
1317+type MockSettingsApplier_Expecter struct {
1318+ mock *mock.Mock
1319+}
1320+
1321+func (_m *MockSettingsApplier) EXPECT() *MockSettingsApplier_Expecter {
1322+ return &MockSettingsApplier_Expecter{mock: &_m.Mock}
1323+}
1324+
1325+// ApplyToAll provides a mock function for the type MockSettingsApplier
1326+func (_mock *MockSettingsApplier) ApplyToAll(ctx context.Context, webviews []port.WebView) {
1327+ _mock.Called(ctx, webviews)
1328+ return
1329+}
1330+
1331+// MockSettingsApplier_ApplyToAll_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ApplyToAll'
1332+type MockSettingsApplier_ApplyToAll_Call struct {
1333+ *mock.Call
1334+}
1335+
1336+// ApplyToAll is a helper method to define mock.On call
1337+// - ctx context.Context
1338+// - webviews []port.WebView
1339+func (_e *MockSettingsApplier_Expecter) ApplyToAll(ctx any, webviews any) *MockSettingsApplier_ApplyToAll_Call {
1340+ return &MockSettingsApplier_ApplyToAll_Call{Call: _e.mock.On("ApplyToAll", ctx, webviews)}
1341+}
1342+
1343+func (_c *MockSettingsApplier_ApplyToAll_Call) Run(run func(ctx context.Context, webviews []port.WebView)) *MockSettingsApplier_ApplyToAll_Call {
1344+ _c.Call.Run(func(args mock.Arguments) {
1345+ var arg0 context.Context
1346+ if args[0] != nil {
1347+ arg0 = args[0].(context.Context)
1348+ }
1349+ var arg1 []port.WebView
1350+ if args[1] != nil {
1351+ arg1 = args[1].([]port.WebView)
1352+ }
1353+ run(
1354+ arg0,
1355+ arg1,
1356+ )
1357+ })
1358+ return _c
1359+}
1360+
1361+func (_c *MockSettingsApplier_ApplyToAll_Call) Return() *MockSettingsApplier_ApplyToAll_Call {
1362+ _c.Call.Return()
1363+ return _c
1364+}
1365+
1366+func (_c *MockSettingsApplier_ApplyToAll_Call) RunAndReturn(run func(ctx context.Context, webviews []port.WebView)) *MockSettingsApplier_ApplyToAll_Call {
1367+ _c.Run(run)
1368+ return _c
1369+}
1370+
1371+// NewMockFilterApplier creates a new instance of MockFilterApplier. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
1372+// The first argument is typically a *testing.T value.
1373+func NewMockFilterApplier(t interface {
1374+ mock.TestingT
1375+ Cleanup(func())
1376+}) *MockFilterApplier {
1377+ mock := &MockFilterApplier{}
1378+ mock.Mock.Test(t)
1379+
1380+ t.Cleanup(func() { mock.AssertExpectations(t) })
1381+
1382+ return mock
1383+}
1384+
1385+// MockFilterApplier is an autogenerated mock type for the FilterApplier type
1386+type MockFilterApplier struct {
1387+ mock.Mock
1388+}
1389+
1390+type MockFilterApplier_Expecter struct {
1391+ mock *mock.Mock
1392+}
1393+
1394+func (_m *MockFilterApplier) EXPECT() *MockFilterApplier_Expecter {
1395+ return &MockFilterApplier_Expecter{mock: &_m.Mock}
1396+}
1397+
1398+// ApplyToAll provides a mock function for the type MockFilterApplier
1399+func (_mock *MockFilterApplier) ApplyToAll(ctx context.Context, webviews []port.WebView) {
1400+ _mock.Called(ctx, webviews)
1401+ return
1402+}
1403+
1404+// MockFilterApplier_ApplyToAll_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ApplyToAll'
1405+type MockFilterApplier_ApplyToAll_Call struct {
1406+ *mock.Call
1407+}
1408+
1409+// ApplyToAll is a helper method to define mock.On call
1410+// - ctx context.Context
1411+// - webviews []port.WebView
1412+func (_e *MockFilterApplier_Expecter) ApplyToAll(ctx any, webviews any) *MockFilterApplier_ApplyToAll_Call {
1413+ return &MockFilterApplier_ApplyToAll_Call{Call: _e.mock.On("ApplyToAll", ctx, webviews)}
1414+}
1415+
1416+func (_c *MockFilterApplier_ApplyToAll_Call) Run(run func(ctx context.Context, webviews []port.WebView)) *MockFilterApplier_ApplyToAll_Call {
1417+ _c.Call.Run(func(args mock.Arguments) {
1418+ var arg0 context.Context
1419+ if args[0] != nil {
1420+ arg0 = args[0].(context.Context)
1421+ }
1422+ var arg1 []port.WebView
1423+ if args[1] != nil {
1424+ arg1 = args[1].([]port.WebView)
1425+ }
1426+ run(
1427+ arg0,
1428+ arg1,
1429+ )
1430+ })
1431+ return _c
1432+}
1433+
1434+func (_c *MockFilterApplier_ApplyToAll_Call) Return() *MockFilterApplier_ApplyToAll_Call {
1435+ _c.Call.Return()
1436+ return _c
1437+}
1438+
1439+func (_c *MockFilterApplier_ApplyToAll_Call) RunAndReturn(run func(ctx context.Context, webviews []port.WebView)) *MockFilterApplier_ApplyToAll_Call {
1440+ _c.Run(run)
1441+ return _c
1442+}
1443+
1444+// NewMockFaviconDatabase creates a new instance of MockFaviconDatabase. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
1445+// The first argument is typically a *testing.T value.
1446+func NewMockFaviconDatabase(t interface {
1447+ mock.TestingT
1448+ Cleanup(func())
1449+}) *MockFaviconDatabase {
1450+ mock := &MockFaviconDatabase{}
1451+ mock.Mock.Test(t)
1452+
1453+ t.Cleanup(func() { mock.AssertExpectations(t) })
1454+
1455+ return mock
1456+}
1457+
1458+// MockFaviconDatabase is an autogenerated mock type for the FaviconDatabase type
1459+type MockFaviconDatabase struct {
1460+ mock.Mock
1461+}
1462+
1463+type MockFaviconDatabase_Expecter struct {
1464+ mock *mock.Mock
1465+}
1466+
1467+func (_m *MockFaviconDatabase) EXPECT() *MockFaviconDatabase_Expecter {
1468+ return &MockFaviconDatabase_Expecter{mock: &_m.Mock}
1469+}
1470+
1471+// GetFaviconAsync provides a mock function for the type MockFaviconDatabase
1472+func (_mock *MockFaviconDatabase) GetFaviconAsync(pageURL string, callback func(port.Texture)) {
1473+ _mock.Called(pageURL, callback)
1474+ return
1475+}
1476+
1477+// MockFaviconDatabase_GetFaviconAsync_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetFaviconAsync'
1478+type MockFaviconDatabase_GetFaviconAsync_Call struct {
1479+ *mock.Call
1480+}
1481+
1482+// GetFaviconAsync is a helper method to define mock.On call
1483+// - pageURL string
1484+// - callback func(port.Texture)
1485+func (_e *MockFaviconDatabase_Expecter) GetFaviconAsync(pageURL any, callback any) *MockFaviconDatabase_GetFaviconAsync_Call {
1486+ return &MockFaviconDatabase_GetFaviconAsync_Call{Call: _e.mock.On("GetFaviconAsync", pageURL, callback)}
1487+}
1488+
1489+func (_c *MockFaviconDatabase_GetFaviconAsync_Call) Run(run func(pageURL string, callback func(port.Texture))) *MockFaviconDatabase_GetFaviconAsync_Call {
1490+ _c.Call.Run(func(args mock.Arguments) {
1491+ var arg0 string
1492+ if args[0] != nil {
1493+ arg0 = args[0].(string)
1494+ }
1495+ var arg1 func(port.Texture)
1496+ if args[1] != nil {
1497+ arg1 = args[1].(func(port.Texture))
1498+ }
1499+ run(
1500+ arg0,
1501+ arg1,
1502+ )
1503+ })
1504+ return _c
1505+}
1506+
1507+func (_c *MockFaviconDatabase_GetFaviconAsync_Call) Return() *MockFaviconDatabase_GetFaviconAsync_Call {
1508+ _c.Call.Return()
1509+ return _c
1510+}
1511+
1512+func (_c *MockFaviconDatabase_GetFaviconAsync_Call) RunAndReturn(run func(pageURL string, callback func(port.Texture))) *MockFaviconDatabase_GetFaviconAsync_Call {
1513+ _c.Run(run)
1514+ return _c
1515+}
1516+
1517+// NewMockScriptRefresher creates a new instance of MockScriptRefresher. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
1518+// The first argument is typically a *testing.T value.
1519+func NewMockScriptRefresher(t interface {
1520+ mock.TestingT
1521+ Cleanup(func())
1522+}) *MockScriptRefresher {
1523+ mock := &MockScriptRefresher{}
1524+ mock.Mock.Test(t)
1525+
1526+ t.Cleanup(func() { mock.AssertExpectations(t) })
1527+
1528+ return mock
1529+}
1530+
1531+// MockScriptRefresher is an autogenerated mock type for the ScriptRefresher type
1532+type MockScriptRefresher struct {
1533+ mock.Mock
1534+}
1535+
1536+type MockScriptRefresher_Expecter struct {
1537+ mock *mock.Mock
1538+}
1539+
1540+func (_m *MockScriptRefresher) EXPECT() *MockScriptRefresher_Expecter {
1541+ return &MockScriptRefresher_Expecter{mock: &_m.Mock}
1542+}
1543+
1544+// RefreshAll provides a mock function for the type MockScriptRefresher
1545+func (_mock *MockScriptRefresher) RefreshAll(ctx context.Context, webviews []port.WebView) {
1546+ _mock.Called(ctx, webviews)
1547+ return
1548+}
1549+
1550+// MockScriptRefresher_RefreshAll_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'RefreshAll'
1551+type MockScriptRefresher_RefreshAll_Call struct {
1552+ *mock.Call
1553+}
1554+
1555+// RefreshAll is a helper method to define mock.On call
1556+// - ctx context.Context
1557+// - webviews []port.WebView
1558+func (_e *MockScriptRefresher_Expecter) RefreshAll(ctx any, webviews any) *MockScriptRefresher_RefreshAll_Call {
1559+ return &MockScriptRefresher_RefreshAll_Call{Call: _e.mock.On("RefreshAll", ctx, webviews)}
1560+}
1561+
1562+func (_c *MockScriptRefresher_RefreshAll_Call) Run(run func(ctx context.Context, webviews []port.WebView)) *MockScriptRefresher_RefreshAll_Call {
1563+ _c.Call.Run(func(args mock.Arguments) {
1564+ var arg0 context.Context
1565+ if args[0] != nil {
1566+ arg0 = args[0].(context.Context)
1567+ }
1568+ var arg1 []port.WebView
1569+ if args[1] != nil {
1570+ arg1 = args[1].([]port.WebView)
1571+ }
1572+ run(
1573+ arg0,
1574+ arg1,
1575+ )
1576+ })
1577+ return _c
1578+}
1579+
1580+func (_c *MockScriptRefresher_RefreshAll_Call) Return() *MockScriptRefresher_RefreshAll_Call {
1581+ _c.Call.Return()
1582+ return _c
1583+}
1584+
1585+func (_c *MockScriptRefresher_RefreshAll_Call) RunAndReturn(run func(ctx context.Context, webviews []port.WebView)) *MockScriptRefresher_RefreshAll_Call {
1586+ _c.Run(run)
1587+ return _c
1588+}
1589+
1590+// NewMockNativeWidgetProvider creates a new instance of MockNativeWidgetProvider. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
1591+// The first argument is typically a *testing.T value.
1592+func NewMockNativeWidgetProvider(t interface {
1593+ mock.TestingT
1594+ Cleanup(func())
1595+}) *MockNativeWidgetProvider {
1596+ mock := &MockNativeWidgetProvider{}
1597+ mock.Mock.Test(t)
1598+
1599+ t.Cleanup(func() { mock.AssertExpectations(t) })
1600+
1601+ return mock
1602+}
1603+
1604+// MockNativeWidgetProvider is an autogenerated mock type for the NativeWidgetProvider type
1605+type MockNativeWidgetProvider struct {
1606+ mock.Mock
1607+}
1608+
1609+type MockNativeWidgetProvider_Expecter struct {
1610+ mock *mock.Mock
1611+}
1612+
1613+func (_m *MockNativeWidgetProvider) EXPECT() *MockNativeWidgetProvider_Expecter {
1614+ return &MockNativeWidgetProvider_Expecter{mock: &_m.Mock}
1615+}
1616+
1617+// NativeWidget provides a mock function for the type MockNativeWidgetProvider
1618+func (_mock *MockNativeWidgetProvider) NativeWidget() uintptr {
1619+ ret := _mock.Called()
1620+
1621+ if len(ret) == 0 {
1622+ panic("no return value specified for NativeWidget")
1623+ }
1624+
1625+ var r0 uintptr
1626+ if returnFunc, ok := ret.Get(0).(func() uintptr); ok {
1627+ r0 = returnFunc()
1628+ } else {
1629+ r0 = ret.Get(0).(uintptr)
1630+ }
1631+ return r0
1632+}
1633+
1634+// MockNativeWidgetProvider_NativeWidget_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'NativeWidget'
1635+type MockNativeWidgetProvider_NativeWidget_Call struct {
1636+ *mock.Call
1637+}
1638+
1639+// NativeWidget is a helper method to define mock.On call
1640+func (_e *MockNativeWidgetProvider_Expecter) NativeWidget() *MockNativeWidgetProvider_NativeWidget_Call {
1641+ return &MockNativeWidgetProvider_NativeWidget_Call{Call: _e.mock.On("NativeWidget")}
1642+}
1643+
1644+func (_c *MockNativeWidgetProvider_NativeWidget_Call) Run(run func()) *MockNativeWidgetProvider_NativeWidget_Call {
1645+ _c.Call.Run(func(args mock.Arguments) {
1646+ run()
1647+ })
1648+ return _c
1649+}
1650+
1651+func (_c *MockNativeWidgetProvider_NativeWidget_Call) Return(v uintptr) *MockNativeWidgetProvider_NativeWidget_Call {
1652+ _c.Call.Return(v)
1653+ return _c
1654+}
1655+
1656+func (_c *MockNativeWidgetProvider_NativeWidget_Call) RunAndReturn(run func() uintptr) *MockNativeWidgetProvider_NativeWidget_Call {
1657+ _c.Call.Return(run)
1658+ return _c
1659+}
A internal/application/port/mocks/favicon_blob_store.go +525 -0
@@ -0,0 +1,525 @@
1+// Code generated by mockery; DO NOT EDIT.
2+// github.com/vektra/mockery
3+// template: testify
4+
5+package mocks
6+
7+import (
8+ "context"
9+
10+ "github.com/bnema/dumber/internal/domain/favicon"
11+ mock "github.com/stretchr/testify/mock"
12+)
13+
14+// NewMockFaviconBlobStore creates a new instance of MockFaviconBlobStore. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
15+// The first argument is typically a *testing.T value.
16+func NewMockFaviconBlobStore(t interface {
17+ mock.TestingT
18+ Cleanup(func())
19+}) *MockFaviconBlobStore {
20+ mock := &MockFaviconBlobStore{}
21+ mock.Mock.Test(t)
22+
23+ t.Cleanup(func() { mock.AssertExpectations(t) })
24+
25+ return mock
26+}
27+
28+// MockFaviconBlobStore is an autogenerated mock type for the FaviconBlobStore type
29+type MockFaviconBlobStore struct {
30+ mock.Mock
31+}
32+
33+type MockFaviconBlobStore_Expecter struct {
34+ mock *mock.Mock
35+}
36+
37+func (_m *MockFaviconBlobStore) EXPECT() *MockFaviconBlobStore_Expecter {
38+ return &MockFaviconBlobStore_Expecter{mock: &_m.Mock}
39+}
40+
41+// ReadOriginal provides a mock function for the type MockFaviconBlobStore
42+func (_mock *MockFaviconBlobStore) ReadOriginal(ctx context.Context, key favicon.Key) ([]byte, string, error) {
43+ ret := _mock.Called(ctx, key)
44+
45+ if len(ret) == 0 {
46+ panic("no return value specified for ReadOriginal")
47+ }
48+
49+ var r0 []byte
50+ var r1 string
51+ var r2 error
52+ if returnFunc, ok := ret.Get(0).(func(context.Context, favicon.Key) ([]byte, string, error)); ok {
53+ return returnFunc(ctx, key)
54+ }
55+ if returnFunc, ok := ret.Get(0).(func(context.Context, favicon.Key) []byte); ok {
56+ r0 = returnFunc(ctx, key)
57+ } else {
58+ if ret.Get(0) != nil {
59+ r0 = ret.Get(0).([]byte)
60+ }
61+ }
62+ if returnFunc, ok := ret.Get(1).(func(context.Context, favicon.Key) string); ok {
63+ r1 = returnFunc(ctx, key)
64+ } else {
65+ r1 = ret.Get(1).(string)
66+ }
67+ if returnFunc, ok := ret.Get(2).(func(context.Context, favicon.Key) error); ok {
68+ r2 = returnFunc(ctx, key)
69+ } else {
70+ r2 = ret.Error(2)
71+ }
72+ return r0, r1, r2
73+}
74+
75+// MockFaviconBlobStore_ReadOriginal_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ReadOriginal'
76+type MockFaviconBlobStore_ReadOriginal_Call struct {
77+ *mock.Call
78+}
79+
80+// ReadOriginal is a helper method to define mock.On call
81+// - ctx context.Context
82+// - key favicon.Key
83+func (_e *MockFaviconBlobStore_Expecter) ReadOriginal(ctx any, key any) *MockFaviconBlobStore_ReadOriginal_Call {
84+ return &MockFaviconBlobStore_ReadOriginal_Call{Call: _e.mock.On("ReadOriginal", ctx, key)}
85+}
86+
87+func (_c *MockFaviconBlobStore_ReadOriginal_Call) Run(run func(ctx context.Context, key favicon.Key)) *MockFaviconBlobStore_ReadOriginal_Call {
88+ _c.Call.Run(func(args mock.Arguments) {
89+ var arg0 context.Context
90+ if args[0] != nil {
91+ arg0 = args[0].(context.Context)
92+ }
93+ var arg1 favicon.Key
94+ if args[1] != nil {
95+ arg1 = args[1].(favicon.Key)
96+ }
97+ run(
98+ arg0,
99+ arg1,
100+ )
101+ })
102+ return _c
103+}
104+
105+func (_c *MockFaviconBlobStore_ReadOriginal_Call) Return(bytes []byte, s string, err error) *MockFaviconBlobStore_ReadOriginal_Call {
106+ _c.Call.Return(bytes, s, err)
107+ return _c
108+}
109+
110+func (_c *MockFaviconBlobStore_ReadOriginal_Call) RunAndReturn(run func(ctx context.Context, key favicon.Key) ([]byte, string, error)) *MockFaviconBlobStore_ReadOriginal_Call {
111+ _c.Call.Return(run)
112+ return _c
113+}
114+
115+// ReadPNG provides a mock function for the type MockFaviconBlobStore
116+func (_mock *MockFaviconBlobStore) ReadPNG(ctx context.Context, key favicon.Key) ([]byte, string, error) {
117+ ret := _mock.Called(ctx, key)
118+
119+ if len(ret) == 0 {
120+ panic("no return value specified for ReadPNG")
121+ }
122+
123+ var r0 []byte
124+ var r1 string
125+ var r2 error
126+ if returnFunc, ok := ret.Get(0).(func(context.Context, favicon.Key) ([]byte, string, error)); ok {
127+ return returnFunc(ctx, key)
128+ }
129+ if returnFunc, ok := ret.Get(0).(func(context.Context, favicon.Key) []byte); ok {
130+ r0 = returnFunc(ctx, key)
131+ } else {
132+ if ret.Get(0) != nil {
133+ r0 = ret.Get(0).([]byte)
134+ }
135+ }
136+ if returnFunc, ok := ret.Get(1).(func(context.Context, favicon.Key) string); ok {
137+ r1 = returnFunc(ctx, key)
138+ } else {
139+ r1 = ret.Get(1).(string)
140+ }
141+ if returnFunc, ok := ret.Get(2).(func(context.Context, favicon.Key) error); ok {
142+ r2 = returnFunc(ctx, key)
143+ } else {
144+ r2 = ret.Error(2)
145+ }
146+ return r0, r1, r2
147+}
148+
149+// MockFaviconBlobStore_ReadPNG_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ReadPNG'
150+type MockFaviconBlobStore_ReadPNG_Call struct {
151+ *mock.Call
152+}
153+
154+// ReadPNG is a helper method to define mock.On call
155+// - ctx context.Context
156+// - key favicon.Key
157+func (_e *MockFaviconBlobStore_Expecter) ReadPNG(ctx any, key any) *MockFaviconBlobStore_ReadPNG_Call {
158+ return &MockFaviconBlobStore_ReadPNG_Call{Call: _e.mock.On("ReadPNG", ctx, key)}
159+}
160+
161+func (_c *MockFaviconBlobStore_ReadPNG_Call) Run(run func(ctx context.Context, key favicon.Key)) *MockFaviconBlobStore_ReadPNG_Call {
162+ _c.Call.Run(func(args mock.Arguments) {
163+ var arg0 context.Context
164+ if args[0] != nil {
165+ arg0 = args[0].(context.Context)
166+ }
167+ var arg1 favicon.Key
168+ if args[1] != nil {
169+ arg1 = args[1].(favicon.Key)
170+ }
171+ run(
172+ arg0,
173+ arg1,
174+ )
175+ })
176+ return _c
177+}
178+
179+func (_c *MockFaviconBlobStore_ReadPNG_Call) Return(bytes []byte, s string, err error) *MockFaviconBlobStore_ReadPNG_Call {
180+ _c.Call.Return(bytes, s, err)
181+ return _c
182+}
183+
184+func (_c *MockFaviconBlobStore_ReadPNG_Call) RunAndReturn(run func(ctx context.Context, key favicon.Key) ([]byte, string, error)) *MockFaviconBlobStore_ReadPNG_Call {
185+ _c.Call.Return(run)
186+ return _c
187+}
188+
189+// ReadSizedPNG provides a mock function for the type MockFaviconBlobStore
190+func (_mock *MockFaviconBlobStore) ReadSizedPNG(ctx context.Context, key favicon.Key, size int) ([]byte, string, error) {
191+ ret := _mock.Called(ctx, key, size)
192+
193+ if len(ret) == 0 {
194+ panic("no return value specified for ReadSizedPNG")
195+ }
196+
197+ var r0 []byte
198+ var r1 string
199+ var r2 error
200+ if returnFunc, ok := ret.Get(0).(func(context.Context, favicon.Key, int) ([]byte, string, error)); ok {
201+ return returnFunc(ctx, key, size)
202+ }
203+ if returnFunc, ok := ret.Get(0).(func(context.Context, favicon.Key, int) []byte); ok {
204+ r0 = returnFunc(ctx, key, size)
205+ } else {
206+ if ret.Get(0) != nil {
207+ r0 = ret.Get(0).([]byte)
208+ }
209+ }
210+ if returnFunc, ok := ret.Get(1).(func(context.Context, favicon.Key, int) string); ok {
211+ r1 = returnFunc(ctx, key, size)
212+ } else {
213+ r1 = ret.Get(1).(string)
214+ }
215+ if returnFunc, ok := ret.Get(2).(func(context.Context, favicon.Key, int) error); ok {
216+ r2 = returnFunc(ctx, key, size)
217+ } else {
218+ r2 = ret.Error(2)
219+ }
220+ return r0, r1, r2
221+}
222+
223+// MockFaviconBlobStore_ReadSizedPNG_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ReadSizedPNG'
224+type MockFaviconBlobStore_ReadSizedPNG_Call struct {
225+ *mock.Call
226+}
227+
228+// ReadSizedPNG is a helper method to define mock.On call
229+// - ctx context.Context
230+// - key favicon.Key
231+// - size int
232+func (_e *MockFaviconBlobStore_Expecter) ReadSizedPNG(ctx any, key any, size any) *MockFaviconBlobStore_ReadSizedPNG_Call {
233+ return &MockFaviconBlobStore_ReadSizedPNG_Call{Call: _e.mock.On("ReadSizedPNG", ctx, key, size)}
234+}
235+
236+func (_c *MockFaviconBlobStore_ReadSizedPNG_Call) Run(run func(ctx context.Context, key favicon.Key, size int)) *MockFaviconBlobStore_ReadSizedPNG_Call {
237+ _c.Call.Run(func(args mock.Arguments) {
238+ var arg0 context.Context
239+ if args[0] != nil {
240+ arg0 = args[0].(context.Context)
241+ }
242+ var arg1 favicon.Key
243+ if args[1] != nil {
244+ arg1 = args[1].(favicon.Key)
245+ }
246+ var arg2 int
247+ if args[2] != nil {
248+ arg2 = args[2].(int)
249+ }
250+ run(
251+ arg0,
252+ arg1,
253+ arg2,
254+ )
255+ })
256+ return _c
257+}
258+
259+func (_c *MockFaviconBlobStore_ReadSizedPNG_Call) Return(bytes []byte, s string, err error) *MockFaviconBlobStore_ReadSizedPNG_Call {
260+ _c.Call.Return(bytes, s, err)
261+ return _c
262+}
263+
264+func (_c *MockFaviconBlobStore_ReadSizedPNG_Call) RunAndReturn(run func(ctx context.Context, key favicon.Key, size int) ([]byte, string, error)) *MockFaviconBlobStore_ReadSizedPNG_Call {
265+ _c.Call.Return(run)
266+ return _c
267+}
268+
269+// RemoveDerived provides a mock function for the type MockFaviconBlobStore
270+func (_mock *MockFaviconBlobStore) RemoveDerived(ctx context.Context, key favicon.Key) error {
271+ ret := _mock.Called(ctx, key)
272+
273+ if len(ret) == 0 {
274+ panic("no return value specified for RemoveDerived")
275+ }
276+
277+ var r0 error
278+ if returnFunc, ok := ret.Get(0).(func(context.Context, favicon.Key) error); ok {
279+ r0 = returnFunc(ctx, key)
280+ } else {
281+ r0 = ret.Error(0)
282+ }
283+ return r0
284+}
285+
286+// MockFaviconBlobStore_RemoveDerived_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'RemoveDerived'
287+type MockFaviconBlobStore_RemoveDerived_Call struct {
288+ *mock.Call
289+}
290+
291+// RemoveDerived is a helper method to define mock.On call
292+// - ctx context.Context
293+// - key favicon.Key
294+func (_e *MockFaviconBlobStore_Expecter) RemoveDerived(ctx any, key any) *MockFaviconBlobStore_RemoveDerived_Call {
295+ return &MockFaviconBlobStore_RemoveDerived_Call{Call: _e.mock.On("RemoveDerived", ctx, key)}
296+}
297+
298+func (_c *MockFaviconBlobStore_RemoveDerived_Call) Run(run func(ctx context.Context, key favicon.Key)) *MockFaviconBlobStore_RemoveDerived_Call {
299+ _c.Call.Run(func(args mock.Arguments) {
300+ var arg0 context.Context
301+ if args[0] != nil {
302+ arg0 = args[0].(context.Context)
303+ }
304+ var arg1 favicon.Key
305+ if args[1] != nil {
306+ arg1 = args[1].(favicon.Key)
307+ }
308+ run(
309+ arg0,
310+ arg1,
311+ )
312+ })
313+ return _c
314+}
315+
316+func (_c *MockFaviconBlobStore_RemoveDerived_Call) Return(err error) *MockFaviconBlobStore_RemoveDerived_Call {
317+ _c.Call.Return(err)
318+ return _c
319+}
320+
321+func (_c *MockFaviconBlobStore_RemoveDerived_Call) RunAndReturn(run func(ctx context.Context, key favicon.Key) error) *MockFaviconBlobStore_RemoveDerived_Call {
322+ _c.Call.Return(run)
323+ return _c
324+}
325+
326+// WriteOriginal provides a mock function for the type MockFaviconBlobStore
327+func (_mock *MockFaviconBlobStore) WriteOriginal(ctx context.Context, key favicon.Key, data []byte, contentType string) error {
328+ ret := _mock.Called(ctx, key, data, contentType)
329+
330+ if len(ret) == 0 {
331+ panic("no return value specified for WriteOriginal")
332+ }
333+
334+ var r0 error
335+ if returnFunc, ok := ret.Get(0).(func(context.Context, favicon.Key, []byte, string) error); ok {
336+ r0 = returnFunc(ctx, key, data, contentType)
337+ } else {
338+ r0 = ret.Error(0)
339+ }
340+ return r0
341+}
342+
343+// MockFaviconBlobStore_WriteOriginal_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'WriteOriginal'
344+type MockFaviconBlobStore_WriteOriginal_Call struct {
345+ *mock.Call
346+}
347+
348+// WriteOriginal is a helper method to define mock.On call
349+// - ctx context.Context
350+// - key favicon.Key
351+// - data []byte
352+// - contentType string
353+func (_e *MockFaviconBlobStore_Expecter) WriteOriginal(ctx any, key any, data any, contentType any) *MockFaviconBlobStore_WriteOriginal_Call {
354+ return &MockFaviconBlobStore_WriteOriginal_Call{Call: _e.mock.On("WriteOriginal", ctx, key, data, contentType)}
355+}
356+
357+func (_c *MockFaviconBlobStore_WriteOriginal_Call) Run(run func(ctx context.Context, key favicon.Key, data []byte, contentType string)) *MockFaviconBlobStore_WriteOriginal_Call {
358+ _c.Call.Run(func(args mock.Arguments) {
359+ var arg0 context.Context
360+ if args[0] != nil {
361+ arg0 = args[0].(context.Context)
362+ }
363+ var arg1 favicon.Key
364+ if args[1] != nil {
365+ arg1 = args[1].(favicon.Key)
366+ }
367+ var arg2 []byte
368+ if args[2] != nil {
369+ arg2 = args[2].([]byte)
370+ }
371+ var arg3 string
372+ if args[3] != nil {
373+ arg3 = args[3].(string)
374+ }
375+ run(
376+ arg0,
377+ arg1,
378+ arg2,
379+ arg3,
380+ )
381+ })
382+ return _c
383+}
384+
385+func (_c *MockFaviconBlobStore_WriteOriginal_Call) Return(err error) *MockFaviconBlobStore_WriteOriginal_Call {
386+ _c.Call.Return(err)
387+ return _c
388+}
389+
390+func (_c *MockFaviconBlobStore_WriteOriginal_Call) RunAndReturn(run func(ctx context.Context, key favicon.Key, data []byte, contentType string) error) *MockFaviconBlobStore_WriteOriginal_Call {
391+ _c.Call.Return(run)
392+ return _c
393+}
394+
395+// WritePNG provides a mock function for the type MockFaviconBlobStore
396+func (_mock *MockFaviconBlobStore) WritePNG(ctx context.Context, key favicon.Key, data []byte) error {
397+ ret := _mock.Called(ctx, key, data)
398+
399+ if len(ret) == 0 {
400+ panic("no return value specified for WritePNG")
401+ }
402+
403+ var r0 error
404+ if returnFunc, ok := ret.Get(0).(func(context.Context, favicon.Key, []byte) error); ok {
405+ r0 = returnFunc(ctx, key, data)
406+ } else {
407+ r0 = ret.Error(0)
408+ }
409+ return r0
410+}
411+
412+// MockFaviconBlobStore_WritePNG_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'WritePNG'
413+type MockFaviconBlobStore_WritePNG_Call struct {
414+ *mock.Call
415+}
416+
417+// WritePNG is a helper method to define mock.On call
418+// - ctx context.Context
419+// - key favicon.Key
420+// - data []byte
421+func (_e *MockFaviconBlobStore_Expecter) WritePNG(ctx any, key any, data any) *MockFaviconBlobStore_WritePNG_Call {
422+ return &MockFaviconBlobStore_WritePNG_Call{Call: _e.mock.On("WritePNG", ctx, key, data)}
423+}
424+
425+func (_c *MockFaviconBlobStore_WritePNG_Call) Run(run func(ctx context.Context, key favicon.Key, data []byte)) *MockFaviconBlobStore_WritePNG_Call {
426+ _c.Call.Run(func(args mock.Arguments) {
427+ var arg0 context.Context
428+ if args[0] != nil {
429+ arg0 = args[0].(context.Context)
430+ }
431+ var arg1 favicon.Key
432+ if args[1] != nil {
433+ arg1 = args[1].(favicon.Key)
434+ }
435+ var arg2 []byte
436+ if args[2] != nil {
437+ arg2 = args[2].([]byte)
438+ }
439+ run(
440+ arg0,
441+ arg1,
442+ arg2,
443+ )
444+ })
445+ return _c
446+}
447+
448+func (_c *MockFaviconBlobStore_WritePNG_Call) Return(err error) *MockFaviconBlobStore_WritePNG_Call {
449+ _c.Call.Return(err)
450+ return _c
451+}
452+
453+func (_c *MockFaviconBlobStore_WritePNG_Call) RunAndReturn(run func(ctx context.Context, key favicon.Key, data []byte) error) *MockFaviconBlobStore_WritePNG_Call {
454+ _c.Call.Return(run)
455+ return _c
456+}
457+
458+// WriteSizedPNG provides a mock function for the type MockFaviconBlobStore
459+func (_mock *MockFaviconBlobStore) WriteSizedPNG(ctx context.Context, key favicon.Key, size int, data []byte) error {
460+ ret := _mock.Called(ctx, key, size, data)
461+
462+ if len(ret) == 0 {
463+ panic("no return value specified for WriteSizedPNG")
464+ }
465+
466+ var r0 error
467+ if returnFunc, ok := ret.Get(0).(func(context.Context, favicon.Key, int, []byte) error); ok {
468+ r0 = returnFunc(ctx, key, size, data)
469+ } else {
470+ r0 = ret.Error(0)
471+ }
472+ return r0
473+}
474+
475+// MockFaviconBlobStore_WriteSizedPNG_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'WriteSizedPNG'
476+type MockFaviconBlobStore_WriteSizedPNG_Call struct {
477+ *mock.Call
478+}
479+
480+// WriteSizedPNG is a helper method to define mock.On call
481+// - ctx context.Context
482+// - key favicon.Key
483+// - size int
484+// - data []byte
485+func (_e *MockFaviconBlobStore_Expecter) WriteSizedPNG(ctx any, key any, size any, data any) *MockFaviconBlobStore_WriteSizedPNG_Call {
486+ return &MockFaviconBlobStore_WriteSizedPNG_Call{Call: _e.mock.On("WriteSizedPNG", ctx, key, size, data)}
487+}
488+
489+func (_c *MockFaviconBlobStore_WriteSizedPNG_Call) Run(run func(ctx context.Context, key favicon.Key, size int, data []byte)) *MockFaviconBlobStore_WriteSizedPNG_Call {
490+ _c.Call.Run(func(args mock.Arguments) {
491+ var arg0 context.Context
492+ if args[0] != nil {
493+ arg0 = args[0].(context.Context)
494+ }
495+ var arg1 favicon.Key
496+ if args[1] != nil {
497+ arg1 = args[1].(favicon.Key)
498+ }
499+ var arg2 int
500+ if args[2] != nil {
501+ arg2 = args[2].(int)
502+ }
503+ var arg3 []byte
504+ if args[3] != nil {
505+ arg3 = args[3].([]byte)
506+ }
507+ run(
508+ arg0,
509+ arg1,
510+ arg2,
511+ arg3,
512+ )
513+ })
514+ return _c
515+}
516+
517+func (_c *MockFaviconBlobStore_WriteSizedPNG_Call) Return(err error) *MockFaviconBlobStore_WriteSizedPNG_Call {
518+ _c.Call.Return(err)
519+ return _c
520+}
521+
522+func (_c *MockFaviconBlobStore_WriteSizedPNG_Call) RunAndReturn(run func(ctx context.Context, key favicon.Key, size int, data []byte) error) *MockFaviconBlobStore_WriteSizedPNG_Call {
523+ _c.Call.Return(run)
524+ return _c
525+}
A internal/application/port/mocks/favicon_converter.go +119 -0
@@ -0,0 +1,119 @@
1+// Code generated by mockery; DO NOT EDIT.
2+// github.com/vektra/mockery
3+// template: testify
4+
5+package mocks
6+
7+import (
8+ "context"
9+
10+ "github.com/bnema/dumber/internal/application/port"
11+ mock "github.com/stretchr/testify/mock"
12+)
13+
14+// NewMockFaviconImageConverter creates a new instance of MockFaviconImageConverter. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
15+// The first argument is typically a *testing.T value.
16+func NewMockFaviconImageConverter(t interface {
17+ mock.TestingT
18+ Cleanup(func())
19+}) *MockFaviconImageConverter {
20+ mock := &MockFaviconImageConverter{}
21+ mock.Mock.Test(t)
22+
23+ t.Cleanup(func() { mock.AssertExpectations(t) })
24+
25+ return mock
26+}
27+
28+// MockFaviconImageConverter is an autogenerated mock type for the FaviconImageConverter type
29+type MockFaviconImageConverter struct {
30+ mock.Mock
31+}
32+
33+type MockFaviconImageConverter_Expecter struct {
34+ mock *mock.Mock
35+}
36+
37+func (_m *MockFaviconImageConverter) EXPECT() *MockFaviconImageConverter_Expecter {
38+ return &MockFaviconImageConverter_Expecter{mock: &_m.Mock}
39+}
40+
41+// Convert provides a mock function for the type MockFaviconImageConverter
42+func (_mock *MockFaviconImageConverter) Convert(ctx context.Context, original []byte, contentType string, sizes []int) (*port.ConvertedFavicon, error) {
43+ ret := _mock.Called(ctx, original, contentType, sizes)
44+
45+ if len(ret) == 0 {
46+ panic("no return value specified for Convert")
47+ }
48+
49+ var r0 *port.ConvertedFavicon
50+ var r1 error
51+ if returnFunc, ok := ret.Get(0).(func(context.Context, []byte, string, []int) (*port.ConvertedFavicon, error)); ok {
52+ return returnFunc(ctx, original, contentType, sizes)
53+ }
54+ if returnFunc, ok := ret.Get(0).(func(context.Context, []byte, string, []int) *port.ConvertedFavicon); ok {
55+ r0 = returnFunc(ctx, original, contentType, sizes)
56+ } else {
57+ if ret.Get(0) != nil {
58+ r0 = ret.Get(0).(*port.ConvertedFavicon)
59+ }
60+ }
61+ if returnFunc, ok := ret.Get(1).(func(context.Context, []byte, string, []int) error); ok {
62+ r1 = returnFunc(ctx, original, contentType, sizes)
63+ } else {
64+ r1 = ret.Error(1)
65+ }
66+ return r0, r1
67+}
68+
69+// MockFaviconImageConverter_Convert_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Convert'
70+type MockFaviconImageConverter_Convert_Call struct {
71+ *mock.Call
72+}
73+
74+// Convert is a helper method to define mock.On call
75+// - ctx context.Context
76+// - original []byte
77+// - contentType string
78+// - sizes []int
79+func (_e *MockFaviconImageConverter_Expecter) Convert(ctx any, original any, contentType any, sizes any) *MockFaviconImageConverter_Convert_Call {
80+ return &MockFaviconImageConverter_Convert_Call{Call: _e.mock.On("Convert", ctx, original, contentType, sizes)}
81+}
82+
83+func (_c *MockFaviconImageConverter_Convert_Call) Run(run func(ctx context.Context, original []byte, contentType string, sizes []int)) *MockFaviconImageConverter_Convert_Call {
84+ _c.Call.Run(func(args mock.Arguments) {
85+ var arg0 context.Context
86+ if args[0] != nil {
87+ arg0 = args[0].(context.Context)
88+ }
89+ var arg1 []byte
90+ if args[1] != nil {
91+ arg1 = args[1].([]byte)
92+ }
93+ var arg2 string
94+ if args[2] != nil {
95+ arg2 = args[2].(string)
96+ }
97+ var arg3 []int
98+ if args[3] != nil {
99+ arg3 = args[3].([]int)
100+ }
101+ run(
102+ arg0,
103+ arg1,
104+ arg2,
105+ arg3,
106+ )
107+ })
108+ return _c
109+}
110+
111+func (_c *MockFaviconImageConverter_Convert_Call) Return(convertedFavicon *port.ConvertedFavicon, err error) *MockFaviconImageConverter_Convert_Call {
112+ _c.Call.Return(convertedFavicon, err)
113+ return _c
114+}
115+
116+func (_c *MockFaviconImageConverter_Convert_Call) RunAndReturn(run func(ctx context.Context, original []byte, contentType string, sizes []int) (*port.ConvertedFavicon, error)) *MockFaviconImageConverter_Convert_Call {
117+ _c.Call.Return(run)
118+ return _c
119+}
A internal/application/port/mocks/favicon_fetcher.go +107 -0
@@ -0,0 +1,107 @@
1+// Code generated by mockery; DO NOT EDIT.
2+// github.com/vektra/mockery
3+// template: testify
4+
5+package mocks
6+
7+import (
8+ "context"
9+
10+ "github.com/bnema/dumber/internal/application/port"
11+ mock "github.com/stretchr/testify/mock"
12+)
13+
14+// NewMockFaviconFetcher creates a new instance of MockFaviconFetcher. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
15+// The first argument is typically a *testing.T value.
16+func NewMockFaviconFetcher(t interface {
17+ mock.TestingT
18+ Cleanup(func())
19+}) *MockFaviconFetcher {
20+ mock := &MockFaviconFetcher{}
21+ mock.Mock.Test(t)
22+
23+ t.Cleanup(func() { mock.AssertExpectations(t) })
24+
25+ return mock
26+}
27+
28+// MockFaviconFetcher is an autogenerated mock type for the FaviconFetcher type
29+type MockFaviconFetcher struct {
30+ mock.Mock
31+}
32+
33+type MockFaviconFetcher_Expecter struct {
34+ mock *mock.Mock
35+}
36+
37+func (_m *MockFaviconFetcher) EXPECT() *MockFaviconFetcher_Expecter {
38+ return &MockFaviconFetcher_Expecter{mock: &_m.Mock}
39+}
40+
41+// Fetch provides a mock function for the type MockFaviconFetcher
42+func (_mock *MockFaviconFetcher) Fetch(ctx context.Context, request port.FaviconFetchRequest) (*port.FaviconFetchedIcon, error) {
43+ ret := _mock.Called(ctx, request)
44+
45+ if len(ret) == 0 {
46+ panic("no return value specified for Fetch")
47+ }
48+
49+ var r0 *port.FaviconFetchedIcon
50+ var r1 error
51+ if returnFunc, ok := ret.Get(0).(func(context.Context, port.FaviconFetchRequest) (*port.FaviconFetchedIcon, error)); ok {
52+ return returnFunc(ctx, request)
53+ }
54+ if returnFunc, ok := ret.Get(0).(func(context.Context, port.FaviconFetchRequest) *port.FaviconFetchedIcon); ok {
55+ r0 = returnFunc(ctx, request)
56+ } else {
57+ if ret.Get(0) != nil {
58+ r0 = ret.Get(0).(*port.FaviconFetchedIcon)
59+ }
60+ }
61+ if returnFunc, ok := ret.Get(1).(func(context.Context, port.FaviconFetchRequest) error); ok {
62+ r1 = returnFunc(ctx, request)
63+ } else {
64+ r1 = ret.Error(1)
65+ }
66+ return r0, r1
67+}
68+
69+// MockFaviconFetcher_Fetch_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Fetch'
70+type MockFaviconFetcher_Fetch_Call struct {
71+ *mock.Call
72+}
73+
74+// Fetch is a helper method to define mock.On call
75+// - ctx context.Context
76+// - request port.FaviconFetchRequest
77+func (_e *MockFaviconFetcher_Expecter) Fetch(ctx any, request any) *MockFaviconFetcher_Fetch_Call {
78+ return &MockFaviconFetcher_Fetch_Call{Call: _e.mock.On("Fetch", ctx, request)}
79+}
80+
81+func (_c *MockFaviconFetcher_Fetch_Call) Run(run func(ctx context.Context, request port.FaviconFetchRequest)) *MockFaviconFetcher_Fetch_Call {
82+ _c.Call.Run(func(args mock.Arguments) {
83+ var arg0 context.Context
84+ if args[0] != nil {
85+ arg0 = args[0].(context.Context)
86+ }
87+ var arg1 port.FaviconFetchRequest
88+ if args[1] != nil {
89+ arg1 = args[1].(port.FaviconFetchRequest)
90+ }
91+ run(
92+ arg0,
93+ arg1,
94+ )
95+ })
96+ return _c
97+}
98+
99+func (_c *MockFaviconFetcher_Fetch_Call) Return(faviconFetchedIcon *port.FaviconFetchedIcon, err error) *MockFaviconFetcher_Fetch_Call {
100+ _c.Call.Return(faviconFetchedIcon, err)
101+ return _c
102+}
103+
104+func (_c *MockFaviconFetcher_Fetch_Call) RunAndReturn(run func(ctx context.Context, request port.FaviconFetchRequest) (*port.FaviconFetchedIcon, error)) *MockFaviconFetcher_Fetch_Call {
105+ _c.Call.Return(run)
106+ return _c
107+}
A internal/application/port/mocks/favicon_invalidator.go +96 -0
@@ -0,0 +1,96 @@
1+// Code generated by mockery; DO NOT EDIT.
2+// github.com/vektra/mockery
3+// template: testify
4+
5+package mocks
6+
7+import (
8+ "context"
9+
10+ "github.com/bnema/dumber/internal/domain/favicon"
11+ mock "github.com/stretchr/testify/mock"
12+)
13+
14+// NewMockFaviconInvalidators creates a new instance of MockFaviconInvalidators. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
15+// The first argument is typically a *testing.T value.
16+func NewMockFaviconInvalidators(t interface {
17+ mock.TestingT
18+ Cleanup(func())
19+}) *MockFaviconInvalidators {
20+ mock := &MockFaviconInvalidators{}
21+ mock.Mock.Test(t)
22+
23+ t.Cleanup(func() { mock.AssertExpectations(t) })
24+
25+ return mock
26+}
27+
28+// MockFaviconInvalidators is an autogenerated mock type for the FaviconInvalidators type
29+type MockFaviconInvalidators struct {
30+ mock.Mock
31+}
32+
33+type MockFaviconInvalidators_Expecter struct {
34+ mock *mock.Mock
35+}
36+
37+func (_m *MockFaviconInvalidators) EXPECT() *MockFaviconInvalidators_Expecter {
38+ return &MockFaviconInvalidators_Expecter{mock: &_m.Mock}
39+}
40+
41+// InvalidateAll provides a mock function for the type MockFaviconInvalidators
42+func (_mock *MockFaviconInvalidators) InvalidateAll(ctx context.Context, key favicon.Key) error {
43+ ret := _mock.Called(ctx, key)
44+
45+ if len(ret) == 0 {
46+ panic("no return value specified for InvalidateAll")
47+ }
48+
49+ var r0 error
50+ if returnFunc, ok := ret.Get(0).(func(context.Context, favicon.Key) error); ok {
51+ r0 = returnFunc(ctx, key)
52+ } else {
53+ r0 = ret.Error(0)
54+ }
55+ return r0
56+}
57+
58+// MockFaviconInvalidators_InvalidateAll_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'InvalidateAll'
59+type MockFaviconInvalidators_InvalidateAll_Call struct {
60+ *mock.Call
61+}
62+
63+// InvalidateAll is a helper method to define mock.On call
64+// - ctx context.Context
65+// - key favicon.Key
66+func (_e *MockFaviconInvalidators_Expecter) InvalidateAll(ctx any, key any) *MockFaviconInvalidators_InvalidateAll_Call {
67+ return &MockFaviconInvalidators_InvalidateAll_Call{Call: _e.mock.On("InvalidateAll", ctx, key)}
68+}
69+
70+func (_c *MockFaviconInvalidators_InvalidateAll_Call) Run(run func(ctx context.Context, key favicon.Key)) *MockFaviconInvalidators_InvalidateAll_Call {
71+ _c.Call.Run(func(args mock.Arguments) {
72+ var arg0 context.Context
73+ if args[0] != nil {
74+ arg0 = args[0].(context.Context)
75+ }
76+ var arg1 favicon.Key
77+ if args[1] != nil {
78+ arg1 = args[1].(favicon.Key)
79+ }
80+ run(
81+ arg0,
82+ arg1,
83+ )
84+ })
85+ return _c
86+}
87+
88+func (_c *MockFaviconInvalidators_InvalidateAll_Call) Return(err error) *MockFaviconInvalidators_InvalidateAll_Call {
89+ _c.Call.Return(err)
90+ return _c
91+}
92+
93+func (_c *MockFaviconInvalidators_InvalidateAll_Call) RunAndReturn(run func(ctx context.Context, key favicon.Key) error) *MockFaviconInvalidators_InvalidateAll_Call {
94+ _c.Call.Return(run)
95+ return _c
96+}
A internal/application/port/mocks/favicon_repository.go +359 -0
@@ -0,0 +1,359 @@
1+// Code generated by mockery; DO NOT EDIT.
2+// github.com/vektra/mockery
3+// template: testify
4+
5+package mocks
6+
7+import (
8+ "context"
9+ "time"
10+
11+ "github.com/bnema/dumber/internal/domain/favicon"
12+ mock "github.com/stretchr/testify/mock"
13+)
14+
15+// NewMockFaviconRepository creates a new instance of MockFaviconRepository. 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.
17+func NewMockFaviconRepository(t interface {
18+ mock.TestingT
19+ Cleanup(func())
20+}) *MockFaviconRepository {
21+ mock := &MockFaviconRepository{}
22+ mock.Mock.Test(t)
23+
24+ t.Cleanup(func() { mock.AssertExpectations(t) })
25+
26+ return mock
27+}
28+
29+// MockFaviconRepository is an autogenerated mock type for the FaviconRepository type
30+type MockFaviconRepository struct {
31+ mock.Mock
32+}
33+
34+type MockFaviconRepository_Expecter struct {
35+ mock *mock.Mock
36+}
37+
38+func (_m *MockFaviconRepository) EXPECT() *MockFaviconRepository_Expecter {
39+ return &MockFaviconRepository_Expecter{mock: &_m.Mock}
40+}
41+
42+// Delete provides a mock function for the type MockFaviconRepository
43+func (_mock *MockFaviconRepository) Delete(ctx context.Context, key favicon.Key) error {
44+ ret := _mock.Called(ctx, key)
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, favicon.Key) error); ok {
52+ r0 = returnFunc(ctx, key)
53+ } else {
54+ r0 = ret.Error(0)
55+ }
56+ return r0
57+}
58+
59+// MockFaviconRepository_Delete_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Delete'
60+type MockFaviconRepository_Delete_Call struct {
61+ *mock.Call
62+}
63+
64+// Delete is a helper method to define mock.On call
65+// - ctx context.Context
66+// - key favicon.Key
67+func (_e *MockFaviconRepository_Expecter) Delete(ctx any, key any) *MockFaviconRepository_Delete_Call {
68+ return &MockFaviconRepository_Delete_Call{Call: _e.mock.On("Delete", ctx, key)}
69+}
70+
71+func (_c *MockFaviconRepository_Delete_Call) Run(run func(ctx context.Context, key favicon.Key)) *MockFaviconRepository_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 favicon.Key
78+ if args[1] != nil {
79+ arg1 = args[1].(favicon.Key)
80+ }
81+ run(
82+ arg0,
83+ arg1,
84+ )
85+ })
86+ return _c
87+}
88+
89+func (_c *MockFaviconRepository_Delete_Call) Return(err error) *MockFaviconRepository_Delete_Call {
90+ _c.Call.Return(err)
91+ return _c
92+}
93+
94+func (_c *MockFaviconRepository_Delete_Call) RunAndReturn(run func(ctx context.Context, key favicon.Key) error) *MockFaviconRepository_Delete_Call {
95+ _c.Call.Return(run)
96+ return _c
97+}
98+
99+// FindFirst provides a mock function for the type MockFaviconRepository
100+func (_mock *MockFaviconRepository) FindFirst(ctx context.Context, keys []favicon.Key) (*favicon.Metadata, error) {
101+ ret := _mock.Called(ctx, keys)
102+
103+ if len(ret) == 0 {
104+ panic("no return value specified for FindFirst")
105+ }
106+
107+ var r0 *favicon.Metadata
108+ var r1 error
109+ if returnFunc, ok := ret.Get(0).(func(context.Context, []favicon.Key) (*favicon.Metadata, error)); ok {
110+ return returnFunc(ctx, keys)
111+ }
112+ if returnFunc, ok := ret.Get(0).(func(context.Context, []favicon.Key) *favicon.Metadata); ok {
113+ r0 = returnFunc(ctx, keys)
114+ } else {
115+ if ret.Get(0) != nil {
116+ r0 = ret.Get(0).(*favicon.Metadata)
117+ }
118+ }
119+ if returnFunc, ok := ret.Get(1).(func(context.Context, []favicon.Key) error); ok {
120+ r1 = returnFunc(ctx, keys)
121+ } else {
122+ r1 = ret.Error(1)
123+ }
124+ return r0, r1
125+}
126+
127+// MockFaviconRepository_FindFirst_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'FindFirst'
128+type MockFaviconRepository_FindFirst_Call struct {
129+ *mock.Call
130+}
131+
132+// FindFirst is a helper method to define mock.On call
133+// - ctx context.Context
134+// - keys []favicon.Key
135+func (_e *MockFaviconRepository_Expecter) FindFirst(ctx any, keys any) *MockFaviconRepository_FindFirst_Call {
136+ return &MockFaviconRepository_FindFirst_Call{Call: _e.mock.On("FindFirst", ctx, keys)}
137+}
138+
139+func (_c *MockFaviconRepository_FindFirst_Call) Run(run func(ctx context.Context, keys []favicon.Key)) *MockFaviconRepository_FindFirst_Call {
140+ _c.Call.Run(func(args mock.Arguments) {
141+ var arg0 context.Context
142+ if args[0] != nil {
143+ arg0 = args[0].(context.Context)
144+ }
145+ var arg1 []favicon.Key
146+ if args[1] != nil {
147+ arg1 = args[1].([]favicon.Key)
148+ }
149+ run(
150+ arg0,
151+ arg1,
152+ )
153+ })
154+ return _c
155+}
156+
157+func (_c *MockFaviconRepository_FindFirst_Call) Return(metadata *favicon.Metadata, err error) *MockFaviconRepository_FindFirst_Call {
158+ _c.Call.Return(metadata, err)
159+ return _c
160+}
161+
162+func (_c *MockFaviconRepository_FindFirst_Call) RunAndReturn(run func(ctx context.Context, keys []favicon.Key) (*favicon.Metadata, error)) *MockFaviconRepository_FindFirst_Call {
163+ _c.Call.Return(run)
164+ return _c
165+}
166+
167+// Get provides a mock function for the type MockFaviconRepository
168+func (_mock *MockFaviconRepository) Get(ctx context.Context, key favicon.Key) (*favicon.Metadata, error) {
169+ ret := _mock.Called(ctx, key)
170+
171+ if len(ret) == 0 {
172+ panic("no return value specified for Get")
173+ }
174+
175+ var r0 *favicon.Metadata
176+ var r1 error
177+ if returnFunc, ok := ret.Get(0).(func(context.Context, favicon.Key) (*favicon.Metadata, error)); ok {
178+ return returnFunc(ctx, key)
179+ }
180+ if returnFunc, ok := ret.Get(0).(func(context.Context, favicon.Key) *favicon.Metadata); ok {
181+ r0 = returnFunc(ctx, key)
182+ } else {
183+ if ret.Get(0) != nil {
184+ r0 = ret.Get(0).(*favicon.Metadata)
185+ }
186+ }
187+ if returnFunc, ok := ret.Get(1).(func(context.Context, favicon.Key) error); ok {
188+ r1 = returnFunc(ctx, key)
189+ } else {
190+ r1 = ret.Error(1)
191+ }
192+ return r0, r1
193+}
194+
195+// MockFaviconRepository_Get_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Get'
196+type MockFaviconRepository_Get_Call struct {
197+ *mock.Call
198+}
199+
200+// Get is a helper method to define mock.On call
201+// - ctx context.Context
202+// - key favicon.Key
203+func (_e *MockFaviconRepository_Expecter) Get(ctx any, key any) *MockFaviconRepository_Get_Call {
204+ return &MockFaviconRepository_Get_Call{Call: _e.mock.On("Get", ctx, key)}
205+}
206+
207+func (_c *MockFaviconRepository_Get_Call) Run(run func(ctx context.Context, key favicon.Key)) *MockFaviconRepository_Get_Call {
208+ _c.Call.Run(func(args mock.Arguments) {
209+ var arg0 context.Context
210+ if args[0] != nil {
211+ arg0 = args[0].(context.Context)
212+ }
213+ var arg1 favicon.Key
214+ if args[1] != nil {
215+ arg1 = args[1].(favicon.Key)
216+ }
217+ run(
218+ arg0,
219+ arg1,
220+ )
221+ })
222+ return _c
223+}
224+
225+func (_c *MockFaviconRepository_Get_Call) Return(metadata *favicon.Metadata, err error) *MockFaviconRepository_Get_Call {
226+ _c.Call.Return(metadata, err)
227+ return _c
228+}
229+
230+func (_c *MockFaviconRepository_Get_Call) RunAndReturn(run func(ctx context.Context, key favicon.Key) (*favicon.Metadata, error)) *MockFaviconRepository_Get_Call {
231+ _c.Call.Return(run)
232+ return _c
233+}
234+
235+// UpdateLastChecked provides a mock function for the type MockFaviconRepository
236+func (_mock *MockFaviconRepository) UpdateLastChecked(ctx context.Context, key favicon.Key, contentHash string, checkedAt time.Time) error {
237+ ret := _mock.Called(ctx, key, contentHash, checkedAt)
238+
239+ if len(ret) == 0 {
240+ panic("no return value specified for UpdateLastChecked")
241+ }
242+
243+ var r0 error
244+ if returnFunc, ok := ret.Get(0).(func(context.Context, favicon.Key, string, time.Time) error); ok {
245+ r0 = returnFunc(ctx, key, contentHash, checkedAt)
246+ } else {
247+ r0 = ret.Error(0)
248+ }
249+ return r0
250+}
251+
252+// MockFaviconRepository_UpdateLastChecked_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UpdateLastChecked'
253+type MockFaviconRepository_UpdateLastChecked_Call struct {
254+ *mock.Call
255+}
256+
257+// UpdateLastChecked is a helper method to define mock.On call
258+// - ctx context.Context
259+// - key favicon.Key
260+// - contentHash string
261+// - checkedAt time.Time
262+func (_e *MockFaviconRepository_Expecter) UpdateLastChecked(ctx any, key any, contentHash any, checkedAt any) *MockFaviconRepository_UpdateLastChecked_Call {
263+ return &MockFaviconRepository_UpdateLastChecked_Call{Call: _e.mock.On("UpdateLastChecked", ctx, key, contentHash, checkedAt)}
264+}
265+
266+func (_c *MockFaviconRepository_UpdateLastChecked_Call) Run(run func(ctx context.Context, key favicon.Key, contentHash string, checkedAt time.Time)) *MockFaviconRepository_UpdateLastChecked_Call {
267+ _c.Call.Run(func(args mock.Arguments) {
268+ var arg0 context.Context
269+ if args[0] != nil {
270+ arg0 = args[0].(context.Context)
271+ }
272+ var arg1 favicon.Key
273+ if args[1] != nil {
274+ arg1 = args[1].(favicon.Key)
275+ }
276+ var arg2 string
277+ if args[2] != nil {
278+ arg2 = args[2].(string)
279+ }
280+ var arg3 time.Time
281+ if args[3] != nil {
282+ arg3 = args[3].(time.Time)
283+ }
284+ run(
285+ arg0,
286+ arg1,
287+ arg2,
288+ arg3,
289+ )
290+ })
291+ return _c
292+}
293+
294+func (_c *MockFaviconRepository_UpdateLastChecked_Call) Return(err error) *MockFaviconRepository_UpdateLastChecked_Call {
295+ _c.Call.Return(err)
296+ return _c
297+}
298+
299+func (_c *MockFaviconRepository_UpdateLastChecked_Call) RunAndReturn(run func(ctx context.Context, key favicon.Key, contentHash string, checkedAt time.Time) error) *MockFaviconRepository_UpdateLastChecked_Call {
300+ _c.Call.Return(run)
301+ return _c
302+}
303+
304+// Upsert provides a mock function for the type MockFaviconRepository
305+func (_mock *MockFaviconRepository) Upsert(ctx context.Context, meta favicon.Metadata) error {
306+ ret := _mock.Called(ctx, meta)
307+
308+ if len(ret) == 0 {
309+ panic("no return value specified for Upsert")
310+ }
311+
312+ var r0 error
313+ if returnFunc, ok := ret.Get(0).(func(context.Context, favicon.Metadata) error); ok {
314+ r0 = returnFunc(ctx, meta)
315+ } else {
316+ r0 = ret.Error(0)
317+ }
318+ return r0
319+}
320+
321+// MockFaviconRepository_Upsert_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Upsert'
322+type MockFaviconRepository_Upsert_Call struct {
323+ *mock.Call
324+}
325+
326+// Upsert is a helper method to define mock.On call
327+// - ctx context.Context
328+// - meta favicon.Metadata
329+func (_e *MockFaviconRepository_Expecter) Upsert(ctx any, meta any) *MockFaviconRepository_Upsert_Call {
330+ return &MockFaviconRepository_Upsert_Call{Call: _e.mock.On("Upsert", ctx, meta)}
331+}
332+
333+func (_c *MockFaviconRepository_Upsert_Call) Run(run func(ctx context.Context, meta favicon.Metadata)) *MockFaviconRepository_Upsert_Call {
334+ _c.Call.Run(func(args mock.Arguments) {
335+ var arg0 context.Context
336+ if args[0] != nil {
337+ arg0 = args[0].(context.Context)
338+ }
339+ var arg1 favicon.Metadata
340+ if args[1] != nil {
341+ arg1 = args[1].(favicon.Metadata)
342+ }
343+ run(
344+ arg0,
345+ arg1,
346+ )
347+ })
348+ return _c
349+}
350+
351+func (_c *MockFaviconRepository_Upsert_Call) Return(err error) *MockFaviconRepository_Upsert_Call {
352+ _c.Call.Return(err)
353+ return _c
354+}
355+
356+func (_c *MockFaviconRepository_Upsert_Call) RunAndReturn(run func(ctx context.Context, meta favicon.Metadata) error) *MockFaviconRepository_Upsert_Call {
357+ _c.Call.Return(run)
358+ return _c
359+}
M internal/application/port/mocks/favicon_resolver.go +6 -6
@@ -65,7 +65,7 @@ type MockFaviconResolver_EnsureSized_Call struct {
6565 // - ctx context.Context
6666 // - key favicon.Key
6767 // - size int
68-func (_e *MockFaviconResolver_Expecter) EnsureSized(ctx interface{}, key interface{}, size interface{}) *MockFaviconResolver_EnsureSized_Call {
68+func (_e *MockFaviconResolver_Expecter) EnsureSized(ctx any, key any, size any) *MockFaviconResolver_EnsureSized_Call {
6969 return &MockFaviconResolver_EnsureSized_Call{Call: _e.mock.On("EnsureSized", ctx, key, size)}
7070 }
7171
@@ -127,7 +127,7 @@ type MockFaviconResolver_Invalidate_Call struct {
127127 // Invalidate is a helper method to define mock.On call
128128 // - ctx context.Context
129129 // - key favicon.Key
130-func (_e *MockFaviconResolver_Expecter) Invalidate(ctx interface{}, key interface{}) *MockFaviconResolver_Invalidate_Call {
130+func (_e *MockFaviconResolver_Expecter) Invalidate(ctx any, key any) *MockFaviconResolver_Invalidate_Call {
131131 return &MockFaviconResolver_Invalidate_Call{Call: _e.mock.On("Invalidate", ctx, key)}
132132 }
133133
@@ -199,7 +199,7 @@ type MockFaviconResolver_Observe_Call struct {
199199 // - bytes []byte
200200 // - source favicon.Source
201201 // - contentType string
202-func (_e *MockFaviconResolver_Expecter) Observe(ctx interface{}, pageURL interface{}, iconURL interface{}, bytes interface{}, source interface{}, contentType interface{}) *MockFaviconResolver_Observe_Call {
202+func (_e *MockFaviconResolver_Expecter) Observe(ctx any, pageURL any, iconURL any, bytes any, source any, contentType any) *MockFaviconResolver_Observe_Call {
203203 return &MockFaviconResolver_Observe_Call{Call: _e.mock.On("Observe", ctx, pageURL, iconURL, bytes, source, contentType)}
204204 }
205205
@@ -277,7 +277,7 @@ type MockFaviconResolver_RefreshFromIconURLs_Call struct {
277277 // - ctx context.Context
278278 // - pageURL string
279279 // - iconURLs []string
280-func (_e *MockFaviconResolver_Expecter) RefreshFromIconURLs(ctx interface{}, pageURL interface{}, iconURLs interface{}) *MockFaviconResolver_RefreshFromIconURLs_Call {
280+func (_e *MockFaviconResolver_Expecter) RefreshFromIconURLs(ctx any, pageURL any, iconURLs any) *MockFaviconResolver_RefreshFromIconURLs_Call {
281281 return &MockFaviconResolver_RefreshFromIconURLs_Call{Call: _e.mock.On("RefreshFromIconURLs", ctx, pageURL, iconURLs)}
282282 }
283283
@@ -352,7 +352,7 @@ type MockFaviconResolver_Resolve_Call struct {
352352 // - rawURLOrDomain string
353353 // - size int
354354 // - options port.FaviconResolveOptions
355-func (_e *MockFaviconResolver_Expecter) Resolve(ctx interface{}, rawURLOrDomain interface{}, size interface{}, options interface{}) *MockFaviconResolver_Resolve_Call {
355+func (_e *MockFaviconResolver_Expecter) Resolve(ctx any, rawURLOrDomain any, size any, options any) *MockFaviconResolver_Resolve_Call {
356356 return &MockFaviconResolver_Resolve_Call{Call: _e.mock.On("Resolve", ctx, rawURLOrDomain, size, options)}
357357 }
358358
@@ -431,7 +431,7 @@ type MockFaviconResolver_ResolveSystemviewIcon_Call struct {
431431 // - ctx context.Context
432432 // - rawDomain string
433433 // - size int
434-func (_e *MockFaviconResolver_Expecter) ResolveSystemviewIcon(ctx interface{}, rawDomain interface{}, size interface{}) *MockFaviconResolver_ResolveSystemviewIcon_Call {
434+func (_e *MockFaviconResolver_Expecter) ResolveSystemviewIcon(ctx any, rawDomain any, size any) *MockFaviconResolver_ResolveSystemviewIcon_Call {
435435 return &MockFaviconResolver_ResolveSystemviewIcon_Call{Call: _e.mock.On("ResolveSystemviewIcon", ctx, rawDomain, size)}
436436 }
437437
A internal/application/port/mocks/favicon_scheduler.go +102 -0
@@ -0,0 +1,102 @@
1+// Code generated by mockery; DO NOT EDIT.
2+// github.com/vektra/mockery
3+// template: testify
4+
5+package mocks
6+
7+import (
8+ "context"
9+
10+ "github.com/bnema/dumber/internal/domain/favicon"
11+ mock "github.com/stretchr/testify/mock"
12+)
13+
14+// NewMockFaviconRefreshScheduler creates a new instance of MockFaviconRefreshScheduler. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
15+// The first argument is typically a *testing.T value.
16+func NewMockFaviconRefreshScheduler(t interface {
17+ mock.TestingT
18+ Cleanup(func())
19+}) *MockFaviconRefreshScheduler {
20+ mock := &MockFaviconRefreshScheduler{}
21+ mock.Mock.Test(t)
22+
23+ t.Cleanup(func() { mock.AssertExpectations(t) })
24+
25+ return mock
26+}
27+
28+// MockFaviconRefreshScheduler is an autogenerated mock type for the FaviconRefreshScheduler type
29+type MockFaviconRefreshScheduler struct {
30+ mock.Mock
31+}
32+
33+type MockFaviconRefreshScheduler_Expecter struct {
34+ mock *mock.Mock
35+}
36+
37+func (_m *MockFaviconRefreshScheduler) EXPECT() *MockFaviconRefreshScheduler_Expecter {
38+ return &MockFaviconRefreshScheduler_Expecter{mock: &_m.Mock}
39+}
40+
41+// Schedule provides a mock function for the type MockFaviconRefreshScheduler
42+func (_mock *MockFaviconRefreshScheduler) Schedule(ctx context.Context, key favicon.Key, work func(context.Context)) bool {
43+ ret := _mock.Called(ctx, key, work)
44+
45+ if len(ret) == 0 {
46+ panic("no return value specified for Schedule")
47+ }
48+
49+ var r0 bool
50+ if returnFunc, ok := ret.Get(0).(func(context.Context, favicon.Key, func(context.Context)) bool); ok {
51+ r0 = returnFunc(ctx, key, work)
52+ } else {
53+ r0 = ret.Get(0).(bool)
54+ }
55+ return r0
56+}
57+
58+// MockFaviconRefreshScheduler_Schedule_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Schedule'
59+type MockFaviconRefreshScheduler_Schedule_Call struct {
60+ *mock.Call
61+}
62+
63+// Schedule is a helper method to define mock.On call
64+// - ctx context.Context
65+// - key favicon.Key
66+// - work func(context.Context)
67+func (_e *MockFaviconRefreshScheduler_Expecter) Schedule(ctx any, key any, work any) *MockFaviconRefreshScheduler_Schedule_Call {
68+ return &MockFaviconRefreshScheduler_Schedule_Call{Call: _e.mock.On("Schedule", ctx, key, work)}
69+}
70+
71+func (_c *MockFaviconRefreshScheduler_Schedule_Call) Run(run func(ctx context.Context, key favicon.Key, work func(context.Context))) *MockFaviconRefreshScheduler_Schedule_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 favicon.Key
78+ if args[1] != nil {
79+ arg1 = args[1].(favicon.Key)
80+ }
81+ var arg2 func(context.Context)
82+ if args[2] != nil {
83+ arg2 = args[2].(func(context.Context))
84+ }
85+ run(
86+ arg0,
87+ arg1,
88+ arg2,
89+ )
90+ })
91+ return _c
92+}
93+
94+func (_c *MockFaviconRefreshScheduler_Schedule_Call) Return(b bool) *MockFaviconRefreshScheduler_Schedule_Call {
95+ _c.Call.Return(b)
96+ return _c
97+}
98+
99+func (_c *MockFaviconRefreshScheduler_Schedule_Call) RunAndReturn(run func(ctx context.Context, key favicon.Key, work func(context.Context)) bool) *MockFaviconRefreshScheduler_Schedule_Call {
100+ _c.Call.Return(run)
101+ return _c
102+}
A internal/application/port/mocks/favicon_service.go +576 -0
@@ -0,0 +1,576 @@
1+// Code generated by mockery; DO NOT EDIT.
2+// github.com/vektra/mockery
3+// template: testify
4+
5+package mocks
6+
7+import (
8+ "context"
9+
10+ mock "github.com/stretchr/testify/mock"
11+)
12+
13+// NewMockFaviconService creates a new instance of MockFaviconService. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
14+// The first argument is typically a *testing.T value.
15+func NewMockFaviconService(t interface {
16+ mock.TestingT
17+ Cleanup(func())
18+}) *MockFaviconService {
19+ mock := &MockFaviconService{}
20+ mock.Mock.Test(t)
21+
22+ t.Cleanup(func() { mock.AssertExpectations(t) })
23+
24+ return mock
25+}
26+
27+// MockFaviconService is an autogenerated mock type for the FaviconService type
28+type MockFaviconService struct {
29+ mock.Mock
30+}
31+
32+type MockFaviconService_Expecter struct {
33+ mock *mock.Mock
34+}
35+
36+func (_m *MockFaviconService) EXPECT() *MockFaviconService_Expecter {
37+ return &MockFaviconService_Expecter{mock: &_m.Mock}
38+}
39+
40+// Close provides a mock function for the type MockFaviconService
41+func (_mock *MockFaviconService) Close() {
42+ _mock.Called()
43+ return
44+}
45+
46+// MockFaviconService_Close_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Close'
47+type MockFaviconService_Close_Call struct {
48+ *mock.Call
49+}
50+
51+// Close is a helper method to define mock.On call
52+func (_e *MockFaviconService_Expecter) Close() *MockFaviconService_Close_Call {
53+ return &MockFaviconService_Close_Call{Call: _e.mock.On("Close")}
54+}
55+
56+func (_c *MockFaviconService_Close_Call) Run(run func()) *MockFaviconService_Close_Call {
57+ _c.Call.Run(func(args mock.Arguments) {
58+ run()
59+ })
60+ return _c
61+}
62+
63+func (_c *MockFaviconService_Close_Call) Return() *MockFaviconService_Close_Call {
64+ _c.Call.Return()
65+ return _c
66+}
67+
68+func (_c *MockFaviconService_Close_Call) RunAndReturn(run func()) *MockFaviconService_Close_Call {
69+ _c.Run(run)
70+ return _c
71+}
72+
73+// DiskPathPNG provides a mock function for the type MockFaviconService
74+func (_mock *MockFaviconService) DiskPathPNG(domain string) string {
75+ ret := _mock.Called(domain)
76+
77+ if len(ret) == 0 {
78+ panic("no return value specified for DiskPathPNG")
79+ }
80+
81+ var r0 string
82+ if returnFunc, ok := ret.Get(0).(func(string) string); ok {
83+ r0 = returnFunc(domain)
84+ } else {
85+ r0 = ret.Get(0).(string)
86+ }
87+ return r0
88+}
89+
90+// MockFaviconService_DiskPathPNG_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'DiskPathPNG'
91+type MockFaviconService_DiskPathPNG_Call struct {
92+ *mock.Call
93+}
94+
95+// DiskPathPNG is a helper method to define mock.On call
96+// - domain string
97+func (_e *MockFaviconService_Expecter) DiskPathPNG(domain any) *MockFaviconService_DiskPathPNG_Call {
98+ return &MockFaviconService_DiskPathPNG_Call{Call: _e.mock.On("DiskPathPNG", domain)}
99+}
100+
101+func (_c *MockFaviconService_DiskPathPNG_Call) Run(run func(domain string)) *MockFaviconService_DiskPathPNG_Call {
102+ _c.Call.Run(func(args mock.Arguments) {
103+ var arg0 string
104+ if args[0] != nil {
105+ arg0 = args[0].(string)
106+ }
107+ run(
108+ arg0,
109+ )
110+ })
111+ return _c
112+}
113+
114+func (_c *MockFaviconService_DiskPathPNG_Call) Return(s string) *MockFaviconService_DiskPathPNG_Call {
115+ _c.Call.Return(s)
116+ return _c
117+}
118+
119+func (_c *MockFaviconService_DiskPathPNG_Call) RunAndReturn(run func(domain string) string) *MockFaviconService_DiskPathPNG_Call {
120+ _c.Call.Return(run)
121+ return _c
122+}
123+
124+// DiskPathPNGSized provides a mock function for the type MockFaviconService
125+func (_mock *MockFaviconService) DiskPathPNGSized(domain string, size int) string {
126+ ret := _mock.Called(domain, size)
127+
128+ if len(ret) == 0 {
129+ panic("no return value specified for DiskPathPNGSized")
130+ }
131+
132+ var r0 string
133+ if returnFunc, ok := ret.Get(0).(func(string, int) string); ok {
134+ r0 = returnFunc(domain, size)
135+ } else {
136+ r0 = ret.Get(0).(string)
137+ }
138+ return r0
139+}
140+
141+// MockFaviconService_DiskPathPNGSized_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'DiskPathPNGSized'
142+type MockFaviconService_DiskPathPNGSized_Call struct {
143+ *mock.Call
144+}
145+
146+// DiskPathPNGSized is a helper method to define mock.On call
147+// - domain string
148+// - size int
149+func (_e *MockFaviconService_Expecter) DiskPathPNGSized(domain any, size any) *MockFaviconService_DiskPathPNGSized_Call {
150+ return &MockFaviconService_DiskPathPNGSized_Call{Call: _e.mock.On("DiskPathPNGSized", domain, size)}
151+}
152+
153+func (_c *MockFaviconService_DiskPathPNGSized_Call) Run(run func(domain string, size int)) *MockFaviconService_DiskPathPNGSized_Call {
154+ _c.Call.Run(func(args mock.Arguments) {
155+ var arg0 string
156+ if args[0] != nil {
157+ arg0 = args[0].(string)
158+ }
159+ var arg1 int
160+ if args[1] != nil {
161+ arg1 = args[1].(int)
162+ }
163+ run(
164+ arg0,
165+ arg1,
166+ )
167+ })
168+ return _c
169+}
170+
171+func (_c *MockFaviconService_DiskPathPNGSized_Call) Return(s string) *MockFaviconService_DiskPathPNGSized_Call {
172+ _c.Call.Return(s)
173+ return _c
174+}
175+
176+func (_c *MockFaviconService_DiskPathPNGSized_Call) RunAndReturn(run func(domain string, size int) string) *MockFaviconService_DiskPathPNGSized_Call {
177+ _c.Call.Return(run)
178+ return _c
179+}
180+
181+// EnsureCacheDir provides a mock function for the type MockFaviconService
182+func (_mock *MockFaviconService) EnsureCacheDir() error {
183+ ret := _mock.Called()
184+
185+ if len(ret) == 0 {
186+ panic("no return value specified for EnsureCacheDir")
187+ }
188+
189+ var r0 error
190+ if returnFunc, ok := ret.Get(0).(func() error); ok {
191+ r0 = returnFunc()
192+ } else {
193+ r0 = ret.Error(0)
194+ }
195+ return r0
196+}
197+
198+// MockFaviconService_EnsureCacheDir_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'EnsureCacheDir'
199+type MockFaviconService_EnsureCacheDir_Call struct {
200+ *mock.Call
201+}
202+
203+// EnsureCacheDir is a helper method to define mock.On call
204+func (_e *MockFaviconService_Expecter) EnsureCacheDir() *MockFaviconService_EnsureCacheDir_Call {
205+ return &MockFaviconService_EnsureCacheDir_Call{Call: _e.mock.On("EnsureCacheDir")}
206+}
207+
208+func (_c *MockFaviconService_EnsureCacheDir_Call) Run(run func()) *MockFaviconService_EnsureCacheDir_Call {
209+ _c.Call.Run(func(args mock.Arguments) {
210+ run()
211+ })
212+ return _c
213+}
214+
215+func (_c *MockFaviconService_EnsureCacheDir_Call) Return(err error) *MockFaviconService_EnsureCacheDir_Call {
216+ _c.Call.Return(err)
217+ return _c
218+}
219+
220+func (_c *MockFaviconService_EnsureCacheDir_Call) RunAndReturn(run func() error) *MockFaviconService_EnsureCacheDir_Call {
221+ _c.Call.Return(run)
222+ return _c
223+}
224+
225+// EnsureDiskCache provides a mock function for the type MockFaviconService
226+func (_mock *MockFaviconService) EnsureDiskCache(ctx context.Context, domain string) {
227+ _mock.Called(ctx, domain)
228+ return
229+}
230+
231+// MockFaviconService_EnsureDiskCache_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'EnsureDiskCache'
232+type MockFaviconService_EnsureDiskCache_Call struct {
233+ *mock.Call
234+}
235+
236+// EnsureDiskCache is a helper method to define mock.On call
237+// - ctx context.Context
238+// - domain string
239+func (_e *MockFaviconService_Expecter) EnsureDiskCache(ctx any, domain any) *MockFaviconService_EnsureDiskCache_Call {
240+ return &MockFaviconService_EnsureDiskCache_Call{Call: _e.mock.On("EnsureDiskCache", ctx, domain)}
241+}
242+
243+func (_c *MockFaviconService_EnsureDiskCache_Call) Run(run func(ctx context.Context, domain string)) *MockFaviconService_EnsureDiskCache_Call {
244+ _c.Call.Run(func(args mock.Arguments) {
245+ var arg0 context.Context
246+ if args[0] != nil {
247+ arg0 = args[0].(context.Context)
248+ }
249+ var arg1 string
250+ if args[1] != nil {
251+ arg1 = args[1].(string)
252+ }
253+ run(
254+ arg0,
255+ arg1,
256+ )
257+ })
258+ return _c
259+}
260+
261+func (_c *MockFaviconService_EnsureDiskCache_Call) Return() *MockFaviconService_EnsureDiskCache_Call {
262+ _c.Call.Return()
263+ return _c
264+}
265+
266+func (_c *MockFaviconService_EnsureDiskCache_Call) RunAndReturn(run func(ctx context.Context, domain string)) *MockFaviconService_EnsureDiskCache_Call {
267+ _c.Run(run)
268+ return _c
269+}
270+
271+// EnsureSizedPNG provides a mock function for the type MockFaviconService
272+func (_mock *MockFaviconService) EnsureSizedPNG(ctx context.Context, domain string, size int) error {
273+ ret := _mock.Called(ctx, domain, size)
274+
275+ if len(ret) == 0 {
276+ panic("no return value specified for EnsureSizedPNG")
277+ }
278+
279+ var r0 error
280+ if returnFunc, ok := ret.Get(0).(func(context.Context, string, int) error); ok {
281+ r0 = returnFunc(ctx, domain, size)
282+ } else {
283+ r0 = ret.Error(0)
284+ }
285+ return r0
286+}
287+
288+// MockFaviconService_EnsureSizedPNG_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'EnsureSizedPNG'
289+type MockFaviconService_EnsureSizedPNG_Call struct {
290+ *mock.Call
291+}
292+
293+// EnsureSizedPNG is a helper method to define mock.On call
294+// - ctx context.Context
295+// - domain string
296+// - size int
297+func (_e *MockFaviconService_Expecter) EnsureSizedPNG(ctx any, domain any, size any) *MockFaviconService_EnsureSizedPNG_Call {
298+ return &MockFaviconService_EnsureSizedPNG_Call{Call: _e.mock.On("EnsureSizedPNG", ctx, domain, size)}
299+}
300+
301+func (_c *MockFaviconService_EnsureSizedPNG_Call) Run(run func(ctx context.Context, domain string, size int)) *MockFaviconService_EnsureSizedPNG_Call {
302+ _c.Call.Run(func(args mock.Arguments) {
303+ var arg0 context.Context
304+ if args[0] != nil {
305+ arg0 = args[0].(context.Context)
306+ }
307+ var arg1 string
308+ if args[1] != nil {
309+ arg1 = args[1].(string)
310+ }
311+ var arg2 int
312+ if args[2] != nil {
313+ arg2 = args[2].(int)
314+ }
315+ run(
316+ arg0,
317+ arg1,
318+ arg2,
319+ )
320+ })
321+ return _c
322+}
323+
324+func (_c *MockFaviconService_EnsureSizedPNG_Call) Return(err error) *MockFaviconService_EnsureSizedPNG_Call {
325+ _c.Call.Return(err)
326+ return _c
327+}
328+
329+func (_c *MockFaviconService_EnsureSizedPNG_Call) RunAndReturn(run func(ctx context.Context, domain string, size int) error) *MockFaviconService_EnsureSizedPNG_Call {
330+ _c.Call.Return(run)
331+ return _c
332+}
333+
334+// Get provides a mock function for the type MockFaviconService
335+func (_mock *MockFaviconService) Get(ctx context.Context, domain string) ([]byte, error) {
336+ ret := _mock.Called(ctx, domain)
337+
338+ if len(ret) == 0 {
339+ panic("no return value specified for Get")
340+ }
341+
342+ var r0 []byte
343+ var r1 error
344+ if returnFunc, ok := ret.Get(0).(func(context.Context, string) ([]byte, error)); ok {
345+ return returnFunc(ctx, domain)
346+ }
347+ if returnFunc, ok := ret.Get(0).(func(context.Context, string) []byte); ok {
348+ r0 = returnFunc(ctx, domain)
349+ } else {
350+ if ret.Get(0) != nil {
351+ r0 = ret.Get(0).([]byte)
352+ }
353+ }
354+ if returnFunc, ok := ret.Get(1).(func(context.Context, string) error); ok {
355+ r1 = returnFunc(ctx, domain)
356+ } else {
357+ r1 = ret.Error(1)
358+ }
359+ return r0, r1
360+}
361+
362+// MockFaviconService_Get_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Get'
363+type MockFaviconService_Get_Call struct {
364+ *mock.Call
365+}
366+
367+// Get is a helper method to define mock.On call
368+// - ctx context.Context
369+// - domain string
370+func (_e *MockFaviconService_Expecter) Get(ctx any, domain any) *MockFaviconService_Get_Call {
371+ return &MockFaviconService_Get_Call{Call: _e.mock.On("Get", ctx, domain)}
372+}
373+
374+func (_c *MockFaviconService_Get_Call) Run(run func(ctx context.Context, domain string)) *MockFaviconService_Get_Call {
375+ _c.Call.Run(func(args mock.Arguments) {
376+ var arg0 context.Context
377+ if args[0] != nil {
378+ arg0 = args[0].(context.Context)
379+ }
380+ var arg1 string
381+ if args[1] != nil {
382+ arg1 = args[1].(string)
383+ }
384+ run(
385+ arg0,
386+ arg1,
387+ )
388+ })
389+ return _c
390+}
391+
392+func (_c *MockFaviconService_Get_Call) Return(bytes []byte, err error) *MockFaviconService_Get_Call {
393+ _c.Call.Return(bytes, err)
394+ return _c
395+}
396+
397+func (_c *MockFaviconService_Get_Call) RunAndReturn(run func(ctx context.Context, domain string) ([]byte, error)) *MockFaviconService_Get_Call {
398+ _c.Call.Return(run)
399+ return _c
400+}
401+
402+// GetCached provides a mock function for the type MockFaviconService
403+func (_mock *MockFaviconService) GetCached(ctx context.Context, domain string) ([]byte, bool) {
404+ ret := _mock.Called(ctx, domain)
405+
406+ if len(ret) == 0 {
407+ panic("no return value specified for GetCached")
408+ }
409+
410+ var r0 []byte
411+ var r1 bool
412+ if returnFunc, ok := ret.Get(0).(func(context.Context, string) ([]byte, bool)); ok {
413+ return returnFunc(ctx, domain)
414+ }
415+ if returnFunc, ok := ret.Get(0).(func(context.Context, string) []byte); ok {
416+ r0 = returnFunc(ctx, domain)
417+ } else {
418+ if ret.Get(0) != nil {
419+ r0 = ret.Get(0).([]byte)
420+ }
421+ }
422+ if returnFunc, ok := ret.Get(1).(func(context.Context, string) bool); ok {
423+ r1 = returnFunc(ctx, domain)
424+ } else {
425+ r1 = ret.Get(1).(bool)
426+ }
427+ return r0, r1
428+}
429+
430+// MockFaviconService_GetCached_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetCached'
431+type MockFaviconService_GetCached_Call struct {
432+ *mock.Call
433+}
434+
435+// GetCached is a helper method to define mock.On call
436+// - ctx context.Context
437+// - domain string
438+func (_e *MockFaviconService_Expecter) GetCached(ctx any, domain any) *MockFaviconService_GetCached_Call {
439+ return &MockFaviconService_GetCached_Call{Call: _e.mock.On("GetCached", ctx, domain)}
440+}
441+
442+func (_c *MockFaviconService_GetCached_Call) Run(run func(ctx context.Context, domain string)) *MockFaviconService_GetCached_Call {
443+ _c.Call.Run(func(args mock.Arguments) {
444+ var arg0 context.Context
445+ if args[0] != nil {
446+ arg0 = args[0].(context.Context)
447+ }
448+ var arg1 string
449+ if args[1] != nil {
450+ arg1 = args[1].(string)
451+ }
452+ run(
453+ arg0,
454+ arg1,
455+ )
456+ })
457+ return _c
458+}
459+
460+func (_c *MockFaviconService_GetCached_Call) Return(bytes []byte, b bool) *MockFaviconService_GetCached_Call {
461+ _c.Call.Return(bytes, b)
462+ return _c
463+}
464+
465+func (_c *MockFaviconService_GetCached_Call) RunAndReturn(run func(ctx context.Context, domain string) ([]byte, bool)) *MockFaviconService_GetCached_Call {
466+ _c.Call.Return(run)
467+ return _c
468+}
469+
470+// HasPNGOnDisk provides a mock function for the type MockFaviconService
471+func (_mock *MockFaviconService) HasPNGOnDisk(domain string) bool {
472+ ret := _mock.Called(domain)
473+
474+ if len(ret) == 0 {
475+ panic("no return value specified for HasPNGOnDisk")
476+ }
477+
478+ var r0 bool
479+ if returnFunc, ok := ret.Get(0).(func(string) bool); ok {
480+ r0 = returnFunc(domain)
481+ } else {
482+ r0 = ret.Get(0).(bool)
483+ }
484+ return r0
485+}
486+
487+// MockFaviconService_HasPNGOnDisk_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'HasPNGOnDisk'
488+type MockFaviconService_HasPNGOnDisk_Call struct {
489+ *mock.Call
490+}
491+
492+// HasPNGOnDisk is a helper method to define mock.On call
493+// - domain string
494+func (_e *MockFaviconService_Expecter) HasPNGOnDisk(domain any) *MockFaviconService_HasPNGOnDisk_Call {
495+ return &MockFaviconService_HasPNGOnDisk_Call{Call: _e.mock.On("HasPNGOnDisk", domain)}
496+}
497+
498+func (_c *MockFaviconService_HasPNGOnDisk_Call) Run(run func(domain string)) *MockFaviconService_HasPNGOnDisk_Call {
499+ _c.Call.Run(func(args mock.Arguments) {
500+ var arg0 string
501+ if args[0] != nil {
502+ arg0 = args[0].(string)
503+ }
504+ run(
505+ arg0,
506+ )
507+ })
508+ return _c
509+}
510+
511+func (_c *MockFaviconService_HasPNGOnDisk_Call) Return(b bool) *MockFaviconService_HasPNGOnDisk_Call {
512+ _c.Call.Return(b)
513+ return _c
514+}
515+
516+func (_c *MockFaviconService_HasPNGOnDisk_Call) RunAndReturn(run func(domain string) bool) *MockFaviconService_HasPNGOnDisk_Call {
517+ _c.Call.Return(run)
518+ return _c
519+}
520+
521+// HasPNGSizedOnDisk provides a mock function for the type MockFaviconService
522+func (_mock *MockFaviconService) HasPNGSizedOnDisk(domain string, size int) bool {
523+ ret := _mock.Called(domain, size)
524+
525+ if len(ret) == 0 {
526+ panic("no return value specified for HasPNGSizedOnDisk")
527+ }
528+
529+ var r0 bool
530+ if returnFunc, ok := ret.Get(0).(func(string, int) bool); ok {
531+ r0 = returnFunc(domain, size)
532+ } else {
533+ r0 = ret.Get(0).(bool)
534+ }
535+ return r0
536+}
537+
538+// MockFaviconService_HasPNGSizedOnDisk_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'HasPNGSizedOnDisk'
539+type MockFaviconService_HasPNGSizedOnDisk_Call struct {
540+ *mock.Call
541+}
542+
543+// HasPNGSizedOnDisk is a helper method to define mock.On call
544+// - domain string
545+// - size int
546+func (_e *MockFaviconService_Expecter) HasPNGSizedOnDisk(domain any, size any) *MockFaviconService_HasPNGSizedOnDisk_Call {
547+ return &MockFaviconService_HasPNGSizedOnDisk_Call{Call: _e.mock.On("HasPNGSizedOnDisk", domain, size)}
548+}
549+
550+func (_c *MockFaviconService_HasPNGSizedOnDisk_Call) Run(run func(domain string, size int)) *MockFaviconService_HasPNGSizedOnDisk_Call {
551+ _c.Call.Run(func(args mock.Arguments) {
552+ var arg0 string
553+ if args[0] != nil {
554+ arg0 = args[0].(string)
555+ }
556+ var arg1 int
557+ if args[1] != nil {
558+ arg1 = args[1].(int)
559+ }
560+ run(
561+ arg0,
562+ arg1,
563+ )
564+ })
565+ return _c
566+}
567+
568+func (_c *MockFaviconService_HasPNGSizedOnDisk_Call) Return(b bool) *MockFaviconService_HasPNGSizedOnDisk_Call {
569+ _c.Call.Return(b)
570+ return _c
571+}
572+
573+func (_c *MockFaviconService_HasPNGSizedOnDisk_Call) RunAndReturn(run func(domain string, size int) bool) *MockFaviconService_HasPNGSizedOnDisk_Call {
574+ _c.Call.Return(run)
575+ return _c
576+}
A internal/application/port/mocks/filesystem.go +293 -0
@@ -0,0 +1,293 @@
1+// Code generated by mockery; DO NOT EDIT.
2+// github.com/vektra/mockery
3+// template: testify
4+
5+package mocks
6+
7+import (
8+ "context"
9+
10+ mock "github.com/stretchr/testify/mock"
11+)
12+
13+// NewMockFileSystem creates a new instance of MockFileSystem. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
14+// The first argument is typically a *testing.T value.
15+func NewMockFileSystem(t interface {
16+ mock.TestingT
17+ Cleanup(func())
18+}) *MockFileSystem {
19+ mock := &MockFileSystem{}
20+ mock.Mock.Test(t)
21+
22+ t.Cleanup(func() { mock.AssertExpectations(t) })
23+
24+ return mock
25+}
26+
27+// MockFileSystem is an autogenerated mock type for the FileSystem type
28+type MockFileSystem struct {
29+ mock.Mock
30+}
31+
32+type MockFileSystem_Expecter struct {
33+ mock *mock.Mock
34+}
35+
36+func (_m *MockFileSystem) EXPECT() *MockFileSystem_Expecter {
37+ return &MockFileSystem_Expecter{mock: &_m.Mock}
38+}
39+
40+// Exists provides a mock function for the type MockFileSystem
41+func (_mock *MockFileSystem) Exists(ctx context.Context, path string) (bool, error) {
42+ ret := _mock.Called(ctx, path)
43+
44+ if len(ret) == 0 {
45+ panic("no return value specified for Exists")
46+ }
47+
48+ var r0 bool
49+ var r1 error
50+ if returnFunc, ok := ret.Get(0).(func(context.Context, string) (bool, error)); ok {
51+ return returnFunc(ctx, path)
52+ }
53+ if returnFunc, ok := ret.Get(0).(func(context.Context, string) bool); ok {
54+ r0 = returnFunc(ctx, path)
55+ } else {
56+ r0 = ret.Get(0).(bool)
57+ }
58+ if returnFunc, ok := ret.Get(1).(func(context.Context, string) error); ok {
59+ r1 = returnFunc(ctx, path)
60+ } else {
61+ r1 = ret.Error(1)
62+ }
63+ return r0, r1
64+}
65+
66+// MockFileSystem_Exists_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Exists'
67+type MockFileSystem_Exists_Call struct {
68+ *mock.Call
69+}
70+
71+// Exists is a helper method to define mock.On call
72+// - ctx context.Context
73+// - path string
74+func (_e *MockFileSystem_Expecter) Exists(ctx any, path any) *MockFileSystem_Exists_Call {
75+ return &MockFileSystem_Exists_Call{Call: _e.mock.On("Exists", ctx, path)}
76+}
77+
78+func (_c *MockFileSystem_Exists_Call) Run(run func(ctx context.Context, path string)) *MockFileSystem_Exists_Call {
79+ _c.Call.Run(func(args mock.Arguments) {
80+ var arg0 context.Context
81+ if args[0] != nil {
82+ arg0 = args[0].(context.Context)
83+ }
84+ var arg1 string
85+ if args[1] != nil {
86+ arg1 = args[1].(string)
87+ }
88+ run(
89+ arg0,
90+ arg1,
91+ )
92+ })
93+ return _c
94+}
95+
96+func (_c *MockFileSystem_Exists_Call) Return(b bool, err error) *MockFileSystem_Exists_Call {
97+ _c.Call.Return(b, err)
98+ return _c
99+}
100+
101+func (_c *MockFileSystem_Exists_Call) RunAndReturn(run func(ctx context.Context, path string) (bool, error)) *MockFileSystem_Exists_Call {
102+ _c.Call.Return(run)
103+ return _c
104+}
105+
106+// GetSize provides a mock function for the type MockFileSystem
107+func (_mock *MockFileSystem) GetSize(ctx context.Context, path string) (int64, error) {
108+ ret := _mock.Called(ctx, path)
109+
110+ if len(ret) == 0 {
111+ panic("no return value specified for GetSize")
112+ }
113+
114+ var r0 int64
115+ var r1 error
116+ if returnFunc, ok := ret.Get(0).(func(context.Context, string) (int64, error)); ok {
117+ return returnFunc(ctx, path)
118+ }
119+ if returnFunc, ok := ret.Get(0).(func(context.Context, string) int64); ok {
120+ r0 = returnFunc(ctx, path)
121+ } else {
122+ r0 = ret.Get(0).(int64)
123+ }
124+ if returnFunc, ok := ret.Get(1).(func(context.Context, string) error); ok {
125+ r1 = returnFunc(ctx, path)
126+ } else {
127+ r1 = ret.Error(1)
128+ }
129+ return r0, r1
130+}
131+
132+// MockFileSystem_GetSize_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetSize'
133+type MockFileSystem_GetSize_Call struct {
134+ *mock.Call
135+}
136+
137+// GetSize is a helper method to define mock.On call
138+// - ctx context.Context
139+// - path string
140+func (_e *MockFileSystem_Expecter) GetSize(ctx any, path any) *MockFileSystem_GetSize_Call {
141+ return &MockFileSystem_GetSize_Call{Call: _e.mock.On("GetSize", ctx, path)}
142+}
143+
144+func (_c *MockFileSystem_GetSize_Call) Run(run func(ctx context.Context, path string)) *MockFileSystem_GetSize_Call {
145+ _c.Call.Run(func(args mock.Arguments) {
146+ var arg0 context.Context
147+ if args[0] != nil {
148+ arg0 = args[0].(context.Context)
149+ }
150+ var arg1 string
151+ if args[1] != nil {
152+ arg1 = args[1].(string)
153+ }
154+ run(
155+ arg0,
156+ arg1,
157+ )
158+ })
159+ return _c
160+}
161+
162+func (_c *MockFileSystem_GetSize_Call) Return(n int64, err error) *MockFileSystem_GetSize_Call {
163+ _c.Call.Return(n, err)
164+ return _c
165+}
166+
167+func (_c *MockFileSystem_GetSize_Call) RunAndReturn(run func(ctx context.Context, path string) (int64, error)) *MockFileSystem_GetSize_Call {
168+ _c.Call.Return(run)
169+ return _c
170+}
171+
172+// IsDirectory provides a mock function for the type MockFileSystem
173+func (_mock *MockFileSystem) IsDirectory(ctx context.Context, path string) (bool, error) {
174+ ret := _mock.Called(ctx, path)
175+
176+ if len(ret) == 0 {
177+ panic("no return value specified for IsDirectory")
178+ }
179+
180+ var r0 bool
181+ var r1 error
182+ if returnFunc, ok := ret.Get(0).(func(context.Context, string) (bool, error)); ok {
183+ return returnFunc(ctx, path)
184+ }
185+ if returnFunc, ok := ret.Get(0).(func(context.Context, string) bool); ok {
186+ r0 = returnFunc(ctx, path)
187+ } else {
188+ r0 = ret.Get(0).(bool)
189+ }
190+ if returnFunc, ok := ret.Get(1).(func(context.Context, string) error); ok {
191+ r1 = returnFunc(ctx, path)
192+ } else {
193+ r1 = ret.Error(1)
194+ }
195+ return r0, r1
196+}
197+
198+// MockFileSystem_IsDirectory_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'IsDirectory'
199+type MockFileSystem_IsDirectory_Call struct {
200+ *mock.Call
201+}
202+
203+// IsDirectory is a helper method to define mock.On call
204+// - ctx context.Context
205+// - path string
206+func (_e *MockFileSystem_Expecter) IsDirectory(ctx any, path any) *MockFileSystem_IsDirectory_Call {
207+ return &MockFileSystem_IsDirectory_Call{Call: _e.mock.On("IsDirectory", ctx, path)}
208+}
209+
210+func (_c *MockFileSystem_IsDirectory_Call) Run(run func(ctx context.Context, path string)) *MockFileSystem_IsDirectory_Call {
211+ _c.Call.Run(func(args mock.Arguments) {
212+ var arg0 context.Context
213+ if args[0] != nil {
214+ arg0 = args[0].(context.Context)
215+ }
216+ var arg1 string
217+ if args[1] != nil {
218+ arg1 = args[1].(string)
219+ }
220+ run(
221+ arg0,
222+ arg1,
223+ )
224+ })
225+ return _c
226+}
227+
228+func (_c *MockFileSystem_IsDirectory_Call) Return(b bool, err error) *MockFileSystem_IsDirectory_Call {
229+ _c.Call.Return(b, err)
230+ return _c
231+}
232+
233+func (_c *MockFileSystem_IsDirectory_Call) RunAndReturn(run func(ctx context.Context, path string) (bool, error)) *MockFileSystem_IsDirectory_Call {
234+ _c.Call.Return(run)
235+ return _c
236+}
237+
238+// RemoveAll provides a mock function for the type MockFileSystem
239+func (_mock *MockFileSystem) RemoveAll(ctx context.Context, path string) error {
240+ ret := _mock.Called(ctx, path)
241+
242+ if len(ret) == 0 {
243+ panic("no return value specified for RemoveAll")
244+ }
245+
246+ var r0 error
247+ if returnFunc, ok := ret.Get(0).(func(context.Context, string) error); ok {
248+ r0 = returnFunc(ctx, path)
249+ } else {
250+ r0 = ret.Error(0)
251+ }
252+ return r0
253+}
254+
255+// MockFileSystem_RemoveAll_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'RemoveAll'
256+type MockFileSystem_RemoveAll_Call struct {
257+ *mock.Call
258+}
259+
260+// RemoveAll is a helper method to define mock.On call
261+// - ctx context.Context
262+// - path string
263+func (_e *MockFileSystem_Expecter) RemoveAll(ctx any, path any) *MockFileSystem_RemoveAll_Call {
264+ return &MockFileSystem_RemoveAll_Call{Call: _e.mock.On("RemoveAll", ctx, path)}
265+}
266+
267+func (_c *MockFileSystem_RemoveAll_Call) Run(run func(ctx context.Context, path string)) *MockFileSystem_RemoveAll_Call {
268+ _c.Call.Run(func(args mock.Arguments) {
269+ var arg0 context.Context
270+ if args[0] != nil {
271+ arg0 = args[0].(context.Context)
272+ }
273+ var arg1 string
274+ if args[1] != nil {
275+ arg1 = args[1].(string)
276+ }
277+ run(
278+ arg0,
279+ arg1,
280+ )
281+ })
282+ return _c
283+}
284+
285+func (_c *MockFileSystem_RemoveAll_Call) Return(err error) *MockFileSystem_RemoveAll_Call {
286+ _c.Call.Return(err)
287+ return _c
288+}
289+
290+func (_c *MockFileSystem_RemoveAll_Call) RunAndReturn(run func(ctx context.Context, path string) error) *MockFileSystem_RemoveAll_Call {
291+ _c.Call.Return(run)
292+ return _c
293+}
A internal/application/port/mocks/filter_manager.go +119 -0
@@ -0,0 +1,119 @@
1+// Code generated by mockery; DO NOT EDIT.
2+// github.com/vektra/mockery
3+// template: testify
4+
5+package mocks
6+
7+import (
8+ "context"
9+
10+ "github.com/bnema/dumber/internal/application/port"
11+ mock "github.com/stretchr/testify/mock"
12+)
13+
14+// NewMockFilterManager creates a new instance of MockFilterManager. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
15+// The first argument is typically a *testing.T value.
16+func NewMockFilterManager(t interface {
17+ mock.TestingT
18+ Cleanup(func())
19+}) *MockFilterManager {
20+ mock := &MockFilterManager{}
21+ mock.Mock.Test(t)
22+
23+ t.Cleanup(func() { mock.AssertExpectations(t) })
24+
25+ return mock
26+}
27+
28+// MockFilterManager is an autogenerated mock type for the FilterManager type
29+type MockFilterManager struct {
30+ mock.Mock
31+}
32+
33+type MockFilterManager_Expecter struct {
34+ mock *mock.Mock
35+}
36+
37+func (_m *MockFilterManager) EXPECT() *MockFilterManager_Expecter {
38+ return &MockFilterManager_Expecter{mock: &_m.Mock}
39+}
40+
41+// LoadAsync provides a mock function for the type MockFilterManager
42+func (_mock *MockFilterManager) LoadAsync(ctx context.Context) {
43+ _mock.Called(ctx)
44+ return
45+}
46+
47+// MockFilterManager_LoadAsync_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'LoadAsync'
48+type MockFilterManager_LoadAsync_Call struct {
49+ *mock.Call
50+}
51+
52+// LoadAsync is a helper method to define mock.On call
53+// - ctx context.Context
54+func (_e *MockFilterManager_Expecter) LoadAsync(ctx any) *MockFilterManager_LoadAsync_Call {
55+ return &MockFilterManager_LoadAsync_Call{Call: _e.mock.On("LoadAsync", ctx)}
56+}
57+
58+func (_c *MockFilterManager_LoadAsync_Call) Run(run func(ctx context.Context)) *MockFilterManager_LoadAsync_Call {
59+ _c.Call.Run(func(args mock.Arguments) {
60+ var arg0 context.Context
61+ if args[0] != nil {
62+ arg0 = args[0].(context.Context)
63+ }
64+ run(
65+ arg0,
66+ )
67+ })
68+ return _c
69+}
70+
71+func (_c *MockFilterManager_LoadAsync_Call) Return() *MockFilterManager_LoadAsync_Call {
72+ _c.Call.Return()
73+ return _c
74+}
75+
76+func (_c *MockFilterManager_LoadAsync_Call) RunAndReturn(run func(ctx context.Context)) *MockFilterManager_LoadAsync_Call {
77+ _c.Run(run)
78+ return _c
79+}
80+
81+// SetStatusCallback provides a mock function for the type MockFilterManager
82+func (_mock *MockFilterManager) SetStatusCallback(fn func(port.FilterStatus)) {
83+ _mock.Called(fn)
84+ return
85+}
86+
87+// MockFilterManager_SetStatusCallback_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'SetStatusCallback'
88+type MockFilterManager_SetStatusCallback_Call struct {
89+ *mock.Call
90+}
91+
92+// SetStatusCallback is a helper method to define mock.On call
93+// - fn func(port.FilterStatus)
94+func (_e *MockFilterManager_Expecter) SetStatusCallback(fn any) *MockFilterManager_SetStatusCallback_Call {
95+ return &MockFilterManager_SetStatusCallback_Call{Call: _e.mock.On("SetStatusCallback", fn)}
96+}
97+
98+func (_c *MockFilterManager_SetStatusCallback_Call) Run(run func(fn func(port.FilterStatus))) *MockFilterManager_SetStatusCallback_Call {
99+ _c.Call.Run(func(args mock.Arguments) {
100+ var arg0 func(port.FilterStatus)
101+ if args[0] != nil {
102+ arg0 = args[0].(func(port.FilterStatus))
103+ }
104+ run(
105+ arg0,
106+ )
107+ })
108+ return _c
109+}
110+
111+func (_c *MockFilterManager_SetStatusCallback_Call) Return() *MockFilterManager_SetStatusCallback_Call {
112+ _c.Call.Return()
113+ return _c
114+}
115+
116+func (_c *MockFilterManager_SetStatusCallback_Call) RunAndReturn(run func(fn func(port.FilterStatus))) *MockFilterManager_SetStatusCallback_Call {
117+ _c.Run(run)
118+ return _c
119+}
A internal/application/port/mocks/font_detector.go +215 -0
@@ -0,0 +1,215 @@
1+// Code generated by mockery; DO NOT EDIT.
2+// github.com/vektra/mockery
3+// template: testify
4+
5+package mocks
6+
7+import (
8+ "context"
9+
10+ "github.com/bnema/dumber/internal/application/port"
11+ mock "github.com/stretchr/testify/mock"
12+)
13+
14+// NewMockFontDetector creates a new instance of MockFontDetector. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
15+// The first argument is typically a *testing.T value.
16+func NewMockFontDetector(t interface {
17+ mock.TestingT
18+ Cleanup(func())
19+}) *MockFontDetector {
20+ mock := &MockFontDetector{}
21+ mock.Mock.Test(t)
22+
23+ t.Cleanup(func() { mock.AssertExpectations(t) })
24+
25+ return mock
26+}
27+
28+// MockFontDetector is an autogenerated mock type for the FontDetector type
29+type MockFontDetector struct {
30+ mock.Mock
31+}
32+
33+type MockFontDetector_Expecter struct {
34+ mock *mock.Mock
35+}
36+
37+func (_m *MockFontDetector) EXPECT() *MockFontDetector_Expecter {
38+ return &MockFontDetector_Expecter{mock: &_m.Mock}
39+}
40+
41+// GetAvailableFonts provides a mock function for the type MockFontDetector
42+func (_mock *MockFontDetector) GetAvailableFonts(ctx context.Context) ([]string, error) {
43+ ret := _mock.Called(ctx)
44+
45+ if len(ret) == 0 {
46+ panic("no return value specified for GetAvailableFonts")
47+ }
48+
49+ var r0 []string
50+ var r1 error
51+ if returnFunc, ok := ret.Get(0).(func(context.Context) ([]string, error)); ok {
52+ return returnFunc(ctx)
53+ }
54+ if returnFunc, ok := ret.Get(0).(func(context.Context) []string); ok {
55+ r0 = returnFunc(ctx)
56+ } else {
57+ if ret.Get(0) != nil {
58+ r0 = ret.Get(0).([]string)
59+ }
60+ }
61+ if returnFunc, ok := ret.Get(1).(func(context.Context) error); ok {
62+ r1 = returnFunc(ctx)
63+ } else {
64+ r1 = ret.Error(1)
65+ }
66+ return r0, r1
67+}
68+
69+// MockFontDetector_GetAvailableFonts_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetAvailableFonts'
70+type MockFontDetector_GetAvailableFonts_Call struct {
71+ *mock.Call
72+}
73+
74+// GetAvailableFonts is a helper method to define mock.On call
75+// - ctx context.Context
76+func (_e *MockFontDetector_Expecter) GetAvailableFonts(ctx any) *MockFontDetector_GetAvailableFonts_Call {
77+ return &MockFontDetector_GetAvailableFonts_Call{Call: _e.mock.On("GetAvailableFonts", ctx)}
78+}
79+
80+func (_c *MockFontDetector_GetAvailableFonts_Call) Run(run func(ctx context.Context)) *MockFontDetector_GetAvailableFonts_Call {
81+ _c.Call.Run(func(args mock.Arguments) {
82+ var arg0 context.Context
83+ if args[0] != nil {
84+ arg0 = args[0].(context.Context)
85+ }
86+ run(
87+ arg0,
88+ )
89+ })
90+ return _c
91+}
92+
93+func (_c *MockFontDetector_GetAvailableFonts_Call) Return(strings []string, err error) *MockFontDetector_GetAvailableFonts_Call {
94+ _c.Call.Return(strings, err)
95+ return _c
96+}
97+
98+func (_c *MockFontDetector_GetAvailableFonts_Call) RunAndReturn(run func(ctx context.Context) ([]string, error)) *MockFontDetector_GetAvailableFonts_Call {
99+ _c.Call.Return(run)
100+ return _c
101+}
102+
103+// IsAvailable provides a mock function for the type MockFontDetector
104+func (_mock *MockFontDetector) IsAvailable(ctx context.Context) bool {
105+ ret := _mock.Called(ctx)
106+
107+ if len(ret) == 0 {
108+ panic("no return value specified for IsAvailable")
109+ }
110+
111+ var r0 bool
112+ if returnFunc, ok := ret.Get(0).(func(context.Context) bool); ok {
113+ r0 = returnFunc(ctx)
114+ } else {
115+ r0 = ret.Get(0).(bool)
116+ }
117+ return r0
118+}
119+
120+// MockFontDetector_IsAvailable_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'IsAvailable'
121+type MockFontDetector_IsAvailable_Call struct {
122+ *mock.Call
123+}
124+
125+// IsAvailable is a helper method to define mock.On call
126+// - ctx context.Context
127+func (_e *MockFontDetector_Expecter) IsAvailable(ctx any) *MockFontDetector_IsAvailable_Call {
128+ return &MockFontDetector_IsAvailable_Call{Call: _e.mock.On("IsAvailable", ctx)}
129+}
130+
131+func (_c *MockFontDetector_IsAvailable_Call) Run(run func(ctx context.Context)) *MockFontDetector_IsAvailable_Call {
132+ _c.Call.Run(func(args mock.Arguments) {
133+ var arg0 context.Context
134+ if args[0] != nil {
135+ arg0 = args[0].(context.Context)
136+ }
137+ run(
138+ arg0,
139+ )
140+ })
141+ return _c
142+}
143+
144+func (_c *MockFontDetector_IsAvailable_Call) Return(b bool) *MockFontDetector_IsAvailable_Call {
145+ _c.Call.Return(b)
146+ return _c
147+}
148+
149+func (_c *MockFontDetector_IsAvailable_Call) RunAndReturn(run func(ctx context.Context) bool) *MockFontDetector_IsAvailable_Call {
150+ _c.Call.Return(run)
151+ return _c
152+}
153+
154+// SelectBestFont provides a mock function for the type MockFontDetector
155+func (_mock *MockFontDetector) SelectBestFont(ctx context.Context, category port.FontCategory, fallbackChain []string) string {
156+ ret := _mock.Called(ctx, category, fallbackChain)
157+
158+ if len(ret) == 0 {
159+ panic("no return value specified for SelectBestFont")
160+ }
161+
162+ var r0 string
163+ if returnFunc, ok := ret.Get(0).(func(context.Context, port.FontCategory, []string) string); ok {
164+ r0 = returnFunc(ctx, category, fallbackChain)
165+ } else {
166+ r0 = ret.Get(0).(string)
167+ }
168+ return r0
169+}
170+
171+// MockFontDetector_SelectBestFont_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'SelectBestFont'
172+type MockFontDetector_SelectBestFont_Call struct {
173+ *mock.Call
174+}
175+
176+// SelectBestFont is a helper method to define mock.On call
177+// - ctx context.Context
178+// - category port.FontCategory
179+// - fallbackChain []string
180+func (_e *MockFontDetector_Expecter) SelectBestFont(ctx any, category any, fallbackChain any) *MockFontDetector_SelectBestFont_Call {
181+ return &MockFontDetector_SelectBestFont_Call{Call: _e.mock.On("SelectBestFont", ctx, category, fallbackChain)}
182+}
183+
184+func (_c *MockFontDetector_SelectBestFont_Call) Run(run func(ctx context.Context, category port.FontCategory, fallbackChain []string)) *MockFontDetector_SelectBestFont_Call {
185+ _c.Call.Run(func(args mock.Arguments) {
186+ var arg0 context.Context
187+ if args[0] != nil {
188+ arg0 = args[0].(context.Context)
189+ }
190+ var arg1 port.FontCategory
191+ if args[1] != nil {
192+ arg1 = args[1].(port.FontCategory)
193+ }
194+ var arg2 []string
195+ if args[2] != nil {
196+ arg2 = args[2].([]string)
197+ }
198+ run(
199+ arg0,
200+ arg1,
201+ arg2,
202+ )
203+ })
204+ return _c
205+}
206+
207+func (_c *MockFontDetector_SelectBestFont_Call) Return(s string) *MockFontDetector_SelectBestFont_Call {
208+ _c.Call.Return(s)
209+ return _c
210+}
211+
212+func (_c *MockFontDetector_SelectBestFont_Call) RunAndReturn(run func(ctx context.Context, category port.FontCategory, fallbackChain []string) string) *MockFontDetector_SelectBestFont_Call {
213+ _c.Call.Return(run)
214+ return _c
215+}
A internal/application/port/mocks/handler_deps.go +305 -0
@@ -0,0 +1,305 @@
1+// Code generated by mockery; DO NOT EDIT.
2+// github.com/vektra/mockery
3+// template: testify
4+
5+package mocks
6+
7+import (
8+ "context"
9+
10+ "github.com/bnema/dumber/internal/application/port"
11+ mock "github.com/stretchr/testify/mock"
12+)
13+
14+// NewMockAccentKeyHandler creates a new instance of MockAccentKeyHandler. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
15+// The first argument is typically a *testing.T value.
16+func NewMockAccentKeyHandler(t interface {
17+ mock.TestingT
18+ Cleanup(func())
19+}) *MockAccentKeyHandler {
20+ mock := &MockAccentKeyHandler{}
21+ mock.Mock.Test(t)
22+
23+ t.Cleanup(func() { mock.AssertExpectations(t) })
24+
25+ return mock
26+}
27+
28+// MockAccentKeyHandler is an autogenerated mock type for the AccentKeyHandler type
29+type MockAccentKeyHandler struct {
30+ mock.Mock
31+}
32+
33+type MockAccentKeyHandler_Expecter struct {
34+ mock *mock.Mock
35+}
36+
37+func (_m *MockAccentKeyHandler) EXPECT() *MockAccentKeyHandler_Expecter {
38+ return &MockAccentKeyHandler_Expecter{mock: &_m.Mock}
39+}
40+
41+// OnKeyPressed provides a mock function for the type MockAccentKeyHandler
42+func (_mock *MockAccentKeyHandler) OnKeyPressed(ctx context.Context, char rune, shiftHeld bool) bool {
43+ ret := _mock.Called(ctx, char, shiftHeld)
44+
45+ if len(ret) == 0 {
46+ panic("no return value specified for OnKeyPressed")
47+ }
48+
49+ var r0 bool
50+ if returnFunc, ok := ret.Get(0).(func(context.Context, rune, bool) bool); ok {
51+ r0 = returnFunc(ctx, char, shiftHeld)
52+ } else {
53+ r0 = ret.Get(0).(bool)
54+ }
55+ return r0
56+}
57+
58+// MockAccentKeyHandler_OnKeyPressed_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'OnKeyPressed'
59+type MockAccentKeyHandler_OnKeyPressed_Call struct {
60+ *mock.Call
61+}
62+
63+// OnKeyPressed is a helper method to define mock.On call
64+// - ctx context.Context
65+// - char rune
66+// - shiftHeld bool
67+func (_e *MockAccentKeyHandler_Expecter) OnKeyPressed(ctx any, char any, shiftHeld any) *MockAccentKeyHandler_OnKeyPressed_Call {
68+ return &MockAccentKeyHandler_OnKeyPressed_Call{Call: _e.mock.On("OnKeyPressed", ctx, char, shiftHeld)}
69+}
70+
71+func (_c *MockAccentKeyHandler_OnKeyPressed_Call) Run(run func(ctx context.Context, char rune, shiftHeld bool)) *MockAccentKeyHandler_OnKeyPressed_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 rune
78+ if args[1] != nil {
79+ arg1 = args[1].(rune)
80+ }
81+ var arg2 bool
82+ if args[2] != nil {
83+ arg2 = args[2].(bool)
84+ }
85+ run(
86+ arg0,
87+ arg1,
88+ arg2,
89+ )
90+ })
91+ return _c
92+}
93+
94+func (_c *MockAccentKeyHandler_OnKeyPressed_Call) Return(b bool) *MockAccentKeyHandler_OnKeyPressed_Call {
95+ _c.Call.Return(b)
96+ return _c
97+}
98+
99+func (_c *MockAccentKeyHandler_OnKeyPressed_Call) RunAndReturn(run func(ctx context.Context, char rune, shiftHeld bool) bool) *MockAccentKeyHandler_OnKeyPressed_Call {
100+ _c.Call.Return(run)
101+ return _c
102+}
103+
104+// OnKeyReleased provides a mock function for the type MockAccentKeyHandler
105+func (_mock *MockAccentKeyHandler) OnKeyReleased(ctx context.Context, char rune) {
106+ _mock.Called(ctx, char)
107+ return
108+}
109+
110+// MockAccentKeyHandler_OnKeyReleased_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'OnKeyReleased'
111+type MockAccentKeyHandler_OnKeyReleased_Call struct {
112+ *mock.Call
113+}
114+
115+// OnKeyReleased is a helper method to define mock.On call
116+// - ctx context.Context
117+// - char rune
118+func (_e *MockAccentKeyHandler_Expecter) OnKeyReleased(ctx any, char any) *MockAccentKeyHandler_OnKeyReleased_Call {
119+ return &MockAccentKeyHandler_OnKeyReleased_Call{Call: _e.mock.On("OnKeyReleased", ctx, char)}
120+}
121+
122+func (_c *MockAccentKeyHandler_OnKeyReleased_Call) Run(run func(ctx context.Context, char rune)) *MockAccentKeyHandler_OnKeyReleased_Call {
123+ _c.Call.Run(func(args mock.Arguments) {
124+ var arg0 context.Context
125+ if args[0] != nil {
126+ arg0 = args[0].(context.Context)
127+ }
128+ var arg1 rune
129+ if args[1] != nil {
130+ arg1 = args[1].(rune)
131+ }
132+ run(
133+ arg0,
134+ arg1,
135+ )
136+ })
137+ return _c
138+}
139+
140+func (_c *MockAccentKeyHandler_OnKeyReleased_Call) Return() *MockAccentKeyHandler_OnKeyReleased_Call {
141+ _c.Call.Return()
142+ return _c
143+}
144+
145+func (_c *MockAccentKeyHandler_OnKeyReleased_Call) RunAndReturn(run func(ctx context.Context, char rune)) *MockAccentKeyHandler_OnKeyReleased_Call {
146+ _c.Run(run)
147+ return _c
148+}
149+
150+// NewMockDownloadPreparer creates a new instance of MockDownloadPreparer. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
151+// The first argument is typically a *testing.T value.
152+func NewMockDownloadPreparer(t interface {
153+ mock.TestingT
154+ Cleanup(func())
155+}) *MockDownloadPreparer {
156+ mock := &MockDownloadPreparer{}
157+ mock.Mock.Test(t)
158+
159+ t.Cleanup(func() { mock.AssertExpectations(t) })
160+
161+ return mock
162+}
163+
164+// MockDownloadPreparer is an autogenerated mock type for the DownloadPreparer type
165+type MockDownloadPreparer struct {
166+ mock.Mock
167+}
168+
169+type MockDownloadPreparer_Expecter struct {
170+ mock *mock.Mock
171+}
172+
173+func (_m *MockDownloadPreparer) EXPECT() *MockDownloadPreparer_Expecter {
174+ return &MockDownloadPreparer_Expecter{mock: &_m.Mock}
175+}
176+
177+// Execute provides a mock function for the type MockDownloadPreparer
178+func (_mock *MockDownloadPreparer) Execute(ctx context.Context, input port.DownloadPrepareInput) *port.DownloadPrepareOutput {
179+ ret := _mock.Called(ctx, input)
180+
181+ if len(ret) == 0 {
182+ panic("no return value specified for Execute")
183+ }
184+
185+ var r0 *port.DownloadPrepareOutput
186+ if returnFunc, ok := ret.Get(0).(func(context.Context, port.DownloadPrepareInput) *port.DownloadPrepareOutput); ok {
187+ r0 = returnFunc(ctx, input)
188+ } else {
189+ if ret.Get(0) != nil {
190+ r0 = ret.Get(0).(*port.DownloadPrepareOutput)
191+ }
192+ }
193+ return r0
194+}
195+
196+// MockDownloadPreparer_Execute_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Execute'
197+type MockDownloadPreparer_Execute_Call struct {
198+ *mock.Call
199+}
200+
201+// Execute is a helper method to define mock.On call
202+// - ctx context.Context
203+// - input port.DownloadPrepareInput
204+func (_e *MockDownloadPreparer_Expecter) Execute(ctx any, input any) *MockDownloadPreparer_Execute_Call {
205+ return &MockDownloadPreparer_Execute_Call{Call: _e.mock.On("Execute", ctx, input)}
206+}
207+
208+func (_c *MockDownloadPreparer_Execute_Call) Run(run func(ctx context.Context, input port.DownloadPrepareInput)) *MockDownloadPreparer_Execute_Call {
209+ _c.Call.Run(func(args mock.Arguments) {
210+ var arg0 context.Context
211+ if args[0] != nil {
212+ arg0 = args[0].(context.Context)
213+ }
214+ var arg1 port.DownloadPrepareInput
215+ if args[1] != nil {
216+ arg1 = args[1].(port.DownloadPrepareInput)
217+ }
218+ run(
219+ arg0,
220+ arg1,
221+ )
222+ })
223+ return _c
224+}
225+
226+func (_c *MockDownloadPreparer_Execute_Call) Return(downloadPrepareOutput *port.DownloadPrepareOutput) *MockDownloadPreparer_Execute_Call {
227+ _c.Call.Return(downloadPrepareOutput)
228+ return _c
229+}
230+
231+func (_c *MockDownloadPreparer_Execute_Call) RunAndReturn(run func(ctx context.Context, input port.DownloadPrepareInput) *port.DownloadPrepareOutput) *MockDownloadPreparer_Execute_Call {
232+ _c.Call.Return(run)
233+ return _c
234+}
235+
236+// NewMockAutoCopyConfig creates a new instance of MockAutoCopyConfig. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
237+// The first argument is typically a *testing.T value.
238+func NewMockAutoCopyConfig(t interface {
239+ mock.TestingT
240+ Cleanup(func())
241+}) *MockAutoCopyConfig {
242+ mock := &MockAutoCopyConfig{}
243+ mock.Mock.Test(t)
244+
245+ t.Cleanup(func() { mock.AssertExpectations(t) })
246+
247+ return mock
248+}
249+
250+// MockAutoCopyConfig is an autogenerated mock type for the AutoCopyConfig type
251+type MockAutoCopyConfig struct {
252+ mock.Mock
253+}
254+
255+type MockAutoCopyConfig_Expecter struct {
256+ mock *mock.Mock
257+}
258+
259+func (_m *MockAutoCopyConfig) EXPECT() *MockAutoCopyConfig_Expecter {
260+ return &MockAutoCopyConfig_Expecter{mock: &_m.Mock}
261+}
262+
263+// IsAutoCopyEnabled provides a mock function for the type MockAutoCopyConfig
264+func (_mock *MockAutoCopyConfig) IsAutoCopyEnabled() bool {
265+ ret := _mock.Called()
266+
267+ if len(ret) == 0 {
268+ panic("no return value specified for IsAutoCopyEnabled")
269+ }
270+
271+ var r0 bool
272+ if returnFunc, ok := ret.Get(0).(func() bool); ok {
273+ r0 = returnFunc()
274+ } else {
275+ r0 = ret.Get(0).(bool)
276+ }
277+ return r0
278+}
279+
280+// MockAutoCopyConfig_IsAutoCopyEnabled_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'IsAutoCopyEnabled'
281+type MockAutoCopyConfig_IsAutoCopyEnabled_Call struct {
282+ *mock.Call
283+}
284+
285+// IsAutoCopyEnabled is a helper method to define mock.On call
286+func (_e *MockAutoCopyConfig_Expecter) IsAutoCopyEnabled() *MockAutoCopyConfig_IsAutoCopyEnabled_Call {
287+ return &MockAutoCopyConfig_IsAutoCopyEnabled_Call{Call: _e.mock.On("IsAutoCopyEnabled")}
288+}
289+
290+func (_c *MockAutoCopyConfig_IsAutoCopyEnabled_Call) Run(run func()) *MockAutoCopyConfig_IsAutoCopyEnabled_Call {
291+ _c.Call.Run(func(args mock.Arguments) {
292+ run()
293+ })
294+ return _c
295+}
296+
297+func (_c *MockAutoCopyConfig_IsAutoCopyEnabled_Call) Return(b bool) *MockAutoCopyConfig_IsAutoCopyEnabled_Call {
298+ _c.Call.Return(b)
299+ return _c
300+}
301+
302+func (_c *MockAutoCopyConfig_IsAutoCopyEnabled_Call) RunAndReturn(run func() bool) *MockAutoCopyConfig_IsAutoCopyEnabled_Call {
303+ _c.Call.Return(run)
304+ return _c
305+}
A internal/application/port/mocks/hardware.go +90 -0
@@ -0,0 +1,90 @@
1+// Code generated by mockery; DO NOT EDIT.
2+// github.com/vektra/mockery
3+// template: testify
4+
5+package mocks
6+
7+import (
8+ "context"
9+
10+ "github.com/bnema/dumber/internal/application/port"
11+ mock "github.com/stretchr/testify/mock"
12+)
13+
14+// NewMockHardwareSurveyor creates a new instance of MockHardwareSurveyor. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
15+// The first argument is typically a *testing.T value.
16+func NewMockHardwareSurveyor(t interface {
17+ mock.TestingT
18+ Cleanup(func())
19+}) *MockHardwareSurveyor {
20+ mock := &MockHardwareSurveyor{}
21+ mock.Mock.Test(t)
22+
23+ t.Cleanup(func() { mock.AssertExpectations(t) })
24+
25+ return mock
26+}
27+
28+// MockHardwareSurveyor is an autogenerated mock type for the HardwareSurveyor type
29+type MockHardwareSurveyor struct {
30+ mock.Mock
31+}
32+
33+type MockHardwareSurveyor_Expecter struct {
34+ mock *mock.Mock
35+}
36+
37+func (_m *MockHardwareSurveyor) EXPECT() *MockHardwareSurveyor_Expecter {
38+ return &MockHardwareSurveyor_Expecter{mock: &_m.Mock}
39+}
40+
41+// Survey provides a mock function for the type MockHardwareSurveyor
42+func (_mock *MockHardwareSurveyor) Survey(ctx context.Context) port.HardwareInfo {
43+ ret := _mock.Called(ctx)
44+
45+ if len(ret) == 0 {
46+ panic("no return value specified for Survey")
47+ }
48+
49+ var r0 port.HardwareInfo
50+ if returnFunc, ok := ret.Get(0).(func(context.Context) port.HardwareInfo); ok {
51+ r0 = returnFunc(ctx)
52+ } else {
53+ r0 = ret.Get(0).(port.HardwareInfo)
54+ }
55+ return r0
56+}
57+
58+// MockHardwareSurveyor_Survey_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Survey'
59+type MockHardwareSurveyor_Survey_Call struct {
60+ *mock.Call
61+}
62+
63+// Survey is a helper method to define mock.On call
64+// - ctx context.Context
65+func (_e *MockHardwareSurveyor_Expecter) Survey(ctx any) *MockHardwareSurveyor_Survey_Call {
66+ return &MockHardwareSurveyor_Survey_Call{Call: _e.mock.On("Survey", ctx)}
67+}
68+
69+func (_c *MockHardwareSurveyor_Survey_Call) Run(run func(ctx context.Context)) *MockHardwareSurveyor_Survey_Call {
70+ _c.Call.Run(func(args mock.Arguments) {
71+ var arg0 context.Context
72+ if args[0] != nil {
73+ arg0 = args[0].(context.Context)
74+ }
75+ run(
76+ arg0,
77+ )
78+ })
79+ return _c
80+}
81+
82+func (_c *MockHardwareSurveyor_Survey_Call) Return(hardwareInfo port.HardwareInfo) *MockHardwareSurveyor_Survey_Call {
83+ _c.Call.Return(hardwareInfo)
84+ return _c
85+}
86+
87+func (_c *MockHardwareSurveyor_Survey_Call) RunAndReturn(run func(ctx context.Context) port.HardwareInfo) *MockHardwareSurveyor_Survey_Call {
88+ _c.Call.Return(run)
89+ return _c
90+}
A internal/application/port/mocks/history_sidebar.go +239 -0
@@ -0,0 +1,239 @@
1+// Code generated by mockery; DO NOT EDIT.
2+// github.com/vektra/mockery
3+// template: testify
4+
5+package mocks
6+
7+import (
8+ "context"
9+
10+ "github.com/bnema/dumber/internal/application/dto"
11+ "github.com/bnema/dumber/internal/domain/entity"
12+ mock "github.com/stretchr/testify/mock"
13+)
14+
15+// NewMockHistorySidebarHistory creates a new instance of MockHistorySidebarHistory. 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.
17+func NewMockHistorySidebarHistory(t interface {
18+ mock.TestingT
19+ Cleanup(func())
20+}) *MockHistorySidebarHistory {
21+ mock := &MockHistorySidebarHistory{}
22+ mock.Mock.Test(t)
23+
24+ t.Cleanup(func() { mock.AssertExpectations(t) })
25+
26+ return mock
27+}
28+
29+// MockHistorySidebarHistory is an autogenerated mock type for the HistorySidebarHistory type
30+type MockHistorySidebarHistory struct {
31+ mock.Mock
32+}
33+
34+type MockHistorySidebarHistory_Expecter struct {
35+ mock *mock.Mock
36+}
37+
38+func (_m *MockHistorySidebarHistory) EXPECT() *MockHistorySidebarHistory_Expecter {
39+ return &MockHistorySidebarHistory_Expecter{mock: &_m.Mock}
40+}
41+
42+// Delete provides a mock function for the type MockHistorySidebarHistory
43+func (_mock *MockHistorySidebarHistory) Delete(ctx context.Context, id int64) 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, int64) error); ok {
52+ r0 = returnFunc(ctx, id)
53+ } else {
54+ r0 = ret.Error(0)
55+ }
56+ return r0
57+}
58+
59+// MockHistorySidebarHistory_Delete_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Delete'
60+type MockHistorySidebarHistory_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 int64
67+func (_e *MockHistorySidebarHistory_Expecter) Delete(ctx any, id any) *MockHistorySidebarHistory_Delete_Call {
68+ return &MockHistorySidebarHistory_Delete_Call{Call: _e.mock.On("Delete", ctx, id)}
69+}
70+
71+func (_c *MockHistorySidebarHistory_Delete_Call) Run(run func(ctx context.Context, id int64)) *MockHistorySidebarHistory_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 int64
78+ if args[1] != nil {
79+ arg1 = args[1].(int64)
80+ }
81+ run(
82+ arg0,
83+ arg1,
84+ )
85+ })
86+ return _c
87+}
88+
89+func (_c *MockHistorySidebarHistory_Delete_Call) Return(err error) *MockHistorySidebarHistory_Delete_Call {
90+ _c.Call.Return(err)
91+ return _c
92+}
93+
94+func (_c *MockHistorySidebarHistory_Delete_Call) RunAndReturn(run func(ctx context.Context, id int64) error) *MockHistorySidebarHistory_Delete_Call {
95+ _c.Call.Return(run)
96+ return _c
97+}
98+
99+// GetRecent provides a mock function for the type MockHistorySidebarHistory
100+func (_mock *MockHistorySidebarHistory) GetRecent(ctx context.Context, limit int, offset int) ([]*entity.HistoryEntry, error) {
101+ ret := _mock.Called(ctx, limit, offset)
102+
103+ if len(ret) == 0 {
104+ panic("no return value specified for GetRecent")
105+ }
106+
107+ var r0 []*entity.HistoryEntry
108+ var r1 error
109+ if returnFunc, ok := ret.Get(0).(func(context.Context, int, int) ([]*entity.HistoryEntry, error)); ok {
110+ return returnFunc(ctx, limit, offset)
111+ }
112+ if returnFunc, ok := ret.Get(0).(func(context.Context, int, int) []*entity.HistoryEntry); ok {
113+ r0 = returnFunc(ctx, limit, offset)
114+ } else {
115+ if ret.Get(0) != nil {
116+ r0 = ret.Get(0).([]*entity.HistoryEntry)
117+ }
118+ }
119+ if returnFunc, ok := ret.Get(1).(func(context.Context, int, int) error); ok {
120+ r1 = returnFunc(ctx, limit, offset)
121+ } else {
122+ r1 = ret.Error(1)
123+ }
124+ return r0, r1
125+}
126+
127+// MockHistorySidebarHistory_GetRecent_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetRecent'
128+type MockHistorySidebarHistory_GetRecent_Call struct {
129+ *mock.Call
130+}
131+
132+// GetRecent is a helper method to define mock.On call
133+// - ctx context.Context
134+// - limit int
135+// - offset int
136+func (_e *MockHistorySidebarHistory_Expecter) GetRecent(ctx any, limit any, offset any) *MockHistorySidebarHistory_GetRecent_Call {
137+ return &MockHistorySidebarHistory_GetRecent_Call{Call: _e.mock.On("GetRecent", ctx, limit, offset)}
138+}
139+
140+func (_c *MockHistorySidebarHistory_GetRecent_Call) Run(run func(ctx context.Context, limit int, offset int)) *MockHistorySidebarHistory_GetRecent_Call {
141+ _c.Call.Run(func(args mock.Arguments) {
142+ var arg0 context.Context
143+ if args[0] != nil {
144+ arg0 = args[0].(context.Context)
145+ }
146+ var arg1 int
147+ if args[1] != nil {
148+ arg1 = args[1].(int)
149+ }
150+ var arg2 int
151+ if args[2] != nil {
152+ arg2 = args[2].(int)
153+ }
154+ run(
155+ arg0,
156+ arg1,
157+ arg2,
158+ )
159+ })
160+ return _c
161+}
162+
163+func (_c *MockHistorySidebarHistory_GetRecent_Call) Return(historyEntrys []*entity.HistoryEntry, err error) *MockHistorySidebarHistory_GetRecent_Call {
164+ _c.Call.Return(historyEntrys, err)
165+ return _c
166+}
167+
168+func (_c *MockHistorySidebarHistory_GetRecent_Call) RunAndReturn(run func(ctx context.Context, limit int, offset int) ([]*entity.HistoryEntry, error)) *MockHistorySidebarHistory_GetRecent_Call {
169+ _c.Call.Return(run)
170+ return _c
171+}
172+
173+// Search provides a mock function for the type MockHistorySidebarHistory
174+func (_mock *MockHistorySidebarHistory) Search(ctx context.Context, input dto.HistorySearchInput) (*dto.HistorySearchOutput, error) {
175+ ret := _mock.Called(ctx, input)
176+
177+ if len(ret) == 0 {
178+ panic("no return value specified for Search")
179+ }
180+
181+ var r0 *dto.HistorySearchOutput
182+ var r1 error
183+ if returnFunc, ok := ret.Get(0).(func(context.Context, dto.HistorySearchInput) (*dto.HistorySearchOutput, error)); ok {
184+ return returnFunc(ctx, input)
185+ }
186+ if returnFunc, ok := ret.Get(0).(func(context.Context, dto.HistorySearchInput) *dto.HistorySearchOutput); ok {
187+ r0 = returnFunc(ctx, input)
188+ } else {
189+ if ret.Get(0) != nil {
190+ r0 = ret.Get(0).(*dto.HistorySearchOutput)
191+ }
192+ }
193+ if returnFunc, ok := ret.Get(1).(func(context.Context, dto.HistorySearchInput) error); ok {
194+ r1 = returnFunc(ctx, input)
195+ } else {
196+ r1 = ret.Error(1)
197+ }
198+ return r0, r1
199+}
200+
201+// MockHistorySidebarHistory_Search_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Search'
202+type MockHistorySidebarHistory_Search_Call struct {
203+ *mock.Call
204+}
205+
206+// Search is a helper method to define mock.On call
207+// - ctx context.Context
208+// - input dto.HistorySearchInput
209+func (_e *MockHistorySidebarHistory_Expecter) Search(ctx any, input any) *MockHistorySidebarHistory_Search_Call {
210+ return &MockHistorySidebarHistory_Search_Call{Call: _e.mock.On("Search", ctx, input)}
211+}
212+
213+func (_c *MockHistorySidebarHistory_Search_Call) Run(run func(ctx context.Context, input dto.HistorySearchInput)) *MockHistorySidebarHistory_Search_Call {
214+ _c.Call.Run(func(args mock.Arguments) {
215+ var arg0 context.Context
216+ if args[0] != nil {
217+ arg0 = args[0].(context.Context)
218+ }
219+ var arg1 dto.HistorySearchInput
220+ if args[1] != nil {
221+ arg1 = args[1].(dto.HistorySearchInput)
222+ }
223+ run(
224+ arg0,
225+ arg1,
226+ )
227+ })
228+ return _c
229+}
230+
231+func (_c *MockHistorySidebarHistory_Search_Call) Return(historySearchOutput *dto.HistorySearchOutput, err error) *MockHistorySidebarHistory_Search_Call {
232+ _c.Call.Return(historySearchOutput, err)
233+ return _c
234+}
235+
236+func (_c *MockHistorySidebarHistory_Search_Call) RunAndReturn(run func(ctx context.Context, input dto.HistorySearchInput) (*dto.HistorySearchOutput, error)) *MockHistorySidebarHistory_Search_Call {
237+ _c.Call.Return(run)
238+ return _c
239+}
A internal/application/port/mocks/homepage.go +1940 -0
@@ -0,0 +1,1940 @@
1+// Code generated by mockery; DO NOT EDIT.
2+// github.com/vektra/mockery
3+// template: testify
4+
5+package mocks
6+
7+import (
8+ "context"
9+ "time"
10+
11+ "github.com/bnema/dumber/internal/application/dto"
12+ "github.com/bnema/dumber/internal/domain/entity"
13+ mock "github.com/stretchr/testify/mock"
14+)
15+
16+// NewMockHomepageHistory creates a new instance of MockHomepageHistory. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
17+// The first argument is typically a *testing.T value.
18+func NewMockHomepageHistory(t interface {
19+ mock.TestingT
20+ Cleanup(func())
21+}) *MockHomepageHistory {
22+ mock := &MockHomepageHistory{}
23+ mock.Mock.Test(t)
24+
25+ t.Cleanup(func() { mock.AssertExpectations(t) })
26+
27+ return mock
28+}
29+
30+// MockHomepageHistory is an autogenerated mock type for the HomepageHistory type
31+type MockHomepageHistory struct {
32+ mock.Mock
33+}
34+
35+type MockHomepageHistory_Expecter struct {
36+ mock *mock.Mock
37+}
38+
39+func (_m *MockHomepageHistory) EXPECT() *MockHomepageHistory_Expecter {
40+ return &MockHomepageHistory_Expecter{mock: &_m.Mock}
41+}
42+
43+// ClearAll provides a mock function for the type MockHomepageHistory
44+func (_mock *MockHomepageHistory) ClearAll(ctx context.Context) error {
45+ ret := _mock.Called(ctx)
46+
47+ if len(ret) == 0 {
48+ panic("no return value specified for ClearAll")
49+ }
50+
51+ var r0 error
52+ if returnFunc, ok := ret.Get(0).(func(context.Context) error); ok {
53+ r0 = returnFunc(ctx)
54+ } else {
55+ r0 = ret.Error(0)
56+ }
57+ return r0
58+}
59+
60+// MockHomepageHistory_ClearAll_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ClearAll'
61+type MockHomepageHistory_ClearAll_Call struct {
62+ *mock.Call
63+}
64+
65+// ClearAll is a helper method to define mock.On call
66+// - ctx context.Context
67+func (_e *MockHomepageHistory_Expecter) ClearAll(ctx any) *MockHomepageHistory_ClearAll_Call {
68+ return &MockHomepageHistory_ClearAll_Call{Call: _e.mock.On("ClearAll", ctx)}
69+}
70+
71+func (_c *MockHomepageHistory_ClearAll_Call) Run(run func(ctx context.Context)) *MockHomepageHistory_ClearAll_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+ run(
78+ arg0,
79+ )
80+ })
81+ return _c
82+}
83+
84+func (_c *MockHomepageHistory_ClearAll_Call) Return(err error) *MockHomepageHistory_ClearAll_Call {
85+ _c.Call.Return(err)
86+ return _c
87+}
88+
89+func (_c *MockHomepageHistory_ClearAll_Call) RunAndReturn(run func(ctx context.Context) error) *MockHomepageHistory_ClearAll_Call {
90+ _c.Call.Return(run)
91+ return _c
92+}
93+
94+// ClearOlderThan provides a mock function for the type MockHomepageHistory
95+func (_mock *MockHomepageHistory) ClearOlderThan(ctx context.Context, before time.Time) error {
96+ ret := _mock.Called(ctx, before)
97+
98+ if len(ret) == 0 {
99+ panic("no return value specified for ClearOlderThan")
100+ }
101+
102+ var r0 error
103+ if returnFunc, ok := ret.Get(0).(func(context.Context, time.Time) error); ok {
104+ r0 = returnFunc(ctx, before)
105+ } else {
106+ r0 = ret.Error(0)
107+ }
108+ return r0
109+}
110+
111+// MockHomepageHistory_ClearOlderThan_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ClearOlderThan'
112+type MockHomepageHistory_ClearOlderThan_Call struct {
113+ *mock.Call
114+}
115+
116+// ClearOlderThan is a helper method to define mock.On call
117+// - ctx context.Context
118+// - before time.Time
119+func (_e *MockHomepageHistory_Expecter) ClearOlderThan(ctx any, before any) *MockHomepageHistory_ClearOlderThan_Call {
120+ return &MockHomepageHistory_ClearOlderThan_Call{Call: _e.mock.On("ClearOlderThan", ctx, before)}
121+}
122+
123+func (_c *MockHomepageHistory_ClearOlderThan_Call) Run(run func(ctx context.Context, before time.Time)) *MockHomepageHistory_ClearOlderThan_Call {
124+ _c.Call.Run(func(args mock.Arguments) {
125+ var arg0 context.Context
126+ if args[0] != nil {
127+ arg0 = args[0].(context.Context)
128+ }
129+ var arg1 time.Time
130+ if args[1] != nil {
131+ arg1 = args[1].(time.Time)
132+ }
133+ run(
134+ arg0,
135+ arg1,
136+ )
137+ })
138+ return _c
139+}
140+
141+func (_c *MockHomepageHistory_ClearOlderThan_Call) Return(err error) *MockHomepageHistory_ClearOlderThan_Call {
142+ _c.Call.Return(err)
143+ return _c
144+}
145+
146+func (_c *MockHomepageHistory_ClearOlderThan_Call) RunAndReturn(run func(ctx context.Context, before time.Time) error) *MockHomepageHistory_ClearOlderThan_Call {
147+ _c.Call.Return(run)
148+ return _c
149+}
150+
151+// ClearRange provides a mock function for the type MockHomepageHistory
152+func (_mock *MockHomepageHistory) ClearRange(ctx context.Context, rangeID string) error {
153+ ret := _mock.Called(ctx, rangeID)
154+
155+ if len(ret) == 0 {
156+ panic("no return value specified for ClearRange")
157+ }
158+
159+ var r0 error
160+ if returnFunc, ok := ret.Get(0).(func(context.Context, string) error); ok {
161+ r0 = returnFunc(ctx, rangeID)
162+ } else {
163+ r0 = ret.Error(0)
164+ }
165+ return r0
166+}
167+
168+// MockHomepageHistory_ClearRange_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ClearRange'
169+type MockHomepageHistory_ClearRange_Call struct {
170+ *mock.Call
171+}
172+
173+// ClearRange is a helper method to define mock.On call
174+// - ctx context.Context
175+// - rangeID string
176+func (_e *MockHomepageHistory_Expecter) ClearRange(ctx any, rangeID any) *MockHomepageHistory_ClearRange_Call {
177+ return &MockHomepageHistory_ClearRange_Call{Call: _e.mock.On("ClearRange", ctx, rangeID)}
178+}
179+
180+func (_c *MockHomepageHistory_ClearRange_Call) Run(run func(ctx context.Context, rangeID string)) *MockHomepageHistory_ClearRange_Call {
181+ _c.Call.Run(func(args mock.Arguments) {
182+ var arg0 context.Context
183+ if args[0] != nil {
184+ arg0 = args[0].(context.Context)
185+ }
186+ var arg1 string
187+ if args[1] != nil {
188+ arg1 = args[1].(string)
189+ }
190+ run(
191+ arg0,
192+ arg1,
193+ )
194+ })
195+ return _c
196+}
197+
198+func (_c *MockHomepageHistory_ClearRange_Call) Return(err error) *MockHomepageHistory_ClearRange_Call {
199+ _c.Call.Return(err)
200+ return _c
201+}
202+
203+func (_c *MockHomepageHistory_ClearRange_Call) RunAndReturn(run func(ctx context.Context, rangeID string) error) *MockHomepageHistory_ClearRange_Call {
204+ _c.Call.Return(run)
205+ return _c
206+}
207+
208+// Delete provides a mock function for the type MockHomepageHistory
209+func (_mock *MockHomepageHistory) Delete(ctx context.Context, id int64) error {
210+ ret := _mock.Called(ctx, id)
211+
212+ if len(ret) == 0 {
213+ panic("no return value specified for Delete")
214+ }
215+
216+ var r0 error
217+ if returnFunc, ok := ret.Get(0).(func(context.Context, int64) error); ok {
218+ r0 = returnFunc(ctx, id)
219+ } else {
220+ r0 = ret.Error(0)
221+ }
222+ return r0
223+}
224+
225+// MockHomepageHistory_Delete_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Delete'
226+type MockHomepageHistory_Delete_Call struct {
227+ *mock.Call
228+}
229+
230+// Delete is a helper method to define mock.On call
231+// - ctx context.Context
232+// - id int64
233+func (_e *MockHomepageHistory_Expecter) Delete(ctx any, id any) *MockHomepageHistory_Delete_Call {
234+ return &MockHomepageHistory_Delete_Call{Call: _e.mock.On("Delete", ctx, id)}
235+}
236+
237+func (_c *MockHomepageHistory_Delete_Call) Run(run func(ctx context.Context, id int64)) *MockHomepageHistory_Delete_Call {
238+ _c.Call.Run(func(args mock.Arguments) {
239+ var arg0 context.Context
240+ if args[0] != nil {
241+ arg0 = args[0].(context.Context)
242+ }
243+ var arg1 int64
244+ if args[1] != nil {
245+ arg1 = args[1].(int64)
246+ }
247+ run(
248+ arg0,
249+ arg1,
250+ )
251+ })
252+ return _c
253+}
254+
255+func (_c *MockHomepageHistory_Delete_Call) Return(err error) *MockHomepageHistory_Delete_Call {
256+ _c.Call.Return(err)
257+ return _c
258+}
259+
260+func (_c *MockHomepageHistory_Delete_Call) RunAndReturn(run func(ctx context.Context, id int64) error) *MockHomepageHistory_Delete_Call {
261+ _c.Call.Return(run)
262+ return _c
263+}
264+
265+// DeleteByDomain provides a mock function for the type MockHomepageHistory
266+func (_mock *MockHomepageHistory) DeleteByDomain(ctx context.Context, domain string) error {
267+ ret := _mock.Called(ctx, domain)
268+
269+ if len(ret) == 0 {
270+ panic("no return value specified for DeleteByDomain")
271+ }
272+
273+ var r0 error
274+ if returnFunc, ok := ret.Get(0).(func(context.Context, string) error); ok {
275+ r0 = returnFunc(ctx, domain)
276+ } else {
277+ r0 = ret.Error(0)
278+ }
279+ return r0
280+}
281+
282+// MockHomepageHistory_DeleteByDomain_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'DeleteByDomain'
283+type MockHomepageHistory_DeleteByDomain_Call struct {
284+ *mock.Call
285+}
286+
287+// DeleteByDomain is a helper method to define mock.On call
288+// - ctx context.Context
289+// - domain string
290+func (_e *MockHomepageHistory_Expecter) DeleteByDomain(ctx any, domain any) *MockHomepageHistory_DeleteByDomain_Call {
291+ return &MockHomepageHistory_DeleteByDomain_Call{Call: _e.mock.On("DeleteByDomain", ctx, domain)}
292+}
293+
294+func (_c *MockHomepageHistory_DeleteByDomain_Call) Run(run func(ctx context.Context, domain string)) *MockHomepageHistory_DeleteByDomain_Call {
295+ _c.Call.Run(func(args mock.Arguments) {
296+ var arg0 context.Context
297+ if args[0] != nil {
298+ arg0 = args[0].(context.Context)
299+ }
300+ var arg1 string
301+ if args[1] != nil {
302+ arg1 = args[1].(string)
303+ }
304+ run(
305+ arg0,
306+ arg1,
307+ )
308+ })
309+ return _c
310+}
311+
312+func (_c *MockHomepageHistory_DeleteByDomain_Call) Return(err error) *MockHomepageHistory_DeleteByDomain_Call {
313+ _c.Call.Return(err)
314+ return _c
315+}
316+
317+func (_c *MockHomepageHistory_DeleteByDomain_Call) RunAndReturn(run func(ctx context.Context, domain string) error) *MockHomepageHistory_DeleteByDomain_Call {
318+ _c.Call.Return(run)
319+ return _c
320+}
321+
322+// GetAnalytics provides a mock function for the type MockHomepageHistory
323+func (_mock *MockHomepageHistory) GetAnalytics(ctx context.Context) (*entity.HistoryAnalytics, error) {
324+ ret := _mock.Called(ctx)
325+
326+ if len(ret) == 0 {
327+ panic("no return value specified for GetAnalytics")
328+ }
329+
330+ var r0 *entity.HistoryAnalytics
331+ var r1 error
332+ if returnFunc, ok := ret.Get(0).(func(context.Context) (*entity.HistoryAnalytics, error)); ok {
333+ return returnFunc(ctx)
334+ }
335+ if returnFunc, ok := ret.Get(0).(func(context.Context) *entity.HistoryAnalytics); ok {
336+ r0 = returnFunc(ctx)
337+ } else {
338+ if ret.Get(0) != nil {
339+ r0 = ret.Get(0).(*entity.HistoryAnalytics)
340+ }
341+ }
342+ if returnFunc, ok := ret.Get(1).(func(context.Context) error); ok {
343+ r1 = returnFunc(ctx)
344+ } else {
345+ r1 = ret.Error(1)
346+ }
347+ return r0, r1
348+}
349+
350+// MockHomepageHistory_GetAnalytics_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetAnalytics'
351+type MockHomepageHistory_GetAnalytics_Call struct {
352+ *mock.Call
353+}
354+
355+// GetAnalytics is a helper method to define mock.On call
356+// - ctx context.Context
357+func (_e *MockHomepageHistory_Expecter) GetAnalytics(ctx any) *MockHomepageHistory_GetAnalytics_Call {
358+ return &MockHomepageHistory_GetAnalytics_Call{Call: _e.mock.On("GetAnalytics", ctx)}
359+}
360+
361+func (_c *MockHomepageHistory_GetAnalytics_Call) Run(run func(ctx context.Context)) *MockHomepageHistory_GetAnalytics_Call {
362+ _c.Call.Run(func(args mock.Arguments) {
363+ var arg0 context.Context
364+ if args[0] != nil {
365+ arg0 = args[0].(context.Context)
366+ }
367+ run(
368+ arg0,
369+ )
370+ })
371+ return _c
372+}
373+
374+func (_c *MockHomepageHistory_GetAnalytics_Call) Return(historyAnalytics *entity.HistoryAnalytics, err error) *MockHomepageHistory_GetAnalytics_Call {
375+ _c.Call.Return(historyAnalytics, err)
376+ return _c
377+}
378+
379+func (_c *MockHomepageHistory_GetAnalytics_Call) RunAndReturn(run func(ctx context.Context) (*entity.HistoryAnalytics, error)) *MockHomepageHistory_GetAnalytics_Call {
380+ _c.Call.Return(run)
381+ return _c
382+}
383+
384+// GetDomainStats provides a mock function for the type MockHomepageHistory
385+func (_mock *MockHomepageHistory) GetDomainStats(ctx context.Context, limit int) ([]*entity.DomainStat, error) {
386+ ret := _mock.Called(ctx, limit)
387+
388+ if len(ret) == 0 {
389+ panic("no return value specified for GetDomainStats")
390+ }
391+
392+ var r0 []*entity.DomainStat
393+ var r1 error
394+ if returnFunc, ok := ret.Get(0).(func(context.Context, int) ([]*entity.DomainStat, error)); ok {
395+ return returnFunc(ctx, limit)
396+ }
397+ if returnFunc, ok := ret.Get(0).(func(context.Context, int) []*entity.DomainStat); ok {
398+ r0 = returnFunc(ctx, limit)
399+ } else {
400+ if ret.Get(0) != nil {
401+ r0 = ret.Get(0).([]*entity.DomainStat)
402+ }
403+ }
404+ if returnFunc, ok := ret.Get(1).(func(context.Context, int) error); ok {
405+ r1 = returnFunc(ctx, limit)
406+ } else {
407+ r1 = ret.Error(1)
408+ }
409+ return r0, r1
410+}
411+
412+// MockHomepageHistory_GetDomainStats_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetDomainStats'
413+type MockHomepageHistory_GetDomainStats_Call struct {
414+ *mock.Call
415+}
416+
417+// GetDomainStats is a helper method to define mock.On call
418+// - ctx context.Context
419+// - limit int
420+func (_e *MockHomepageHistory_Expecter) GetDomainStats(ctx any, limit any) *MockHomepageHistory_GetDomainStats_Call {
421+ return &MockHomepageHistory_GetDomainStats_Call{Call: _e.mock.On("GetDomainStats", ctx, limit)}
422+}
423+
424+func (_c *MockHomepageHistory_GetDomainStats_Call) Run(run func(ctx context.Context, limit int)) *MockHomepageHistory_GetDomainStats_Call {
425+ _c.Call.Run(func(args mock.Arguments) {
426+ var arg0 context.Context
427+ if args[0] != nil {
428+ arg0 = args[0].(context.Context)
429+ }
430+ var arg1 int
431+ if args[1] != nil {
432+ arg1 = args[1].(int)
433+ }
434+ run(
435+ arg0,
436+ arg1,
437+ )
438+ })
439+ return _c
440+}
441+
442+func (_c *MockHomepageHistory_GetDomainStats_Call) Return(domainStats []*entity.DomainStat, err error) *MockHomepageHistory_GetDomainStats_Call {
443+ _c.Call.Return(domainStats, err)
444+ return _c
445+}
446+
447+func (_c *MockHomepageHistory_GetDomainStats_Call) RunAndReturn(run func(ctx context.Context, limit int) ([]*entity.DomainStat, error)) *MockHomepageHistory_GetDomainStats_Call {
448+ _c.Call.Return(run)
449+ return _c
450+}
451+
452+// GetRecent provides a mock function for the type MockHomepageHistory
453+func (_mock *MockHomepageHistory) GetRecent(ctx context.Context, limit int, offset int) ([]*entity.HistoryEntry, error) {
454+ ret := _mock.Called(ctx, limit, offset)
455+
456+ if len(ret) == 0 {
457+ panic("no return value specified for GetRecent")
458+ }
459+
460+ var r0 []*entity.HistoryEntry
461+ var r1 error
462+ if returnFunc, ok := ret.Get(0).(func(context.Context, int, int) ([]*entity.HistoryEntry, error)); ok {
463+ return returnFunc(ctx, limit, offset)
464+ }
465+ if returnFunc, ok := ret.Get(0).(func(context.Context, int, int) []*entity.HistoryEntry); ok {
466+ r0 = returnFunc(ctx, limit, offset)
467+ } else {
468+ if ret.Get(0) != nil {
469+ r0 = ret.Get(0).([]*entity.HistoryEntry)
470+ }
471+ }
472+ if returnFunc, ok := ret.Get(1).(func(context.Context, int, int) error); ok {
473+ r1 = returnFunc(ctx, limit, offset)
474+ } else {
475+ r1 = ret.Error(1)
476+ }
477+ return r0, r1
478+}
479+
480+// MockHomepageHistory_GetRecent_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetRecent'
481+type MockHomepageHistory_GetRecent_Call struct {
482+ *mock.Call
483+}
484+
485+// GetRecent is a helper method to define mock.On call
486+// - ctx context.Context
487+// - limit int
488+// - offset int
489+func (_e *MockHomepageHistory_Expecter) GetRecent(ctx any, limit any, offset any) *MockHomepageHistory_GetRecent_Call {
490+ return &MockHomepageHistory_GetRecent_Call{Call: _e.mock.On("GetRecent", ctx, limit, offset)}
491+}
492+
493+func (_c *MockHomepageHistory_GetRecent_Call) Run(run func(ctx context.Context, limit int, offset int)) *MockHomepageHistory_GetRecent_Call {
494+ _c.Call.Run(func(args mock.Arguments) {
495+ var arg0 context.Context
496+ if args[0] != nil {
497+ arg0 = args[0].(context.Context)
498+ }
499+ var arg1 int
500+ if args[1] != nil {
501+ arg1 = args[1].(int)
502+ }
503+ var arg2 int
504+ if args[2] != nil {
505+ arg2 = args[2].(int)
506+ }
507+ run(
508+ arg0,
509+ arg1,
510+ arg2,
511+ )
512+ })
513+ return _c
514+}
515+
516+func (_c *MockHomepageHistory_GetRecent_Call) Return(historyEntrys []*entity.HistoryEntry, err error) *MockHomepageHistory_GetRecent_Call {
517+ _c.Call.Return(historyEntrys, err)
518+ return _c
519+}
520+
521+func (_c *MockHomepageHistory_GetRecent_Call) RunAndReturn(run func(ctx context.Context, limit int, offset int) ([]*entity.HistoryEntry, error)) *MockHomepageHistory_GetRecent_Call {
522+ _c.Call.Return(run)
523+ return _c
524+}
525+
526+// GetRecentByDomain provides a mock function for the type MockHomepageHistory
527+func (_mock *MockHomepageHistory) GetRecentByDomain(ctx context.Context, domain string, limit int, offset int) ([]*entity.HistoryEntry, error) {
528+ ret := _mock.Called(ctx, domain, limit, offset)
529+
530+ if len(ret) == 0 {
531+ panic("no return value specified for GetRecentByDomain")
532+ }
533+
534+ var r0 []*entity.HistoryEntry
535+ var r1 error
536+ if returnFunc, ok := ret.Get(0).(func(context.Context, string, int, int) ([]*entity.HistoryEntry, error)); ok {
537+ return returnFunc(ctx, domain, limit, offset)
538+ }
539+ if returnFunc, ok := ret.Get(0).(func(context.Context, string, int, int) []*entity.HistoryEntry); ok {
540+ r0 = returnFunc(ctx, domain, limit, offset)
541+ } else {
542+ if ret.Get(0) != nil {
543+ r0 = ret.Get(0).([]*entity.HistoryEntry)
544+ }
545+ }
546+ if returnFunc, ok := ret.Get(1).(func(context.Context, string, int, int) error); ok {
547+ r1 = returnFunc(ctx, domain, limit, offset)
548+ } else {
549+ r1 = ret.Error(1)
550+ }
551+ return r0, r1
552+}
553+
554+// MockHomepageHistory_GetRecentByDomain_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetRecentByDomain'
555+type MockHomepageHistory_GetRecentByDomain_Call struct {
556+ *mock.Call
557+}
558+
559+// GetRecentByDomain is a helper method to define mock.On call
560+// - ctx context.Context
561+// - domain string
562+// - limit int
563+// - offset int
564+func (_e *MockHomepageHistory_Expecter) GetRecentByDomain(ctx any, domain any, limit any, offset any) *MockHomepageHistory_GetRecentByDomain_Call {
565+ return &MockHomepageHistory_GetRecentByDomain_Call{Call: _e.mock.On("GetRecentByDomain", ctx, domain, limit, offset)}
566+}
567+
568+func (_c *MockHomepageHistory_GetRecentByDomain_Call) Run(run func(ctx context.Context, domain string, limit int, offset int)) *MockHomepageHistory_GetRecentByDomain_Call {
569+ _c.Call.Run(func(args mock.Arguments) {
570+ var arg0 context.Context
571+ if args[0] != nil {
572+ arg0 = args[0].(context.Context)
573+ }
574+ var arg1 string
575+ if args[1] != nil {
576+ arg1 = args[1].(string)
577+ }
578+ var arg2 int
579+ if args[2] != nil {
580+ arg2 = args[2].(int)
581+ }
582+ var arg3 int
583+ if args[3] != nil {
584+ arg3 = args[3].(int)
585+ }
586+ run(
587+ arg0,
588+ arg1,
589+ arg2,
590+ arg3,
591+ )
592+ })
593+ return _c
594+}
595+
596+func (_c *MockHomepageHistory_GetRecentByDomain_Call) Return(historyEntrys []*entity.HistoryEntry, err error) *MockHomepageHistory_GetRecentByDomain_Call {
597+ _c.Call.Return(historyEntrys, err)
598+ return _c
599+}
600+
601+func (_c *MockHomepageHistory_GetRecentByDomain_Call) RunAndReturn(run func(ctx context.Context, domain string, limit int, offset int) ([]*entity.HistoryEntry, error)) *MockHomepageHistory_GetRecentByDomain_Call {
602+ _c.Call.Return(run)
603+ return _c
604+}
605+
606+// GetRecentWindow provides a mock function for the type MockHomepageHistory
607+func (_mock *MockHomepageHistory) GetRecentWindow(ctx context.Context, before time.Time, domain string) (*entity.HistoryWindow, error) {
608+ ret := _mock.Called(ctx, before, domain)
609+
610+ if len(ret) == 0 {
611+ panic("no return value specified for GetRecentWindow")
612+ }
613+
614+ var r0 *entity.HistoryWindow
615+ var r1 error
616+ if returnFunc, ok := ret.Get(0).(func(context.Context, time.Time, string) (*entity.HistoryWindow, error)); ok {
617+ return returnFunc(ctx, before, domain)
618+ }
619+ if returnFunc, ok := ret.Get(0).(func(context.Context, time.Time, string) *entity.HistoryWindow); ok {
620+ r0 = returnFunc(ctx, before, domain)
621+ } else {
622+ if ret.Get(0) != nil {
623+ r0 = ret.Get(0).(*entity.HistoryWindow)
624+ }
625+ }
626+ if returnFunc, ok := ret.Get(1).(func(context.Context, time.Time, string) error); ok {
627+ r1 = returnFunc(ctx, before, domain)
628+ } else {
629+ r1 = ret.Error(1)
630+ }
631+ return r0, r1
632+}
633+
634+// MockHomepageHistory_GetRecentWindow_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetRecentWindow'
635+type MockHomepageHistory_GetRecentWindow_Call struct {
636+ *mock.Call
637+}
638+
639+// GetRecentWindow is a helper method to define mock.On call
640+// - ctx context.Context
641+// - before time.Time
642+// - domain string
643+func (_e *MockHomepageHistory_Expecter) GetRecentWindow(ctx any, before any, domain any) *MockHomepageHistory_GetRecentWindow_Call {
644+ return &MockHomepageHistory_GetRecentWindow_Call{Call: _e.mock.On("GetRecentWindow", ctx, before, domain)}
645+}
646+
647+func (_c *MockHomepageHistory_GetRecentWindow_Call) Run(run func(ctx context.Context, before time.Time, domain string)) *MockHomepageHistory_GetRecentWindow_Call {
648+ _c.Call.Run(func(args mock.Arguments) {
649+ var arg0 context.Context
650+ if args[0] != nil {
651+ arg0 = args[0].(context.Context)
652+ }
653+ var arg1 time.Time
654+ if args[1] != nil {
655+ arg1 = args[1].(time.Time)
656+ }
657+ var arg2 string
658+ if args[2] != nil {
659+ arg2 = args[2].(string)
660+ }
661+ run(
662+ arg0,
663+ arg1,
664+ arg2,
665+ )
666+ })
667+ return _c
668+}
669+
670+func (_c *MockHomepageHistory_GetRecentWindow_Call) Return(historyWindow *entity.HistoryWindow, err error) *MockHomepageHistory_GetRecentWindow_Call {
671+ _c.Call.Return(historyWindow, err)
672+ return _c
673+}
674+
675+func (_c *MockHomepageHistory_GetRecentWindow_Call) RunAndReturn(run func(ctx context.Context, before time.Time, domain string) (*entity.HistoryWindow, error)) *MockHomepageHistory_GetRecentWindow_Call {
676+ _c.Call.Return(run)
677+ return _c
678+}
679+
680+// GetStats provides a mock function for the type MockHomepageHistory
681+func (_mock *MockHomepageHistory) GetStats(ctx context.Context) (*entity.HistoryStats, error) {
682+ ret := _mock.Called(ctx)
683+
684+ if len(ret) == 0 {
685+ panic("no return value specified for GetStats")
686+ }
687+
688+ var r0 *entity.HistoryStats
689+ var r1 error
690+ if returnFunc, ok := ret.Get(0).(func(context.Context) (*entity.HistoryStats, error)); ok {
691+ return returnFunc(ctx)
692+ }
693+ if returnFunc, ok := ret.Get(0).(func(context.Context) *entity.HistoryStats); ok {
694+ r0 = returnFunc(ctx)
695+ } else {
696+ if ret.Get(0) != nil {
697+ r0 = ret.Get(0).(*entity.HistoryStats)
698+ }
699+ }
700+ if returnFunc, ok := ret.Get(1).(func(context.Context) error); ok {
701+ r1 = returnFunc(ctx)
702+ } else {
703+ r1 = ret.Error(1)
704+ }
705+ return r0, r1
706+}
707+
708+// MockHomepageHistory_GetStats_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetStats'
709+type MockHomepageHistory_GetStats_Call struct {
710+ *mock.Call
711+}
712+
713+// GetStats is a helper method to define mock.On call
714+// - ctx context.Context
715+func (_e *MockHomepageHistory_Expecter) GetStats(ctx any) *MockHomepageHistory_GetStats_Call {
716+ return &MockHomepageHistory_GetStats_Call{Call: _e.mock.On("GetStats", ctx)}
717+}
718+
719+func (_c *MockHomepageHistory_GetStats_Call) Run(run func(ctx context.Context)) *MockHomepageHistory_GetStats_Call {
720+ _c.Call.Run(func(args mock.Arguments) {
721+ var arg0 context.Context
722+ if args[0] != nil {
723+ arg0 = args[0].(context.Context)
724+ }
725+ run(
726+ arg0,
727+ )
728+ })
729+ return _c
730+}
731+
732+func (_c *MockHomepageHistory_GetStats_Call) Return(historyStats *entity.HistoryStats, err error) *MockHomepageHistory_GetStats_Call {
733+ _c.Call.Return(historyStats, err)
734+ return _c
735+}
736+
737+func (_c *MockHomepageHistory_GetStats_Call) RunAndReturn(run func(ctx context.Context) (*entity.HistoryStats, error)) *MockHomepageHistory_GetStats_Call {
738+ _c.Call.Return(run)
739+ return _c
740+}
741+
742+// Search provides a mock function for the type MockHomepageHistory
743+func (_mock *MockHomepageHistory) Search(ctx context.Context, input dto.HistorySearchInput) (*dto.HistorySearchOutput, error) {
744+ ret := _mock.Called(ctx, input)
745+
746+ if len(ret) == 0 {
747+ panic("no return value specified for Search")
748+ }
749+
750+ var r0 *dto.HistorySearchOutput
751+ var r1 error
752+ if returnFunc, ok := ret.Get(0).(func(context.Context, dto.HistorySearchInput) (*dto.HistorySearchOutput, error)); ok {
753+ return returnFunc(ctx, input)
754+ }
755+ if returnFunc, ok := ret.Get(0).(func(context.Context, dto.HistorySearchInput) *dto.HistorySearchOutput); ok {
756+ r0 = returnFunc(ctx, input)
757+ } else {
758+ if ret.Get(0) != nil {
759+ r0 = ret.Get(0).(*dto.HistorySearchOutput)
760+ }
761+ }
762+ if returnFunc, ok := ret.Get(1).(func(context.Context, dto.HistorySearchInput) error); ok {
763+ r1 = returnFunc(ctx, input)
764+ } else {
765+ r1 = ret.Error(1)
766+ }
767+ return r0, r1
768+}
769+
770+// MockHomepageHistory_Search_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Search'
771+type MockHomepageHistory_Search_Call struct {
772+ *mock.Call
773+}
774+
775+// Search is a helper method to define mock.On call
776+// - ctx context.Context
777+// - input dto.HistorySearchInput
778+func (_e *MockHomepageHistory_Expecter) Search(ctx any, input any) *MockHomepageHistory_Search_Call {
779+ return &MockHomepageHistory_Search_Call{Call: _e.mock.On("Search", ctx, input)}
780+}
781+
782+func (_c *MockHomepageHistory_Search_Call) Run(run func(ctx context.Context, input dto.HistorySearchInput)) *MockHomepageHistory_Search_Call {
783+ _c.Call.Run(func(args mock.Arguments) {
784+ var arg0 context.Context
785+ if args[0] != nil {
786+ arg0 = args[0].(context.Context)
787+ }
788+ var arg1 dto.HistorySearchInput
789+ if args[1] != nil {
790+ arg1 = args[1].(dto.HistorySearchInput)
791+ }
792+ run(
793+ arg0,
794+ arg1,
795+ )
796+ })
797+ return _c
798+}
799+
800+func (_c *MockHomepageHistory_Search_Call) Return(historySearchOutput *dto.HistorySearchOutput, err error) *MockHomepageHistory_Search_Call {
801+ _c.Call.Return(historySearchOutput, err)
802+ return _c
803+}
804+
805+func (_c *MockHomepageHistory_Search_Call) RunAndReturn(run func(ctx context.Context, input dto.HistorySearchInput) (*dto.HistorySearchOutput, error)) *MockHomepageHistory_Search_Call {
806+ _c.Call.Return(run)
807+ return _c
808+}
809+
810+// NewMockHomepageFavorites creates a new instance of MockHomepageFavorites. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
811+// The first argument is typically a *testing.T value.
812+func NewMockHomepageFavorites(t interface {
813+ mock.TestingT
814+ Cleanup(func())
815+}) *MockHomepageFavorites {
816+ mock := &MockHomepageFavorites{}
817+ mock.Mock.Test(t)
818+
819+ t.Cleanup(func() { mock.AssertExpectations(t) })
820+
821+ return mock
822+}
823+
824+// MockHomepageFavorites is an autogenerated mock type for the HomepageFavorites type
825+type MockHomepageFavorites struct {
826+ mock.Mock
827+}
828+
829+type MockHomepageFavorites_Expecter struct {
830+ mock *mock.Mock
831+}
832+
833+func (_m *MockHomepageFavorites) EXPECT() *MockHomepageFavorites_Expecter {
834+ return &MockHomepageFavorites_Expecter{mock: &_m.Mock}
835+}
836+
837+// AddFavorite provides a mock function for the type MockHomepageFavorites
838+func (_mock *MockHomepageFavorites) AddFavorite(ctx context.Context, input dto.FavoriteCreateInput) (*entity.Favorite, error) {
839+ ret := _mock.Called(ctx, input)
840+
841+ if len(ret) == 0 {
842+ panic("no return value specified for AddFavorite")
843+ }
844+
845+ var r0 *entity.Favorite
846+ var r1 error
847+ if returnFunc, ok := ret.Get(0).(func(context.Context, dto.FavoriteCreateInput) (*entity.Favorite, error)); ok {
848+ return returnFunc(ctx, input)
849+ }
850+ if returnFunc, ok := ret.Get(0).(func(context.Context, dto.FavoriteCreateInput) *entity.Favorite); ok {
851+ r0 = returnFunc(ctx, input)
852+ } else {
853+ if ret.Get(0) != nil {
854+ r0 = ret.Get(0).(*entity.Favorite)
855+ }
856+ }
857+ if returnFunc, ok := ret.Get(1).(func(context.Context, dto.FavoriteCreateInput) error); ok {
858+ r1 = returnFunc(ctx, input)
859+ } else {
860+ r1 = ret.Error(1)
861+ }
862+ return r0, r1
863+}
864+
865+// MockHomepageFavorites_AddFavorite_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'AddFavorite'
866+type MockHomepageFavorites_AddFavorite_Call struct {
867+ *mock.Call
868+}
869+
870+// AddFavorite is a helper method to define mock.On call
871+// - ctx context.Context
872+// - input dto.FavoriteCreateInput
873+func (_e *MockHomepageFavorites_Expecter) AddFavorite(ctx any, input any) *MockHomepageFavorites_AddFavorite_Call {
874+ return &MockHomepageFavorites_AddFavorite_Call{Call: _e.mock.On("AddFavorite", ctx, input)}
875+}
876+
877+func (_c *MockHomepageFavorites_AddFavorite_Call) Run(run func(ctx context.Context, input dto.FavoriteCreateInput)) *MockHomepageFavorites_AddFavorite_Call {
878+ _c.Call.Run(func(args mock.Arguments) {
879+ var arg0 context.Context
880+ if args[0] != nil {
881+ arg0 = args[0].(context.Context)
882+ }
883+ var arg1 dto.FavoriteCreateInput
884+ if args[1] != nil {
885+ arg1 = args[1].(dto.FavoriteCreateInput)
886+ }
887+ run(
888+ arg0,
889+ arg1,
890+ )
891+ })
892+ return _c
893+}
894+
895+func (_c *MockHomepageFavorites_AddFavorite_Call) Return(favorite *entity.Favorite, err error) *MockHomepageFavorites_AddFavorite_Call {
896+ _c.Call.Return(favorite, err)
897+ return _c
898+}
899+
900+func (_c *MockHomepageFavorites_AddFavorite_Call) RunAndReturn(run func(ctx context.Context, input dto.FavoriteCreateInput) (*entity.Favorite, error)) *MockHomepageFavorites_AddFavorite_Call {
901+ _c.Call.Return(run)
902+ return _c
903+}
904+
905+// AddTag provides a mock function for the type MockHomepageFavorites
906+func (_mock *MockHomepageFavorites) AddTag(ctx context.Context, name string, color string) (*entity.Tag, error) {
907+ ret := _mock.Called(ctx, name, color)
908+
909+ if len(ret) == 0 {
910+ panic("no return value specified for AddTag")
911+ }
912+
913+ var r0 *entity.Tag
914+ var r1 error
915+ if returnFunc, ok := ret.Get(0).(func(context.Context, string, string) (*entity.Tag, error)); ok {
916+ return returnFunc(ctx, name, color)
917+ }
918+ if returnFunc, ok := ret.Get(0).(func(context.Context, string, string) *entity.Tag); ok {
919+ r0 = returnFunc(ctx, name, color)
920+ } else {
921+ if ret.Get(0) != nil {
922+ r0 = ret.Get(0).(*entity.Tag)
923+ }
924+ }
925+ if returnFunc, ok := ret.Get(1).(func(context.Context, string, string) error); ok {
926+ r1 = returnFunc(ctx, name, color)
927+ } else {
928+ r1 = ret.Error(1)
929+ }
930+ return r0, r1
931+}
932+
933+// MockHomepageFavorites_AddTag_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'AddTag'
934+type MockHomepageFavorites_AddTag_Call struct {
935+ *mock.Call
936+}
937+
938+// AddTag is a helper method to define mock.On call
939+// - ctx context.Context
940+// - name string
941+// - color string
942+func (_e *MockHomepageFavorites_Expecter) AddTag(ctx any, name any, color any) *MockHomepageFavorites_AddTag_Call {
943+ return &MockHomepageFavorites_AddTag_Call{Call: _e.mock.On("AddTag", ctx, name, color)}
944+}
945+
946+func (_c *MockHomepageFavorites_AddTag_Call) Run(run func(ctx context.Context, name string, color string)) *MockHomepageFavorites_AddTag_Call {
947+ _c.Call.Run(func(args mock.Arguments) {
948+ var arg0 context.Context
949+ if args[0] != nil {
950+ arg0 = args[0].(context.Context)
951+ }
952+ var arg1 string
953+ if args[1] != nil {
954+ arg1 = args[1].(string)
955+ }
956+ var arg2 string
957+ if args[2] != nil {
958+ arg2 = args[2].(string)
959+ }
960+ run(
961+ arg0,
962+ arg1,
963+ arg2,
964+ )
965+ })
966+ return _c
967+}
968+
969+func (_c *MockHomepageFavorites_AddTag_Call) Return(tag *entity.Tag, err error) *MockHomepageFavorites_AddTag_Call {
970+ _c.Call.Return(tag, err)
971+ return _c
972+}
973+
974+func (_c *MockHomepageFavorites_AddTag_Call) RunAndReturn(run func(ctx context.Context, name string, color string) (*entity.Tag, error)) *MockHomepageFavorites_AddTag_Call {
975+ _c.Call.Return(run)
976+ return _c
977+}
978+
979+// CreateFolder provides a mock function for the type MockHomepageFavorites
980+func (_mock *MockHomepageFavorites) CreateFolder(ctx context.Context, name string, icon string, parentID *entity.FolderID) (*entity.Folder, error) {
981+ ret := _mock.Called(ctx, name, icon, parentID)
982+
983+ if len(ret) == 0 {
984+ panic("no return value specified for CreateFolder")
985+ }
986+
987+ var r0 *entity.Folder
988+ var r1 error
989+ if returnFunc, ok := ret.Get(0).(func(context.Context, string, string, *entity.FolderID) (*entity.Folder, error)); ok {
990+ return returnFunc(ctx, name, icon, parentID)
991+ }
992+ if returnFunc, ok := ret.Get(0).(func(context.Context, string, string, *entity.FolderID) *entity.Folder); ok {
993+ r0 = returnFunc(ctx, name, icon, parentID)
994+ } else {
995+ if ret.Get(0) != nil {
996+ r0 = ret.Get(0).(*entity.Folder)
997+ }
998+ }
999+ if returnFunc, ok := ret.Get(1).(func(context.Context, string, string, *entity.FolderID) error); ok {
1000+ r1 = returnFunc(ctx, name, icon, parentID)
1001+ } else {
1002+ r1 = ret.Error(1)
1003+ }
1004+ return r0, r1
1005+}
1006+
1007+// MockHomepageFavorites_CreateFolder_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'CreateFolder'
1008+type MockHomepageFavorites_CreateFolder_Call struct {
1009+ *mock.Call
1010+}
1011+
1012+// CreateFolder is a helper method to define mock.On call
1013+// - ctx context.Context
1014+// - name string
1015+// - icon string
1016+// - parentID *entity.FolderID
1017+func (_e *MockHomepageFavorites_Expecter) CreateFolder(ctx any, name any, icon any, parentID any) *MockHomepageFavorites_CreateFolder_Call {
1018+ return &MockHomepageFavorites_CreateFolder_Call{Call: _e.mock.On("CreateFolder", ctx, name, icon, parentID)}
1019+}
1020+
1021+func (_c *MockHomepageFavorites_CreateFolder_Call) Run(run func(ctx context.Context, name string, icon string, parentID *entity.FolderID)) *MockHomepageFavorites_CreateFolder_Call {
1022+ _c.Call.Run(func(args mock.Arguments) {
1023+ var arg0 context.Context
1024+ if args[0] != nil {
1025+ arg0 = args[0].(context.Context)
1026+ }
1027+ var arg1 string
1028+ if args[1] != nil {
1029+ arg1 = args[1].(string)
1030+ }
1031+ var arg2 string
1032+ if args[2] != nil {
1033+ arg2 = args[2].(string)
1034+ }
1035+ var arg3 *entity.FolderID
1036+ if args[3] != nil {
1037+ arg3 = args[3].(*entity.FolderID)
1038+ }
1039+ run(
1040+ arg0,
1041+ arg1,
1042+ arg2,
1043+ arg3,
1044+ )
1045+ })
1046+ return _c
1047+}
1048+
1049+func (_c *MockHomepageFavorites_CreateFolder_Call) Return(folder *entity.Folder, err error) *MockHomepageFavorites_CreateFolder_Call {
1050+ _c.Call.Return(folder, err)
1051+ return _c
1052+}
1053+
1054+func (_c *MockHomepageFavorites_CreateFolder_Call) RunAndReturn(run func(ctx context.Context, name string, icon string, parentID *entity.FolderID) (*entity.Folder, error)) *MockHomepageFavorites_CreateFolder_Call {
1055+ _c.Call.Return(run)
1056+ return _c
1057+}
1058+
1059+// DeleteFavorite provides a mock function for the type MockHomepageFavorites
1060+func (_mock *MockHomepageFavorites) DeleteFavorite(ctx context.Context, id entity.FavoriteID) error {
1061+ ret := _mock.Called(ctx, id)
1062+
1063+ if len(ret) == 0 {
1064+ panic("no return value specified for DeleteFavorite")
1065+ }
1066+
1067+ var r0 error
1068+ if returnFunc, ok := ret.Get(0).(func(context.Context, entity.FavoriteID) error); ok {
1069+ r0 = returnFunc(ctx, id)
1070+ } else {
1071+ r0 = ret.Error(0)
1072+ }
1073+ return r0
1074+}
1075+
1076+// MockHomepageFavorites_DeleteFavorite_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'DeleteFavorite'
1077+type MockHomepageFavorites_DeleteFavorite_Call struct {
1078+ *mock.Call
1079+}
1080+
1081+// DeleteFavorite is a helper method to define mock.On call
1082+// - ctx context.Context
1083+// - id entity.FavoriteID
1084+func (_e *MockHomepageFavorites_Expecter) DeleteFavorite(ctx any, id any) *MockHomepageFavorites_DeleteFavorite_Call {
1085+ return &MockHomepageFavorites_DeleteFavorite_Call{Call: _e.mock.On("DeleteFavorite", ctx, id)}
1086+}
1087+
1088+func (_c *MockHomepageFavorites_DeleteFavorite_Call) Run(run func(ctx context.Context, id entity.FavoriteID)) *MockHomepageFavorites_DeleteFavorite_Call {
1089+ _c.Call.Run(func(args mock.Arguments) {
1090+ var arg0 context.Context
1091+ if args[0] != nil {
1092+ arg0 = args[0].(context.Context)
1093+ }
1094+ var arg1 entity.FavoriteID
1095+ if args[1] != nil {
1096+ arg1 = args[1].(entity.FavoriteID)
1097+ }
1098+ run(
1099+ arg0,
1100+ arg1,
1101+ )
1102+ })
1103+ return _c
1104+}
1105+
1106+func (_c *MockHomepageFavorites_DeleteFavorite_Call) Return(err error) *MockHomepageFavorites_DeleteFavorite_Call {
1107+ _c.Call.Return(err)
1108+ return _c
1109+}
1110+
1111+func (_c *MockHomepageFavorites_DeleteFavorite_Call) RunAndReturn(run func(ctx context.Context, id entity.FavoriteID) error) *MockHomepageFavorites_DeleteFavorite_Call {
1112+ _c.Call.Return(run)
1113+ return _c
1114+}
1115+
1116+// DeleteFolder provides a mock function for the type MockHomepageFavorites
1117+func (_mock *MockHomepageFavorites) DeleteFolder(ctx context.Context, id entity.FolderID) error {
1118+ ret := _mock.Called(ctx, id)
1119+
1120+ if len(ret) == 0 {
1121+ panic("no return value specified for DeleteFolder")
1122+ }
1123+
1124+ var r0 error
1125+ if returnFunc, ok := ret.Get(0).(func(context.Context, entity.FolderID) error); ok {
1126+ r0 = returnFunc(ctx, id)
1127+ } else {
1128+ r0 = ret.Error(0)
1129+ }
1130+ return r0
1131+}
1132+
1133+// MockHomepageFavorites_DeleteFolder_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'DeleteFolder'
1134+type MockHomepageFavorites_DeleteFolder_Call struct {
1135+ *mock.Call
1136+}
1137+
1138+// DeleteFolder is a helper method to define mock.On call
1139+// - ctx context.Context
1140+// - id entity.FolderID
1141+func (_e *MockHomepageFavorites_Expecter) DeleteFolder(ctx any, id any) *MockHomepageFavorites_DeleteFolder_Call {
1142+ return &MockHomepageFavorites_DeleteFolder_Call{Call: _e.mock.On("DeleteFolder", ctx, id)}
1143+}
1144+
1145+func (_c *MockHomepageFavorites_DeleteFolder_Call) Run(run func(ctx context.Context, id entity.FolderID)) *MockHomepageFavorites_DeleteFolder_Call {
1146+ _c.Call.Run(func(args mock.Arguments) {
1147+ var arg0 context.Context
1148+ if args[0] != nil {
1149+ arg0 = args[0].(context.Context)
1150+ }
1151+ var arg1 entity.FolderID
1152+ if args[1] != nil {
1153+ arg1 = args[1].(entity.FolderID)
1154+ }
1155+ run(
1156+ arg0,
1157+ arg1,
1158+ )
1159+ })
1160+ return _c
1161+}
1162+
1163+func (_c *MockHomepageFavorites_DeleteFolder_Call) Return(err error) *MockHomepageFavorites_DeleteFolder_Call {
1164+ _c.Call.Return(err)
1165+ return _c
1166+}
1167+
1168+func (_c *MockHomepageFavorites_DeleteFolder_Call) RunAndReturn(run func(ctx context.Context, id entity.FolderID) error) *MockHomepageFavorites_DeleteFolder_Call {
1169+ _c.Call.Return(run)
1170+ return _c
1171+}
1172+
1173+// DeleteTag provides a mock function for the type MockHomepageFavorites
1174+func (_mock *MockHomepageFavorites) DeleteTag(ctx context.Context, id entity.TagID) error {
1175+ ret := _mock.Called(ctx, id)
1176+
1177+ if len(ret) == 0 {
1178+ panic("no return value specified for DeleteTag")
1179+ }
1180+
1181+ var r0 error
1182+ if returnFunc, ok := ret.Get(0).(func(context.Context, entity.TagID) error); ok {
1183+ r0 = returnFunc(ctx, id)
1184+ } else {
1185+ r0 = ret.Error(0)
1186+ }
1187+ return r0
1188+}
1189+
1190+// MockHomepageFavorites_DeleteTag_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'DeleteTag'
1191+type MockHomepageFavorites_DeleteTag_Call struct {
1192+ *mock.Call
1193+}
1194+
1195+// DeleteTag is a helper method to define mock.On call
1196+// - ctx context.Context
1197+// - id entity.TagID
1198+func (_e *MockHomepageFavorites_Expecter) DeleteTag(ctx any, id any) *MockHomepageFavorites_DeleteTag_Call {
1199+ return &MockHomepageFavorites_DeleteTag_Call{Call: _e.mock.On("DeleteTag", ctx, id)}
1200+}
1201+
1202+func (_c *MockHomepageFavorites_DeleteTag_Call) Run(run func(ctx context.Context, id entity.TagID)) *MockHomepageFavorites_DeleteTag_Call {
1203+ _c.Call.Run(func(args mock.Arguments) {
1204+ var arg0 context.Context
1205+ if args[0] != nil {
1206+ arg0 = args[0].(context.Context)
1207+ }
1208+ var arg1 entity.TagID
1209+ if args[1] != nil {
1210+ arg1 = args[1].(entity.TagID)
1211+ }
1212+ run(
1213+ arg0,
1214+ arg1,
1215+ )
1216+ })
1217+ return _c
1218+}
1219+
1220+func (_c *MockHomepageFavorites_DeleteTag_Call) Return(err error) *MockHomepageFavorites_DeleteTag_Call {
1221+ _c.Call.Return(err)
1222+ return _c
1223+}
1224+
1225+func (_c *MockHomepageFavorites_DeleteTag_Call) RunAndReturn(run func(ctx context.Context, id entity.TagID) error) *MockHomepageFavorites_DeleteTag_Call {
1226+ _c.Call.Return(run)
1227+ return _c
1228+}
1229+
1230+// GetAll provides a mock function for the type MockHomepageFavorites
1231+func (_mock *MockHomepageFavorites) GetAll(ctx context.Context) ([]*entity.Favorite, error) {
1232+ ret := _mock.Called(ctx)
1233+
1234+ if len(ret) == 0 {
1235+ panic("no return value specified for GetAll")
1236+ }
1237+
1238+ var r0 []*entity.Favorite
1239+ var r1 error
1240+ if returnFunc, ok := ret.Get(0).(func(context.Context) ([]*entity.Favorite, error)); ok {
1241+ return returnFunc(ctx)
1242+ }
1243+ if returnFunc, ok := ret.Get(0).(func(context.Context) []*entity.Favorite); ok {
1244+ r0 = returnFunc(ctx)
1245+ } else {
1246+ if ret.Get(0) != nil {
1247+ r0 = ret.Get(0).([]*entity.Favorite)
1248+ }
1249+ }
1250+ if returnFunc, ok := ret.Get(1).(func(context.Context) error); ok {
1251+ r1 = returnFunc(ctx)
1252+ } else {
1253+ r1 = ret.Error(1)
1254+ }
1255+ return r0, r1
1256+}
1257+
1258+// MockHomepageFavorites_GetAll_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetAll'
1259+type MockHomepageFavorites_GetAll_Call struct {
1260+ *mock.Call
1261+}
1262+
1263+// GetAll is a helper method to define mock.On call
1264+// - ctx context.Context
1265+func (_e *MockHomepageFavorites_Expecter) GetAll(ctx any) *MockHomepageFavorites_GetAll_Call {
1266+ return &MockHomepageFavorites_GetAll_Call{Call: _e.mock.On("GetAll", ctx)}
1267+}
1268+
1269+func (_c *MockHomepageFavorites_GetAll_Call) Run(run func(ctx context.Context)) *MockHomepageFavorites_GetAll_Call {
1270+ _c.Call.Run(func(args mock.Arguments) {
1271+ var arg0 context.Context
1272+ if args[0] != nil {
1273+ arg0 = args[0].(context.Context)
1274+ }
1275+ run(
1276+ arg0,
1277+ )
1278+ })
1279+ return _c
1280+}
1281+
1282+func (_c *MockHomepageFavorites_GetAll_Call) Return(favorites []*entity.Favorite, err error) *MockHomepageFavorites_GetAll_Call {
1283+ _c.Call.Return(favorites, err)
1284+ return _c
1285+}
1286+
1287+func (_c *MockHomepageFavorites_GetAll_Call) RunAndReturn(run func(ctx context.Context) ([]*entity.Favorite, error)) *MockHomepageFavorites_GetAll_Call {
1288+ _c.Call.Return(run)
1289+ return _c
1290+}
1291+
1292+// GetAllFolders provides a mock function for the type MockHomepageFavorites
1293+func (_mock *MockHomepageFavorites) GetAllFolders(ctx context.Context) ([]*entity.Folder, error) {
1294+ ret := _mock.Called(ctx)
1295+
1296+ if len(ret) == 0 {
1297+ panic("no return value specified for GetAllFolders")
1298+ }
1299+
1300+ var r0 []*entity.Folder
1301+ var r1 error
1302+ if returnFunc, ok := ret.Get(0).(func(context.Context) ([]*entity.Folder, error)); ok {
1303+ return returnFunc(ctx)
1304+ }
1305+ if returnFunc, ok := ret.Get(0).(func(context.Context) []*entity.Folder); ok {
1306+ r0 = returnFunc(ctx)
1307+ } else {
1308+ if ret.Get(0) != nil {
1309+ r0 = ret.Get(0).([]*entity.Folder)
1310+ }
1311+ }
1312+ if returnFunc, ok := ret.Get(1).(func(context.Context) error); ok {
1313+ r1 = returnFunc(ctx)
1314+ } else {
1315+ r1 = ret.Error(1)
1316+ }
1317+ return r0, r1
1318+}
1319+
1320+// MockHomepageFavorites_GetAllFolders_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetAllFolders'
1321+type MockHomepageFavorites_GetAllFolders_Call struct {
1322+ *mock.Call
1323+}
1324+
1325+// GetAllFolders is a helper method to define mock.On call
1326+// - ctx context.Context
1327+func (_e *MockHomepageFavorites_Expecter) GetAllFolders(ctx any) *MockHomepageFavorites_GetAllFolders_Call {
1328+ return &MockHomepageFavorites_GetAllFolders_Call{Call: _e.mock.On("GetAllFolders", ctx)}
1329+}
1330+
1331+func (_c *MockHomepageFavorites_GetAllFolders_Call) Run(run func(ctx context.Context)) *MockHomepageFavorites_GetAllFolders_Call {
1332+ _c.Call.Run(func(args mock.Arguments) {
1333+ var arg0 context.Context
1334+ if args[0] != nil {
1335+ arg0 = args[0].(context.Context)
1336+ }
1337+ run(
1338+ arg0,
1339+ )
1340+ })
1341+ return _c
1342+}
1343+
1344+func (_c *MockHomepageFavorites_GetAllFolders_Call) Return(folders []*entity.Folder, err error) *MockHomepageFavorites_GetAllFolders_Call {
1345+ _c.Call.Return(folders, err)
1346+ return _c
1347+}
1348+
1349+func (_c *MockHomepageFavorites_GetAllFolders_Call) RunAndReturn(run func(ctx context.Context) ([]*entity.Folder, error)) *MockHomepageFavorites_GetAllFolders_Call {
1350+ _c.Call.Return(run)
1351+ return _c
1352+}
1353+
1354+// GetAllTags provides a mock function for the type MockHomepageFavorites
1355+func (_mock *MockHomepageFavorites) GetAllTags(ctx context.Context) ([]*entity.Tag, error) {
1356+ ret := _mock.Called(ctx)
1357+
1358+ if len(ret) == 0 {
1359+ panic("no return value specified for GetAllTags")
1360+ }
1361+
1362+ var r0 []*entity.Tag
1363+ var r1 error
1364+ if returnFunc, ok := ret.Get(0).(func(context.Context) ([]*entity.Tag, error)); ok {
1365+ return returnFunc(ctx)
1366+ }
1367+ if returnFunc, ok := ret.Get(0).(func(context.Context) []*entity.Tag); ok {
1368+ r0 = returnFunc(ctx)
1369+ } else {
1370+ if ret.Get(0) != nil {
1371+ r0 = ret.Get(0).([]*entity.Tag)
1372+ }
1373+ }
1374+ if returnFunc, ok := ret.Get(1).(func(context.Context) error); ok {
1375+ r1 = returnFunc(ctx)
1376+ } else {
1377+ r1 = ret.Error(1)
1378+ }
1379+ return r0, r1
1380+}
1381+
1382+// MockHomepageFavorites_GetAllTags_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetAllTags'
1383+type MockHomepageFavorites_GetAllTags_Call struct {
1384+ *mock.Call
1385+}
1386+
1387+// GetAllTags is a helper method to define mock.On call
1388+// - ctx context.Context
1389+func (_e *MockHomepageFavorites_Expecter) GetAllTags(ctx any) *MockHomepageFavorites_GetAllTags_Call {
1390+ return &MockHomepageFavorites_GetAllTags_Call{Call: _e.mock.On("GetAllTags", ctx)}
1391+}
1392+
1393+func (_c *MockHomepageFavorites_GetAllTags_Call) Run(run func(ctx context.Context)) *MockHomepageFavorites_GetAllTags_Call {
1394+ _c.Call.Run(func(args mock.Arguments) {
1395+ var arg0 context.Context
1396+ if args[0] != nil {
1397+ arg0 = args[0].(context.Context)
1398+ }
1399+ run(
1400+ arg0,
1401+ )
1402+ })
1403+ return _c
1404+}
1405+
1406+func (_c *MockHomepageFavorites_GetAllTags_Call) Return(tags []*entity.Tag, err error) *MockHomepageFavorites_GetAllTags_Call {
1407+ _c.Call.Return(tags, err)
1408+ return _c
1409+}
1410+
1411+func (_c *MockHomepageFavorites_GetAllTags_Call) RunAndReturn(run func(ctx context.Context) ([]*entity.Tag, error)) *MockHomepageFavorites_GetAllTags_Call {
1412+ _c.Call.Return(run)
1413+ return _c
1414+}
1415+
1416+// GetByShortcut provides a mock function for the type MockHomepageFavorites
1417+func (_mock *MockHomepageFavorites) GetByShortcut(ctx context.Context, key int) (*entity.Favorite, error) {
1418+ ret := _mock.Called(ctx, key)
1419+
1420+ if len(ret) == 0 {
1421+ panic("no return value specified for GetByShortcut")
1422+ }
1423+
1424+ var r0 *entity.Favorite
1425+ var r1 error
1426+ if returnFunc, ok := ret.Get(0).(func(context.Context, int) (*entity.Favorite, error)); ok {
1427+ return returnFunc(ctx, key)
1428+ }
1429+ if returnFunc, ok := ret.Get(0).(func(context.Context, int) *entity.Favorite); ok {
1430+ r0 = returnFunc(ctx, key)
1431+ } else {
1432+ if ret.Get(0) != nil {
1433+ r0 = ret.Get(0).(*entity.Favorite)
1434+ }
1435+ }
1436+ if returnFunc, ok := ret.Get(1).(func(context.Context, int) error); ok {
1437+ r1 = returnFunc(ctx, key)
1438+ } else {
1439+ r1 = ret.Error(1)
1440+ }
1441+ return r0, r1
1442+}
1443+
1444+// MockHomepageFavorites_GetByShortcut_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetByShortcut'
1445+type MockHomepageFavorites_GetByShortcut_Call struct {
1446+ *mock.Call
1447+}
1448+
1449+// GetByShortcut is a helper method to define mock.On call
1450+// - ctx context.Context
1451+// - key int
1452+func (_e *MockHomepageFavorites_Expecter) GetByShortcut(ctx any, key any) *MockHomepageFavorites_GetByShortcut_Call {
1453+ return &MockHomepageFavorites_GetByShortcut_Call{Call: _e.mock.On("GetByShortcut", ctx, key)}
1454+}
1455+
1456+func (_c *MockHomepageFavorites_GetByShortcut_Call) Run(run func(ctx context.Context, key int)) *MockHomepageFavorites_GetByShortcut_Call {
1457+ _c.Call.Run(func(args mock.Arguments) {
1458+ var arg0 context.Context
1459+ if args[0] != nil {
1460+ arg0 = args[0].(context.Context)
1461+ }
1462+ var arg1 int
1463+ if args[1] != nil {
1464+ arg1 = args[1].(int)
1465+ }
1466+ run(
1467+ arg0,
1468+ arg1,
1469+ )
1470+ })
1471+ return _c
1472+}
1473+
1474+func (_c *MockHomepageFavorites_GetByShortcut_Call) Return(favorite *entity.Favorite, err error) *MockHomepageFavorites_GetByShortcut_Call {
1475+ _c.Call.Return(favorite, err)
1476+ return _c
1477+}
1478+
1479+func (_c *MockHomepageFavorites_GetByShortcut_Call) RunAndReturn(run func(ctx context.Context, key int) (*entity.Favorite, error)) *MockHomepageFavorites_GetByShortcut_Call {
1480+ _c.Call.Return(run)
1481+ return _c
1482+}
1483+
1484+// Move provides a mock function for the type MockHomepageFavorites
1485+func (_mock *MockHomepageFavorites) Move(ctx context.Context, id entity.FavoriteID, folderID *entity.FolderID) error {
1486+ ret := _mock.Called(ctx, id, folderID)
1487+
1488+ if len(ret) == 0 {
1489+ panic("no return value specified for Move")
1490+ }
1491+
1492+ var r0 error
1493+ if returnFunc, ok := ret.Get(0).(func(context.Context, entity.FavoriteID, *entity.FolderID) error); ok {
1494+ r0 = returnFunc(ctx, id, folderID)
1495+ } else {
1496+ r0 = ret.Error(0)
1497+ }
1498+ return r0
1499+}
1500+
1501+// MockHomepageFavorites_Move_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Move'
1502+type MockHomepageFavorites_Move_Call struct {
1503+ *mock.Call
1504+}
1505+
1506+// Move is a helper method to define mock.On call
1507+// - ctx context.Context
1508+// - id entity.FavoriteID
1509+// - folderID *entity.FolderID
1510+func (_e *MockHomepageFavorites_Expecter) Move(ctx any, id any, folderID any) *MockHomepageFavorites_Move_Call {
1511+ return &MockHomepageFavorites_Move_Call{Call: _e.mock.On("Move", ctx, id, folderID)}
1512+}
1513+
1514+func (_c *MockHomepageFavorites_Move_Call) Run(run func(ctx context.Context, id entity.FavoriteID, folderID *entity.FolderID)) *MockHomepageFavorites_Move_Call {
1515+ _c.Call.Run(func(args mock.Arguments) {
1516+ var arg0 context.Context
1517+ if args[0] != nil {
1518+ arg0 = args[0].(context.Context)
1519+ }
1520+ var arg1 entity.FavoriteID
1521+ if args[1] != nil {
1522+ arg1 = args[1].(entity.FavoriteID)
1523+ }
1524+ var arg2 *entity.FolderID
1525+ if args[2] != nil {
1526+ arg2 = args[2].(*entity.FolderID)
1527+ }
1528+ run(
1529+ arg0,
1530+ arg1,
1531+ arg2,
1532+ )
1533+ })
1534+ return _c
1535+}
1536+
1537+func (_c *MockHomepageFavorites_Move_Call) Return(err error) *MockHomepageFavorites_Move_Call {
1538+ _c.Call.Return(err)
1539+ return _c
1540+}
1541+
1542+func (_c *MockHomepageFavorites_Move_Call) RunAndReturn(run func(ctx context.Context, id entity.FavoriteID, folderID *entity.FolderID) error) *MockHomepageFavorites_Move_Call {
1543+ _c.Call.Return(run)
1544+ return _c
1545+}
1546+
1547+// SetShortcut provides a mock function for the type MockHomepageFavorites
1548+func (_mock *MockHomepageFavorites) SetShortcut(ctx context.Context, id entity.FavoriteID, key *int) error {
1549+ ret := _mock.Called(ctx, id, key)
1550+
1551+ if len(ret) == 0 {
1552+ panic("no return value specified for SetShortcut")
1553+ }
1554+
1555+ var r0 error
1556+ if returnFunc, ok := ret.Get(0).(func(context.Context, entity.FavoriteID, *int) error); ok {
1557+ r0 = returnFunc(ctx, id, key)
1558+ } else {
1559+ r0 = ret.Error(0)
1560+ }
1561+ return r0
1562+}
1563+
1564+// MockHomepageFavorites_SetShortcut_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'SetShortcut'
1565+type MockHomepageFavorites_SetShortcut_Call struct {
1566+ *mock.Call
1567+}
1568+
1569+// SetShortcut is a helper method to define mock.On call
1570+// - ctx context.Context
1571+// - id entity.FavoriteID
1572+// - key *int
1573+func (_e *MockHomepageFavorites_Expecter) SetShortcut(ctx any, id any, key any) *MockHomepageFavorites_SetShortcut_Call {
1574+ return &MockHomepageFavorites_SetShortcut_Call{Call: _e.mock.On("SetShortcut", ctx, id, key)}
1575+}
1576+
1577+func (_c *MockHomepageFavorites_SetShortcut_Call) Run(run func(ctx context.Context, id entity.FavoriteID, key *int)) *MockHomepageFavorites_SetShortcut_Call {
1578+ _c.Call.Run(func(args mock.Arguments) {
1579+ var arg0 context.Context
1580+ if args[0] != nil {
1581+ arg0 = args[0].(context.Context)
1582+ }
1583+ var arg1 entity.FavoriteID
1584+ if args[1] != nil {
1585+ arg1 = args[1].(entity.FavoriteID)
1586+ }
1587+ var arg2 *int
1588+ if args[2] != nil {
1589+ arg2 = args[2].(*int)
1590+ }
1591+ run(
1592+ arg0,
1593+ arg1,
1594+ arg2,
1595+ )
1596+ })
1597+ return _c
1598+}
1599+
1600+func (_c *MockHomepageFavorites_SetShortcut_Call) Return(err error) *MockHomepageFavorites_SetShortcut_Call {
1601+ _c.Call.Return(err)
1602+ return _c
1603+}
1604+
1605+func (_c *MockHomepageFavorites_SetShortcut_Call) RunAndReturn(run func(ctx context.Context, id entity.FavoriteID, key *int) error) *MockHomepageFavorites_SetShortcut_Call {
1606+ _c.Call.Return(run)
1607+ return _c
1608+}
1609+
1610+// TagFavorite provides a mock function for the type MockHomepageFavorites
1611+func (_mock *MockHomepageFavorites) TagFavorite(ctx context.Context, favID entity.FavoriteID, tagID entity.TagID) error {
1612+ ret := _mock.Called(ctx, favID, tagID)
1613+
1614+ if len(ret) == 0 {
1615+ panic("no return value specified for TagFavorite")
1616+ }
1617+
1618+ var r0 error
1619+ if returnFunc, ok := ret.Get(0).(func(context.Context, entity.FavoriteID, entity.TagID) error); ok {
1620+ r0 = returnFunc(ctx, favID, tagID)
1621+ } else {
1622+ r0 = ret.Error(0)
1623+ }
1624+ return r0
1625+}
1626+
1627+// MockHomepageFavorites_TagFavorite_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'TagFavorite'
1628+type MockHomepageFavorites_TagFavorite_Call struct {
1629+ *mock.Call
1630+}
1631+
1632+// TagFavorite is a helper method to define mock.On call
1633+// - ctx context.Context
1634+// - favID entity.FavoriteID
1635+// - tagID entity.TagID
1636+func (_e *MockHomepageFavorites_Expecter) TagFavorite(ctx any, favID any, tagID any) *MockHomepageFavorites_TagFavorite_Call {
1637+ return &MockHomepageFavorites_TagFavorite_Call{Call: _e.mock.On("TagFavorite", ctx, favID, tagID)}
1638+}
1639+
1640+func (_c *MockHomepageFavorites_TagFavorite_Call) Run(run func(ctx context.Context, favID entity.FavoriteID, tagID entity.TagID)) *MockHomepageFavorites_TagFavorite_Call {
1641+ _c.Call.Run(func(args mock.Arguments) {
1642+ var arg0 context.Context
1643+ if args[0] != nil {
1644+ arg0 = args[0].(context.Context)
1645+ }
1646+ var arg1 entity.FavoriteID
1647+ if args[1] != nil {
1648+ arg1 = args[1].(entity.FavoriteID)
1649+ }
1650+ var arg2 entity.TagID
1651+ if args[2] != nil {
1652+ arg2 = args[2].(entity.TagID)
1653+ }
1654+ run(
1655+ arg0,
1656+ arg1,
1657+ arg2,
1658+ )
1659+ })
1660+ return _c
1661+}
1662+
1663+func (_c *MockHomepageFavorites_TagFavorite_Call) Return(err error) *MockHomepageFavorites_TagFavorite_Call {
1664+ _c.Call.Return(err)
1665+ return _c
1666+}
1667+
1668+func (_c *MockHomepageFavorites_TagFavorite_Call) RunAndReturn(run func(ctx context.Context, favID entity.FavoriteID, tagID entity.TagID) error) *MockHomepageFavorites_TagFavorite_Call {
1669+ _c.Call.Return(run)
1670+ return _c
1671+}
1672+
1673+// UntagFavorite provides a mock function for the type MockHomepageFavorites
1674+func (_mock *MockHomepageFavorites) UntagFavorite(ctx context.Context, favID entity.FavoriteID, tagID entity.TagID) error {
1675+ ret := _mock.Called(ctx, favID, tagID)
1676+
1677+ if len(ret) == 0 {
1678+ panic("no return value specified for UntagFavorite")
1679+ }
1680+
1681+ var r0 error
1682+ if returnFunc, ok := ret.Get(0).(func(context.Context, entity.FavoriteID, entity.TagID) error); ok {
1683+ r0 = returnFunc(ctx, favID, tagID)
1684+ } else {
1685+ r0 = ret.Error(0)
1686+ }
1687+ return r0
1688+}
1689+
1690+// MockHomepageFavorites_UntagFavorite_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UntagFavorite'
1691+type MockHomepageFavorites_UntagFavorite_Call struct {
1692+ *mock.Call
1693+}
1694+
1695+// UntagFavorite is a helper method to define mock.On call
1696+// - ctx context.Context
1697+// - favID entity.FavoriteID
1698+// - tagID entity.TagID
1699+func (_e *MockHomepageFavorites_Expecter) UntagFavorite(ctx any, favID any, tagID any) *MockHomepageFavorites_UntagFavorite_Call {
1700+ return &MockHomepageFavorites_UntagFavorite_Call{Call: _e.mock.On("UntagFavorite", ctx, favID, tagID)}
1701+}
1702+
1703+func (_c *MockHomepageFavorites_UntagFavorite_Call) Run(run func(ctx context.Context, favID entity.FavoriteID, tagID entity.TagID)) *MockHomepageFavorites_UntagFavorite_Call {
1704+ _c.Call.Run(func(args mock.Arguments) {
1705+ var arg0 context.Context
1706+ if args[0] != nil {
1707+ arg0 = args[0].(context.Context)
1708+ }
1709+ var arg1 entity.FavoriteID
1710+ if args[1] != nil {
1711+ arg1 = args[1].(entity.FavoriteID)
1712+ }
1713+ var arg2 entity.TagID
1714+ if args[2] != nil {
1715+ arg2 = args[2].(entity.TagID)
1716+ }
1717+ run(
1718+ arg0,
1719+ arg1,
1720+ arg2,
1721+ )
1722+ })
1723+ return _c
1724+}
1725+
1726+func (_c *MockHomepageFavorites_UntagFavorite_Call) Return(err error) *MockHomepageFavorites_UntagFavorite_Call {
1727+ _c.Call.Return(err)
1728+ return _c
1729+}
1730+
1731+func (_c *MockHomepageFavorites_UntagFavorite_Call) RunAndReturn(run func(ctx context.Context, favID entity.FavoriteID, tagID entity.TagID) error) *MockHomepageFavorites_UntagFavorite_Call {
1732+ _c.Call.Return(run)
1733+ return _c
1734+}
1735+
1736+// UpdateFavorite provides a mock function for the type MockHomepageFavorites
1737+func (_mock *MockHomepageFavorites) UpdateFavorite(ctx context.Context, input dto.FavoriteUpdateInput) (*entity.Favorite, error) {
1738+ ret := _mock.Called(ctx, input)
1739+
1740+ if len(ret) == 0 {
1741+ panic("no return value specified for UpdateFavorite")
1742+ }
1743+
1744+ var r0 *entity.Favorite
1745+ var r1 error
1746+ if returnFunc, ok := ret.Get(0).(func(context.Context, dto.FavoriteUpdateInput) (*entity.Favorite, error)); ok {
1747+ return returnFunc(ctx, input)
1748+ }
1749+ if returnFunc, ok := ret.Get(0).(func(context.Context, dto.FavoriteUpdateInput) *entity.Favorite); ok {
1750+ r0 = returnFunc(ctx, input)
1751+ } else {
1752+ if ret.Get(0) != nil {
1753+ r0 = ret.Get(0).(*entity.Favorite)
1754+ }
1755+ }
1756+ if returnFunc, ok := ret.Get(1).(func(context.Context, dto.FavoriteUpdateInput) error); ok {
1757+ r1 = returnFunc(ctx, input)
1758+ } else {
1759+ r1 = ret.Error(1)
1760+ }
1761+ return r0, r1
1762+}
1763+
1764+// MockHomepageFavorites_UpdateFavorite_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UpdateFavorite'
1765+type MockHomepageFavorites_UpdateFavorite_Call struct {
1766+ *mock.Call
1767+}
1768+
1769+// UpdateFavorite is a helper method to define mock.On call
1770+// - ctx context.Context
1771+// - input dto.FavoriteUpdateInput
1772+func (_e *MockHomepageFavorites_Expecter) UpdateFavorite(ctx any, input any) *MockHomepageFavorites_UpdateFavorite_Call {
1773+ return &MockHomepageFavorites_UpdateFavorite_Call{Call: _e.mock.On("UpdateFavorite", ctx, input)}
1774+}
1775+
1776+func (_c *MockHomepageFavorites_UpdateFavorite_Call) Run(run func(ctx context.Context, input dto.FavoriteUpdateInput)) *MockHomepageFavorites_UpdateFavorite_Call {
1777+ _c.Call.Run(func(args mock.Arguments) {
1778+ var arg0 context.Context
1779+ if args[0] != nil {
1780+ arg0 = args[0].(context.Context)
1781+ }
1782+ var arg1 dto.FavoriteUpdateInput
1783+ if args[1] != nil {
1784+ arg1 = args[1].(dto.FavoriteUpdateInput)
1785+ }
1786+ run(
1787+ arg0,
1788+ arg1,
1789+ )
1790+ })
1791+ return _c
1792+}
1793+
1794+func (_c *MockHomepageFavorites_UpdateFavorite_Call) Return(favorite *entity.Favorite, err error) *MockHomepageFavorites_UpdateFavorite_Call {
1795+ _c.Call.Return(favorite, err)
1796+ return _c
1797+}
1798+
1799+func (_c *MockHomepageFavorites_UpdateFavorite_Call) RunAndReturn(run func(ctx context.Context, input dto.FavoriteUpdateInput) (*entity.Favorite, error)) *MockHomepageFavorites_UpdateFavorite_Call {
1800+ _c.Call.Return(run)
1801+ return _c
1802+}
1803+
1804+// UpdateFolder provides a mock function for the type MockHomepageFavorites
1805+func (_mock *MockHomepageFavorites) UpdateFolder(ctx context.Context, id entity.FolderID, name string, icon string) error {
1806+ ret := _mock.Called(ctx, id, name, icon)
1807+
1808+ if len(ret) == 0 {
1809+ panic("no return value specified for UpdateFolder")
1810+ }
1811+
1812+ var r0 error
1813+ if returnFunc, ok := ret.Get(0).(func(context.Context, entity.FolderID, string, string) error); ok {
1814+ r0 = returnFunc(ctx, id, name, icon)
1815+ } else {
1816+ r0 = ret.Error(0)
1817+ }
1818+ return r0
1819+}
1820+
1821+// MockHomepageFavorites_UpdateFolder_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UpdateFolder'
1822+type MockHomepageFavorites_UpdateFolder_Call struct {
1823+ *mock.Call
1824+}
1825+
1826+// UpdateFolder is a helper method to define mock.On call
1827+// - ctx context.Context
1828+// - id entity.FolderID
1829+// - name string
1830+// - icon string
1831+func (_e *MockHomepageFavorites_Expecter) UpdateFolder(ctx any, id any, name any, icon any) *MockHomepageFavorites_UpdateFolder_Call {
1832+ return &MockHomepageFavorites_UpdateFolder_Call{Call: _e.mock.On("UpdateFolder", ctx, id, name, icon)}
1833+}
1834+
1835+func (_c *MockHomepageFavorites_UpdateFolder_Call) Run(run func(ctx context.Context, id entity.FolderID, name string, icon string)) *MockHomepageFavorites_UpdateFolder_Call {
1836+ _c.Call.Run(func(args mock.Arguments) {
1837+ var arg0 context.Context
1838+ if args[0] != nil {
1839+ arg0 = args[0].(context.Context)
1840+ }
1841+ var arg1 entity.FolderID
1842+ if args[1] != nil {
1843+ arg1 = args[1].(entity.FolderID)
1844+ }
1845+ var arg2 string
1846+ if args[2] != nil {
1847+ arg2 = args[2].(string)
1848+ }
1849+ var arg3 string
1850+ if args[3] != nil {
1851+ arg3 = args[3].(string)
1852+ }
1853+ run(
1854+ arg0,
1855+ arg1,
1856+ arg2,
1857+ arg3,
1858+ )
1859+ })
1860+ return _c
1861+}
1862+
1863+func (_c *MockHomepageFavorites_UpdateFolder_Call) Return(err error) *MockHomepageFavorites_UpdateFolder_Call {
1864+ _c.Call.Return(err)
1865+ return _c
1866+}
1867+
1868+func (_c *MockHomepageFavorites_UpdateFolder_Call) RunAndReturn(run func(ctx context.Context, id entity.FolderID, name string, icon string) error) *MockHomepageFavorites_UpdateFolder_Call {
1869+ _c.Call.Return(run)
1870+ return _c
1871+}
1872+
1873+// UpdateTag provides a mock function for the type MockHomepageFavorites
1874+func (_mock *MockHomepageFavorites) UpdateTag(ctx context.Context, id entity.TagID, name string, color string) error {
1875+ ret := _mock.Called(ctx, id, name, color)
1876+
1877+ if len(ret) == 0 {
1878+ panic("no return value specified for UpdateTag")
1879+ }
1880+
1881+ var r0 error
1882+ if returnFunc, ok := ret.Get(0).(func(context.Context, entity.TagID, string, string) error); ok {
1883+ r0 = returnFunc(ctx, id, name, color)
1884+ } else {
1885+ r0 = ret.Error(0)
1886+ }
1887+ return r0
1888+}
1889+
1890+// MockHomepageFavorites_UpdateTag_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UpdateTag'
1891+type MockHomepageFavorites_UpdateTag_Call struct {
1892+ *mock.Call
1893+}
1894+
1895+// UpdateTag is a helper method to define mock.On call
1896+// - ctx context.Context
1897+// - id entity.TagID
1898+// - name string
1899+// - color string
1900+func (_e *MockHomepageFavorites_Expecter) UpdateTag(ctx any, id any, name any, color any) *MockHomepageFavorites_UpdateTag_Call {
1901+ return &MockHomepageFavorites_UpdateTag_Call{Call: _e.mock.On("UpdateTag", ctx, id, name, color)}
1902+}
1903+
1904+func (_c *MockHomepageFavorites_UpdateTag_Call) Run(run func(ctx context.Context, id entity.TagID, name string, color string)) *MockHomepageFavorites_UpdateTag_Call {
1905+ _c.Call.Run(func(args mock.Arguments) {
1906+ var arg0 context.Context
1907+ if args[0] != nil {
1908+ arg0 = args[0].(context.Context)
1909+ }
1910+ var arg1 entity.TagID
1911+ if args[1] != nil {
1912+ arg1 = args[1].(entity.TagID)
1913+ }
1914+ var arg2 string
1915+ if args[2] != nil {
1916+ arg2 = args[2].(string)
1917+ }
1918+ var arg3 string
1919+ if args[3] != nil {
1920+ arg3 = args[3].(string)
1921+ }
1922+ run(
1923+ arg0,
1924+ arg1,
1925+ arg2,
1926+ arg3,
1927+ )
1928+ })
1929+ return _c
1930+}
1931+
1932+func (_c *MockHomepageFavorites_UpdateTag_Call) Return(err error) *MockHomepageFavorites_UpdateTag_Call {
1933+ _c.Call.Return(err)
1934+ return _c
1935+}
1936+
1937+func (_c *MockHomepageFavorites_UpdateTag_Call) RunAndReturn(run func(ctx context.Context, id entity.TagID, name string, color string) error) *MockHomepageFavorites_UpdateTag_Call {
1938+ _c.Call.Return(run)
1939+ return _c
1940+}
A internal/application/port/mocks/idle_inhibit.go +234 -0
@@ -0,0 +1,234 @@
1+// Code generated by mockery; DO NOT EDIT.
2+// github.com/vektra/mockery
3+// template: testify
4+
5+package mocks
6+
7+import (
8+ "context"
9+
10+ mock "github.com/stretchr/testify/mock"
11+)
12+
13+// NewMockIdleInhibitor creates a new instance of MockIdleInhibitor. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
14+// The first argument is typically a *testing.T value.
15+func NewMockIdleInhibitor(t interface {
16+ mock.TestingT
17+ Cleanup(func())
18+}) *MockIdleInhibitor {
19+ mock := &MockIdleInhibitor{}
20+ mock.Mock.Test(t)
21+
22+ t.Cleanup(func() { mock.AssertExpectations(t) })
23+
24+ return mock
25+}
26+
27+// MockIdleInhibitor is an autogenerated mock type for the IdleInhibitor type
28+type MockIdleInhibitor struct {
29+ mock.Mock
30+}
31+
32+type MockIdleInhibitor_Expecter struct {
33+ mock *mock.Mock
34+}
35+
36+func (_m *MockIdleInhibitor) EXPECT() *MockIdleInhibitor_Expecter {
37+ return &MockIdleInhibitor_Expecter{mock: &_m.Mock}
38+}
39+
40+// Close provides a mock function for the type MockIdleInhibitor
41+func (_mock *MockIdleInhibitor) Close() error {
42+ ret := _mock.Called()
43+
44+ if len(ret) == 0 {
45+ panic("no return value specified for Close")
46+ }
47+
48+ var r0 error
49+ if returnFunc, ok := ret.Get(0).(func() error); ok {
50+ r0 = returnFunc()
51+ } else {
52+ r0 = ret.Error(0)
53+ }
54+ return r0
55+}
56+
57+// MockIdleInhibitor_Close_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Close'
58+type MockIdleInhibitor_Close_Call struct {
59+ *mock.Call
60+}
61+
62+// Close is a helper method to define mock.On call
63+func (_e *MockIdleInhibitor_Expecter) Close() *MockIdleInhibitor_Close_Call {
64+ return &MockIdleInhibitor_Close_Call{Call: _e.mock.On("Close")}
65+}
66+
67+func (_c *MockIdleInhibitor_Close_Call) Run(run func()) *MockIdleInhibitor_Close_Call {
68+ _c.Call.Run(func(args mock.Arguments) {
69+ run()
70+ })
71+ return _c
72+}
73+
74+func (_c *MockIdleInhibitor_Close_Call) Return(err error) *MockIdleInhibitor_Close_Call {
75+ _c.Call.Return(err)
76+ return _c
77+}
78+
79+func (_c *MockIdleInhibitor_Close_Call) RunAndReturn(run func() error) *MockIdleInhibitor_Close_Call {
80+ _c.Call.Return(run)
81+ return _c
82+}
83+
84+// Inhibit provides a mock function for the type MockIdleInhibitor
85+func (_mock *MockIdleInhibitor) Inhibit(ctx context.Context, reason string) error {
86+ ret := _mock.Called(ctx, reason)
87+
88+ if len(ret) == 0 {
89+ panic("no return value specified for Inhibit")
90+ }
91+
92+ var r0 error
93+ if returnFunc, ok := ret.Get(0).(func(context.Context, string) error); ok {
94+ r0 = returnFunc(ctx, reason)
95+ } else {
96+ r0 = ret.Error(0)
97+ }
98+ return r0
99+}
100+
101+// MockIdleInhibitor_Inhibit_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Inhibit'
102+type MockIdleInhibitor_Inhibit_Call struct {
103+ *mock.Call
104+}
105+
106+// Inhibit is a helper method to define mock.On call
107+// - ctx context.Context
108+// - reason string
109+func (_e *MockIdleInhibitor_Expecter) Inhibit(ctx any, reason any) *MockIdleInhibitor_Inhibit_Call {
110+ return &MockIdleInhibitor_Inhibit_Call{Call: _e.mock.On("Inhibit", ctx, reason)}
111+}
112+
113+func (_c *MockIdleInhibitor_Inhibit_Call) Run(run func(ctx context.Context, reason string)) *MockIdleInhibitor_Inhibit_Call {
114+ _c.Call.Run(func(args mock.Arguments) {
115+ var arg0 context.Context
116+ if args[0] != nil {
117+ arg0 = args[0].(context.Context)
118+ }
119+ var arg1 string
120+ if args[1] != nil {
121+ arg1 = args[1].(string)
122+ }
123+ run(
124+ arg0,
125+ arg1,
126+ )
127+ })
128+ return _c
129+}
130+
131+func (_c *MockIdleInhibitor_Inhibit_Call) Return(err error) *MockIdleInhibitor_Inhibit_Call {
132+ _c.Call.Return(err)
133+ return _c
134+}
135+
136+func (_c *MockIdleInhibitor_Inhibit_Call) RunAndReturn(run func(ctx context.Context, reason string) error) *MockIdleInhibitor_Inhibit_Call {
137+ _c.Call.Return(run)
138+ return _c
139+}
140+
141+// IsInhibited provides a mock function for the type MockIdleInhibitor
142+func (_mock *MockIdleInhibitor) IsInhibited() bool {
143+ ret := _mock.Called()
144+
145+ if len(ret) == 0 {
146+ panic("no return value specified for IsInhibited")
147+ }
148+
149+ var r0 bool
150+ if returnFunc, ok := ret.Get(0).(func() bool); ok {
151+ r0 = returnFunc()
152+ } else {
153+ r0 = ret.Get(0).(bool)
154+ }
155+ return r0
156+}
157+
158+// MockIdleInhibitor_IsInhibited_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'IsInhibited'
159+type MockIdleInhibitor_IsInhibited_Call struct {
160+ *mock.Call
161+}
162+
163+// IsInhibited is a helper method to define mock.On call
164+func (_e *MockIdleInhibitor_Expecter) IsInhibited() *MockIdleInhibitor_IsInhibited_Call {
165+ return &MockIdleInhibitor_IsInhibited_Call{Call: _e.mock.On("IsInhibited")}
166+}
167+
168+func (_c *MockIdleInhibitor_IsInhibited_Call) Run(run func()) *MockIdleInhibitor_IsInhibited_Call {
169+ _c.Call.Run(func(args mock.Arguments) {
170+ run()
171+ })
172+ return _c
173+}
174+
175+func (_c *MockIdleInhibitor_IsInhibited_Call) Return(b bool) *MockIdleInhibitor_IsInhibited_Call {
176+ _c.Call.Return(b)
177+ return _c
178+}
179+
180+func (_c *MockIdleInhibitor_IsInhibited_Call) RunAndReturn(run func() bool) *MockIdleInhibitor_IsInhibited_Call {
181+ _c.Call.Return(run)
182+ return _c
183+}
184+
185+// Uninhibit provides a mock function for the type MockIdleInhibitor
186+func (_mock *MockIdleInhibitor) Uninhibit(ctx context.Context) error {
187+ ret := _mock.Called(ctx)
188+
189+ if len(ret) == 0 {
190+ panic("no return value specified for Uninhibit")
191+ }
192+
193+ var r0 error
194+ if returnFunc, ok := ret.Get(0).(func(context.Context) error); ok {
195+ r0 = returnFunc(ctx)
196+ } else {
197+ r0 = ret.Error(0)
198+ }
199+ return r0
200+}
201+
202+// MockIdleInhibitor_Uninhibit_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Uninhibit'
203+type MockIdleInhibitor_Uninhibit_Call struct {
204+ *mock.Call
205+}
206+
207+// Uninhibit is a helper method to define mock.On call
208+// - ctx context.Context
209+func (_e *MockIdleInhibitor_Expecter) Uninhibit(ctx any) *MockIdleInhibitor_Uninhibit_Call {
210+ return &MockIdleInhibitor_Uninhibit_Call{Call: _e.mock.On("Uninhibit", ctx)}
211+}
212+
213+func (_c *MockIdleInhibitor_Uninhibit_Call) Run(run func(ctx context.Context)) *MockIdleInhibitor_Uninhibit_Call {
214+ _c.Call.Run(func(args mock.Arguments) {
215+ var arg0 context.Context
216+ if args[0] != nil {
217+ arg0 = args[0].(context.Context)
218+ }
219+ run(
220+ arg0,
221+ )
222+ })
223+ return _c
224+}
225+
226+func (_c *MockIdleInhibitor_Uninhibit_Call) Return(err error) *MockIdleInhibitor_Uninhibit_Call {
227+ _c.Call.Return(err)
228+ return _c
229+}
230+
231+func (_c *MockIdleInhibitor_Uninhibit_Call) RunAndReturn(run func(ctx context.Context) error) *MockIdleInhibitor_Uninhibit_Call {
232+ _c.Call.Return(run)
233+ return _c
234+}
A internal/application/port/mocks/image_data.go +196 -0
@@ -0,0 +1,196 @@
1+// Code generated by mockery; DO NOT EDIT.
2+// github.com/vektra/mockery
3+// template: testify
4+
5+package mocks
6+
7+import (
8+ "context"
9+
10+ "github.com/bnema/dumber/internal/application/port"
11+ "github.com/bnema/dumber/internal/domain/entity"
12+ mock "github.com/stretchr/testify/mock"
13+)
14+
15+// NewMockImageDataResolver creates a new instance of MockImageDataResolver. 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.
17+func NewMockImageDataResolver(t interface {
18+ mock.TestingT
19+ Cleanup(func())
20+}) *MockImageDataResolver {
21+ mock := &MockImageDataResolver{}
22+ mock.Mock.Test(t)
23+
24+ t.Cleanup(func() { mock.AssertExpectations(t) })
25+
26+ return mock
27+}
28+
29+// MockImageDataResolver is an autogenerated mock type for the ImageDataResolver type
30+type MockImageDataResolver struct {
31+ mock.Mock
32+}
33+
34+type MockImageDataResolver_Expecter struct {
35+ mock *mock.Mock
36+}
37+
38+func (_m *MockImageDataResolver) EXPECT() *MockImageDataResolver_Expecter {
39+ return &MockImageDataResolver_Expecter{mock: &_m.Mock}
40+}
41+
42+// ResolveImageData provides a mock function for the type MockImageDataResolver
43+func (_mock *MockImageDataResolver) ResolveImageData(ctx context.Context, uri string) (entity.ImageData, error) {
44+ ret := _mock.Called(ctx, uri)
45+
46+ if len(ret) == 0 {
47+ panic("no return value specified for ResolveImageData")
48+ }
49+
50+ var r0 entity.ImageData
51+ var r1 error
52+ if returnFunc, ok := ret.Get(0).(func(context.Context, string) (entity.ImageData, error)); ok {
53+ return returnFunc(ctx, uri)
54+ }
55+ if returnFunc, ok := ret.Get(0).(func(context.Context, string) entity.ImageData); ok {
56+ r0 = returnFunc(ctx, uri)
57+ } else {
58+ r0 = ret.Get(0).(entity.ImageData)
59+ }
60+ if returnFunc, ok := ret.Get(1).(func(context.Context, string) error); ok {
61+ r1 = returnFunc(ctx, uri)
62+ } else {
63+ r1 = ret.Error(1)
64+ }
65+ return r0, r1
66+}
67+
68+// MockImageDataResolver_ResolveImageData_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ResolveImageData'
69+type MockImageDataResolver_ResolveImageData_Call struct {
70+ *mock.Call
71+}
72+
73+// ResolveImageData is a helper method to define mock.On call
74+// - ctx context.Context
75+// - uri string
76+func (_e *MockImageDataResolver_Expecter) ResolveImageData(ctx any, uri any) *MockImageDataResolver_ResolveImageData_Call {
77+ return &MockImageDataResolver_ResolveImageData_Call{Call: _e.mock.On("ResolveImageData", ctx, uri)}
78+}
79+
80+func (_c *MockImageDataResolver_ResolveImageData_Call) Run(run func(ctx context.Context, uri string)) *MockImageDataResolver_ResolveImageData_Call {
81+ _c.Call.Run(func(args mock.Arguments) {
82+ var arg0 context.Context
83+ if args[0] != nil {
84+ arg0 = args[0].(context.Context)
85+ }
86+ var arg1 string
87+ if args[1] != nil {
88+ arg1 = args[1].(string)
89+ }
90+ run(
91+ arg0,
92+ arg1,
93+ )
94+ })
95+ return _c
96+}
97+
98+func (_c *MockImageDataResolver_ResolveImageData_Call) Return(imageData entity.ImageData, err error) *MockImageDataResolver_ResolveImageData_Call {
99+ _c.Call.Return(imageData, err)
100+ return _c
101+}
102+
103+func (_c *MockImageDataResolver_ResolveImageData_Call) RunAndReturn(run func(ctx context.Context, uri string) (entity.ImageData, error)) *MockImageDataResolver_ResolveImageData_Call {
104+ _c.Call.Return(run)
105+ return _c
106+}
107+
108+// NewMockResolvedImageSaver creates a new instance of MockResolvedImageSaver. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
109+// The first argument is typically a *testing.T value.
110+func NewMockResolvedImageSaver(t interface {
111+ mock.TestingT
112+ Cleanup(func())
113+}) *MockResolvedImageSaver {
114+ mock := &MockResolvedImageSaver{}
115+ mock.Mock.Test(t)
116+
117+ t.Cleanup(func() { mock.AssertExpectations(t) })
118+
119+ return mock
120+}
121+
122+// MockResolvedImageSaver is an autogenerated mock type for the ResolvedImageSaver type
123+type MockResolvedImageSaver struct {
124+ mock.Mock
125+}
126+
127+type MockResolvedImageSaver_Expecter struct {
128+ mock *mock.Mock
129+}
130+
131+func (_m *MockResolvedImageSaver) EXPECT() *MockResolvedImageSaver_Expecter {
132+ return &MockResolvedImageSaver_Expecter{mock: &_m.Mock}
133+}
134+
135+// SaveResolvedImage provides a mock function for the type MockResolvedImageSaver
136+func (_mock *MockResolvedImageSaver) SaveResolvedImage(ctx context.Context, image entity.ImageData, menuContext port.MenuContext) error {
137+ ret := _mock.Called(ctx, image, menuContext)
138+
139+ if len(ret) == 0 {
140+ panic("no return value specified for SaveResolvedImage")
141+ }
142+
143+ var r0 error
144+ if returnFunc, ok := ret.Get(0).(func(context.Context, entity.ImageData, port.MenuContext) error); ok {
145+ r0 = returnFunc(ctx, image, menuContext)
146+ } else {
147+ r0 = ret.Error(0)
148+ }
149+ return r0
150+}
151+
152+// MockResolvedImageSaver_SaveResolvedImage_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'SaveResolvedImage'
153+type MockResolvedImageSaver_SaveResolvedImage_Call struct {
154+ *mock.Call
155+}
156+
157+// SaveResolvedImage is a helper method to define mock.On call
158+// - ctx context.Context
159+// - image entity.ImageData
160+// - menuContext port.MenuContext
161+func (_e *MockResolvedImageSaver_Expecter) SaveResolvedImage(ctx any, image any, menuContext any) *MockResolvedImageSaver_SaveResolvedImage_Call {
162+ return &MockResolvedImageSaver_SaveResolvedImage_Call{Call: _e.mock.On("SaveResolvedImage", ctx, image, menuContext)}
163+}
164+
165+func (_c *MockResolvedImageSaver_SaveResolvedImage_Call) Run(run func(ctx context.Context, image entity.ImageData, menuContext port.MenuContext)) *MockResolvedImageSaver_SaveResolvedImage_Call {
166+ _c.Call.Run(func(args mock.Arguments) {
167+ var arg0 context.Context
168+ if args[0] != nil {
169+ arg0 = args[0].(context.Context)
170+ }
171+ var arg1 entity.ImageData
172+ if args[1] != nil {
173+ arg1 = args[1].(entity.ImageData)
174+ }
175+ var arg2 port.MenuContext
176+ if args[2] != nil {
177+ arg2 = args[2].(port.MenuContext)
178+ }
179+ run(
180+ arg0,
181+ arg1,
182+ arg2,
183+ )
184+ })
185+ return _c
186+}
187+
188+func (_c *MockResolvedImageSaver_SaveResolvedImage_Call) Return(err error) *MockResolvedImageSaver_SaveResolvedImage_Call {
189+ _c.Call.Return(err)
190+ return _c
191+}
192+
193+func (_c *MockResolvedImageSaver_SaveResolvedImage_Call) RunAndReturn(run func(ctx context.Context, image entity.ImageData, menuContext port.MenuContext) error) *MockResolvedImageSaver_SaveResolvedImage_Call {
194+ _c.Call.Return(run)
195+ return _c
196+}
A internal/application/port/mocks/keybindings.go +773 -0
@@ -0,0 +1,773 @@
1+// Code generated by mockery; DO NOT EDIT.
2+// github.com/vektra/mockery
3+// template: testify
4+
5+package mocks
6+
7+import (
8+ "context"
9+
10+ "github.com/bnema/dumber/internal/application/port"
11+ mock "github.com/stretchr/testify/mock"
12+)
13+
14+// NewMockKeybindingsProvider creates a new instance of MockKeybindingsProvider. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
15+// The first argument is typically a *testing.T value.
16+func NewMockKeybindingsProvider(t interface {
17+ mock.TestingT
18+ Cleanup(func())
19+}) *MockKeybindingsProvider {
20+ mock := &MockKeybindingsProvider{}
21+ mock.Mock.Test(t)
22+
23+ t.Cleanup(func() { mock.AssertExpectations(t) })
24+
25+ return mock
26+}
27+
28+// MockKeybindingsProvider is an autogenerated mock type for the KeybindingsProvider type
29+type MockKeybindingsProvider struct {
30+ mock.Mock
31+}
32+
33+type MockKeybindingsProvider_Expecter struct {
34+ mock *mock.Mock
35+}
36+
37+func (_m *MockKeybindingsProvider) EXPECT() *MockKeybindingsProvider_Expecter {
38+ return &MockKeybindingsProvider_Expecter{mock: &_m.Mock}
39+}
40+
41+// CheckConflicts provides a mock function for the type MockKeybindingsProvider
42+func (_mock *MockKeybindingsProvider) CheckConflicts(ctx context.Context, mode string, action string, keys []string) ([]port.KeybindingConflict, error) {
43+ ret := _mock.Called(ctx, mode, action, keys)
44+
45+ if len(ret) == 0 {
46+ panic("no return value specified for CheckConflicts")
47+ }
48+
49+ var r0 []port.KeybindingConflict
50+ var r1 error
51+ if returnFunc, ok := ret.Get(0).(func(context.Context, string, string, []string) ([]port.KeybindingConflict, error)); ok {
52+ return returnFunc(ctx, mode, action, keys)
53+ }
54+ if returnFunc, ok := ret.Get(0).(func(context.Context, string, string, []string) []port.KeybindingConflict); ok {
55+ r0 = returnFunc(ctx, mode, action, keys)
56+ } else {
57+ if ret.Get(0) != nil {
58+ r0 = ret.Get(0).([]port.KeybindingConflict)
59+ }
60+ }
61+ if returnFunc, ok := ret.Get(1).(func(context.Context, string, string, []string) error); ok {
62+ r1 = returnFunc(ctx, mode, action, keys)
63+ } else {
64+ r1 = ret.Error(1)
65+ }
66+ return r0, r1
67+}
68+
69+// MockKeybindingsProvider_CheckConflicts_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'CheckConflicts'
70+type MockKeybindingsProvider_CheckConflicts_Call struct {
71+ *mock.Call
72+}
73+
74+// CheckConflicts is a helper method to define mock.On call
75+// - ctx context.Context
76+// - mode string
77+// - action string
78+// - keys []string
79+func (_e *MockKeybindingsProvider_Expecter) CheckConflicts(ctx any, mode any, action any, keys any) *MockKeybindingsProvider_CheckConflicts_Call {
80+ return &MockKeybindingsProvider_CheckConflicts_Call{Call: _e.mock.On("CheckConflicts", ctx, mode, action, keys)}
81+}
82+
83+func (_c *MockKeybindingsProvider_CheckConflicts_Call) Run(run func(ctx context.Context, mode string, action string, keys []string)) *MockKeybindingsProvider_CheckConflicts_Call {
84+ _c.Call.Run(func(args mock.Arguments) {
85+ var arg0 context.Context
86+ if args[0] != nil {
87+ arg0 = args[0].(context.Context)
88+ }
89+ var arg1 string
90+ if args[1] != nil {
91+ arg1 = args[1].(string)
92+ }
93+ var arg2 string
94+ if args[2] != nil {
95+ arg2 = args[2].(string)
96+ }
97+ var arg3 []string
98+ if args[3] != nil {
99+ arg3 = args[3].([]string)
100+ }
101+ run(
102+ arg0,
103+ arg1,
104+ arg2,
105+ arg3,
106+ )
107+ })
108+ return _c
109+}
110+
111+func (_c *MockKeybindingsProvider_CheckConflicts_Call) Return(keybindingConflicts []port.KeybindingConflict, err error) *MockKeybindingsProvider_CheckConflicts_Call {
112+ _c.Call.Return(keybindingConflicts, err)
113+ return _c
114+}
115+
116+func (_c *MockKeybindingsProvider_CheckConflicts_Call) RunAndReturn(run func(ctx context.Context, mode string, action string, keys []string) ([]port.KeybindingConflict, error)) *MockKeybindingsProvider_CheckConflicts_Call {
117+ _c.Call.Return(run)
118+ return _c
119+}
120+
121+// GetDefaultKeybindings provides a mock function for the type MockKeybindingsProvider
122+func (_mock *MockKeybindingsProvider) GetDefaultKeybindings(ctx context.Context) (port.KeybindingsConfig, error) {
123+ ret := _mock.Called(ctx)
124+
125+ if len(ret) == 0 {
126+ panic("no return value specified for GetDefaultKeybindings")
127+ }
128+
129+ var r0 port.KeybindingsConfig
130+ var r1 error
131+ if returnFunc, ok := ret.Get(0).(func(context.Context) (port.KeybindingsConfig, error)); ok {
132+ return returnFunc(ctx)
133+ }
134+ if returnFunc, ok := ret.Get(0).(func(context.Context) port.KeybindingsConfig); ok {
135+ r0 = returnFunc(ctx)
136+ } else {
137+ r0 = ret.Get(0).(port.KeybindingsConfig)
138+ }
139+ if returnFunc, ok := ret.Get(1).(func(context.Context) error); ok {
140+ r1 = returnFunc(ctx)
141+ } else {
142+ r1 = ret.Error(1)
143+ }
144+ return r0, r1
145+}
146+
147+// MockKeybindingsProvider_GetDefaultKeybindings_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetDefaultKeybindings'
148+type MockKeybindingsProvider_GetDefaultKeybindings_Call struct {
149+ *mock.Call
150+}
151+
152+// GetDefaultKeybindings is a helper method to define mock.On call
153+// - ctx context.Context
154+func (_e *MockKeybindingsProvider_Expecter) GetDefaultKeybindings(ctx any) *MockKeybindingsProvider_GetDefaultKeybindings_Call {
155+ return &MockKeybindingsProvider_GetDefaultKeybindings_Call{Call: _e.mock.On("GetDefaultKeybindings", ctx)}
156+}
157+
158+func (_c *MockKeybindingsProvider_GetDefaultKeybindings_Call) Run(run func(ctx context.Context)) *MockKeybindingsProvider_GetDefaultKeybindings_Call {
159+ _c.Call.Run(func(args mock.Arguments) {
160+ var arg0 context.Context
161+ if args[0] != nil {
162+ arg0 = args[0].(context.Context)
163+ }
164+ run(
165+ arg0,
166+ )
167+ })
168+ return _c
169+}
170+
171+func (_c *MockKeybindingsProvider_GetDefaultKeybindings_Call) Return(keybindingsConfig port.KeybindingsConfig, err error) *MockKeybindingsProvider_GetDefaultKeybindings_Call {
172+ _c.Call.Return(keybindingsConfig, err)
173+ return _c
174+}
175+
176+func (_c *MockKeybindingsProvider_GetDefaultKeybindings_Call) RunAndReturn(run func(ctx context.Context) (port.KeybindingsConfig, error)) *MockKeybindingsProvider_GetDefaultKeybindings_Call {
177+ _c.Call.Return(run)
178+ return _c
179+}
180+
181+// GetKeybindings provides a mock function for the type MockKeybindingsProvider
182+func (_mock *MockKeybindingsProvider) GetKeybindings(ctx context.Context) (port.KeybindingsConfig, error) {
183+ ret := _mock.Called(ctx)
184+
185+ if len(ret) == 0 {
186+ panic("no return value specified for GetKeybindings")
187+ }
188+
189+ var r0 port.KeybindingsConfig
190+ var r1 error
191+ if returnFunc, ok := ret.Get(0).(func(context.Context) (port.KeybindingsConfig, error)); ok {
192+ return returnFunc(ctx)
193+ }
194+ if returnFunc, ok := ret.Get(0).(func(context.Context) port.KeybindingsConfig); ok {
195+ r0 = returnFunc(ctx)
196+ } else {
197+ r0 = ret.Get(0).(port.KeybindingsConfig)
198+ }
199+ if returnFunc, ok := ret.Get(1).(func(context.Context) error); ok {
200+ r1 = returnFunc(ctx)
201+ } else {
202+ r1 = ret.Error(1)
203+ }
204+ return r0, r1
205+}
206+
207+// MockKeybindingsProvider_GetKeybindings_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetKeybindings'
208+type MockKeybindingsProvider_GetKeybindings_Call struct {
209+ *mock.Call
210+}
211+
212+// GetKeybindings is a helper method to define mock.On call
213+// - ctx context.Context
214+func (_e *MockKeybindingsProvider_Expecter) GetKeybindings(ctx any) *MockKeybindingsProvider_GetKeybindings_Call {
215+ return &MockKeybindingsProvider_GetKeybindings_Call{Call: _e.mock.On("GetKeybindings", ctx)}
216+}
217+
218+func (_c *MockKeybindingsProvider_GetKeybindings_Call) Run(run func(ctx context.Context)) *MockKeybindingsProvider_GetKeybindings_Call {
219+ _c.Call.Run(func(args mock.Arguments) {
220+ var arg0 context.Context
221+ if args[0] != nil {
222+ arg0 = args[0].(context.Context)
223+ }
224+ run(
225+ arg0,
226+ )
227+ })
228+ return _c
229+}
230+
231+func (_c *MockKeybindingsProvider_GetKeybindings_Call) Return(keybindingsConfig port.KeybindingsConfig, err error) *MockKeybindingsProvider_GetKeybindings_Call {
232+ _c.Call.Return(keybindingsConfig, err)
233+ return _c
234+}
235+
236+func (_c *MockKeybindingsProvider_GetKeybindings_Call) RunAndReturn(run func(ctx context.Context) (port.KeybindingsConfig, error)) *MockKeybindingsProvider_GetKeybindings_Call {
237+ _c.Call.Return(run)
238+ return _c
239+}
240+
241+// NewMockKeybindingsSaver creates a new instance of MockKeybindingsSaver. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
242+// The first argument is typically a *testing.T value.
243+func NewMockKeybindingsSaver(t interface {
244+ mock.TestingT
245+ Cleanup(func())
246+}) *MockKeybindingsSaver {
247+ mock := &MockKeybindingsSaver{}
248+ mock.Mock.Test(t)
249+
250+ t.Cleanup(func() { mock.AssertExpectations(t) })
251+
252+ return mock
253+}
254+
255+// MockKeybindingsSaver is an autogenerated mock type for the KeybindingsSaver type
256+type MockKeybindingsSaver struct {
257+ mock.Mock
258+}
259+
260+type MockKeybindingsSaver_Expecter struct {
261+ mock *mock.Mock
262+}
263+
264+func (_m *MockKeybindingsSaver) EXPECT() *MockKeybindingsSaver_Expecter {
265+ return &MockKeybindingsSaver_Expecter{mock: &_m.Mock}
266+}
267+
268+// ResetAllKeybindings provides a mock function for the type MockKeybindingsSaver
269+func (_mock *MockKeybindingsSaver) ResetAllKeybindings(ctx context.Context) error {
270+ ret := _mock.Called(ctx)
271+
272+ if len(ret) == 0 {
273+ panic("no return value specified for ResetAllKeybindings")
274+ }
275+
276+ var r0 error
277+ if returnFunc, ok := ret.Get(0).(func(context.Context) error); ok {
278+ r0 = returnFunc(ctx)
279+ } else {
280+ r0 = ret.Error(0)
281+ }
282+ return r0
283+}
284+
285+// MockKeybindingsSaver_ResetAllKeybindings_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ResetAllKeybindings'
286+type MockKeybindingsSaver_ResetAllKeybindings_Call struct {
287+ *mock.Call
288+}
289+
290+// ResetAllKeybindings is a helper method to define mock.On call
291+// - ctx context.Context
292+func (_e *MockKeybindingsSaver_Expecter) ResetAllKeybindings(ctx any) *MockKeybindingsSaver_ResetAllKeybindings_Call {
293+ return &MockKeybindingsSaver_ResetAllKeybindings_Call{Call: _e.mock.On("ResetAllKeybindings", ctx)}
294+}
295+
296+func (_c *MockKeybindingsSaver_ResetAllKeybindings_Call) Run(run func(ctx context.Context)) *MockKeybindingsSaver_ResetAllKeybindings_Call {
297+ _c.Call.Run(func(args mock.Arguments) {
298+ var arg0 context.Context
299+ if args[0] != nil {
300+ arg0 = args[0].(context.Context)
301+ }
302+ run(
303+ arg0,
304+ )
305+ })
306+ return _c
307+}
308+
309+func (_c *MockKeybindingsSaver_ResetAllKeybindings_Call) Return(err error) *MockKeybindingsSaver_ResetAllKeybindings_Call {
310+ _c.Call.Return(err)
311+ return _c
312+}
313+
314+func (_c *MockKeybindingsSaver_ResetAllKeybindings_Call) RunAndReturn(run func(ctx context.Context) error) *MockKeybindingsSaver_ResetAllKeybindings_Call {
315+ _c.Call.Return(run)
316+ return _c
317+}
318+
319+// ResetKeybinding provides a mock function for the type MockKeybindingsSaver
320+func (_mock *MockKeybindingsSaver) ResetKeybinding(ctx context.Context, req port.ResetKeybindingRequest) error {
321+ ret := _mock.Called(ctx, req)
322+
323+ if len(ret) == 0 {
324+ panic("no return value specified for ResetKeybinding")
325+ }
326+
327+ var r0 error
328+ if returnFunc, ok := ret.Get(0).(func(context.Context, port.ResetKeybindingRequest) error); ok {
329+ r0 = returnFunc(ctx, req)
330+ } else {
331+ r0 = ret.Error(0)
332+ }
333+ return r0
334+}
335+
336+// MockKeybindingsSaver_ResetKeybinding_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ResetKeybinding'
337+type MockKeybindingsSaver_ResetKeybinding_Call struct {
338+ *mock.Call
339+}
340+
341+// ResetKeybinding is a helper method to define mock.On call
342+// - ctx context.Context
343+// - req port.ResetKeybindingRequest
344+func (_e *MockKeybindingsSaver_Expecter) ResetKeybinding(ctx any, req any) *MockKeybindingsSaver_ResetKeybinding_Call {
345+ return &MockKeybindingsSaver_ResetKeybinding_Call{Call: _e.mock.On("ResetKeybinding", ctx, req)}
346+}
347+
348+func (_c *MockKeybindingsSaver_ResetKeybinding_Call) Run(run func(ctx context.Context, req port.ResetKeybindingRequest)) *MockKeybindingsSaver_ResetKeybinding_Call {
349+ _c.Call.Run(func(args mock.Arguments) {
350+ var arg0 context.Context
351+ if args[0] != nil {
352+ arg0 = args[0].(context.Context)
353+ }
354+ var arg1 port.ResetKeybindingRequest
355+ if args[1] != nil {
356+ arg1 = args[1].(port.ResetKeybindingRequest)
357+ }
358+ run(
359+ arg0,
360+ arg1,
361+ )
362+ })
363+ return _c
364+}
365+
366+func (_c *MockKeybindingsSaver_ResetKeybinding_Call) Return(err error) *MockKeybindingsSaver_ResetKeybinding_Call {
367+ _c.Call.Return(err)
368+ return _c
369+}
370+
371+func (_c *MockKeybindingsSaver_ResetKeybinding_Call) RunAndReturn(run func(ctx context.Context, req port.ResetKeybindingRequest) error) *MockKeybindingsSaver_ResetKeybinding_Call {
372+ _c.Call.Return(run)
373+ return _c
374+}
375+
376+// SetKeybinding provides a mock function for the type MockKeybindingsSaver
377+func (_mock *MockKeybindingsSaver) SetKeybinding(ctx context.Context, req port.SetKeybindingRequest) error {
378+ ret := _mock.Called(ctx, req)
379+
380+ if len(ret) == 0 {
381+ panic("no return value specified for SetKeybinding")
382+ }
383+
384+ var r0 error
385+ if returnFunc, ok := ret.Get(0).(func(context.Context, port.SetKeybindingRequest) error); ok {
386+ r0 = returnFunc(ctx, req)
387+ } else {
388+ r0 = ret.Error(0)
389+ }
390+ return r0
391+}
392+
393+// MockKeybindingsSaver_SetKeybinding_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'SetKeybinding'
394+type MockKeybindingsSaver_SetKeybinding_Call struct {
395+ *mock.Call
396+}
397+
398+// SetKeybinding is a helper method to define mock.On call
399+// - ctx context.Context
400+// - req port.SetKeybindingRequest
401+func (_e *MockKeybindingsSaver_Expecter) SetKeybinding(ctx any, req any) *MockKeybindingsSaver_SetKeybinding_Call {
402+ return &MockKeybindingsSaver_SetKeybinding_Call{Call: _e.mock.On("SetKeybinding", ctx, req)}
403+}
404+
405+func (_c *MockKeybindingsSaver_SetKeybinding_Call) Run(run func(ctx context.Context, req port.SetKeybindingRequest)) *MockKeybindingsSaver_SetKeybinding_Call {
406+ _c.Call.Run(func(args mock.Arguments) {
407+ var arg0 context.Context
408+ if args[0] != nil {
409+ arg0 = args[0].(context.Context)
410+ }
411+ var arg1 port.SetKeybindingRequest
412+ if args[1] != nil {
413+ arg1 = args[1].(port.SetKeybindingRequest)
414+ }
415+ run(
416+ arg0,
417+ arg1,
418+ )
419+ })
420+ return _c
421+}
422+
423+func (_c *MockKeybindingsSaver_SetKeybinding_Call) Return(err error) *MockKeybindingsSaver_SetKeybinding_Call {
424+ _c.Call.Return(err)
425+ return _c
426+}
427+
428+func (_c *MockKeybindingsSaver_SetKeybinding_Call) RunAndReturn(run func(ctx context.Context, req port.SetKeybindingRequest) error) *MockKeybindingsSaver_SetKeybinding_Call {
429+ _c.Call.Return(run)
430+ return _c
431+}
432+
433+// NewMockKeybindingsGetter creates a new instance of MockKeybindingsGetter. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
434+// The first argument is typically a *testing.T value.
435+func NewMockKeybindingsGetter(t interface {
436+ mock.TestingT
437+ Cleanup(func())
438+}) *MockKeybindingsGetter {
439+ mock := &MockKeybindingsGetter{}
440+ mock.Mock.Test(t)
441+
442+ t.Cleanup(func() { mock.AssertExpectations(t) })
443+
444+ return mock
445+}
446+
447+// MockKeybindingsGetter is an autogenerated mock type for the KeybindingsGetter type
448+type MockKeybindingsGetter struct {
449+ mock.Mock
450+}
451+
452+type MockKeybindingsGetter_Expecter struct {
453+ mock *mock.Mock
454+}
455+
456+func (_m *MockKeybindingsGetter) EXPECT() *MockKeybindingsGetter_Expecter {
457+ return &MockKeybindingsGetter_Expecter{mock: &_m.Mock}
458+}
459+
460+// Execute provides a mock function for the type MockKeybindingsGetter
461+func (_mock *MockKeybindingsGetter) Execute(ctx context.Context) (port.KeybindingsConfig, error) {
462+ ret := _mock.Called(ctx)
463+
464+ if len(ret) == 0 {
465+ panic("no return value specified for Execute")
466+ }
467+
468+ var r0 port.KeybindingsConfig
469+ var r1 error
470+ if returnFunc, ok := ret.Get(0).(func(context.Context) (port.KeybindingsConfig, error)); ok {
471+ return returnFunc(ctx)
472+ }
473+ if returnFunc, ok := ret.Get(0).(func(context.Context) port.KeybindingsConfig); ok {
474+ r0 = returnFunc(ctx)
475+ } else {
476+ r0 = ret.Get(0).(port.KeybindingsConfig)
477+ }
478+ if returnFunc, ok := ret.Get(1).(func(context.Context) error); ok {
479+ r1 = returnFunc(ctx)
480+ } else {
481+ r1 = ret.Error(1)
482+ }
483+ return r0, r1
484+}
485+
486+// MockKeybindingsGetter_Execute_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Execute'
487+type MockKeybindingsGetter_Execute_Call struct {
488+ *mock.Call
489+}
490+
491+// Execute is a helper method to define mock.On call
492+// - ctx context.Context
493+func (_e *MockKeybindingsGetter_Expecter) Execute(ctx any) *MockKeybindingsGetter_Execute_Call {
494+ return &MockKeybindingsGetter_Execute_Call{Call: _e.mock.On("Execute", ctx)}
495+}
496+
497+func (_c *MockKeybindingsGetter_Execute_Call) Run(run func(ctx context.Context)) *MockKeybindingsGetter_Execute_Call {
498+ _c.Call.Run(func(args mock.Arguments) {
499+ var arg0 context.Context
500+ if args[0] != nil {
501+ arg0 = args[0].(context.Context)
502+ }
503+ run(
504+ arg0,
505+ )
506+ })
507+ return _c
508+}
509+
510+func (_c *MockKeybindingsGetter_Execute_Call) Return(keybindingsConfig port.KeybindingsConfig, err error) *MockKeybindingsGetter_Execute_Call {
511+ _c.Call.Return(keybindingsConfig, err)
512+ return _c
513+}
514+
515+func (_c *MockKeybindingsGetter_Execute_Call) RunAndReturn(run func(ctx context.Context) (port.KeybindingsConfig, error)) *MockKeybindingsGetter_Execute_Call {
516+ _c.Call.Return(run)
517+ return _c
518+}
519+
520+// NewMockKeybindingSetter creates a new instance of MockKeybindingSetter. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
521+// The first argument is typically a *testing.T value.
522+func NewMockKeybindingSetter(t interface {
523+ mock.TestingT
524+ Cleanup(func())
525+}) *MockKeybindingSetter {
526+ mock := &MockKeybindingSetter{}
527+ mock.Mock.Test(t)
528+
529+ t.Cleanup(func() { mock.AssertExpectations(t) })
530+
531+ return mock
532+}
533+
534+// MockKeybindingSetter is an autogenerated mock type for the KeybindingSetter type
535+type MockKeybindingSetter struct {
536+ mock.Mock
537+}
538+
539+type MockKeybindingSetter_Expecter struct {
540+ mock *mock.Mock
541+}
542+
543+func (_m *MockKeybindingSetter) EXPECT() *MockKeybindingSetter_Expecter {
544+ return &MockKeybindingSetter_Expecter{mock: &_m.Mock}
545+}
546+
547+// Execute provides a mock function for the type MockKeybindingSetter
548+func (_mock *MockKeybindingSetter) Execute(ctx context.Context, req port.SetKeybindingRequest) (port.SetKeybindingResponse, error) {
549+ ret := _mock.Called(ctx, req)
550+
551+ if len(ret) == 0 {
552+ panic("no return value specified for Execute")
553+ }
554+
555+ var r0 port.SetKeybindingResponse
556+ var r1 error
557+ if returnFunc, ok := ret.Get(0).(func(context.Context, port.SetKeybindingRequest) (port.SetKeybindingResponse, error)); ok {
558+ return returnFunc(ctx, req)
559+ }
560+ if returnFunc, ok := ret.Get(0).(func(context.Context, port.SetKeybindingRequest) port.SetKeybindingResponse); ok {
561+ r0 = returnFunc(ctx, req)
562+ } else {
563+ r0 = ret.Get(0).(port.SetKeybindingResponse)
564+ }
565+ if returnFunc, ok := ret.Get(1).(func(context.Context, port.SetKeybindingRequest) error); ok {
566+ r1 = returnFunc(ctx, req)
567+ } else {
568+ r1 = ret.Error(1)
569+ }
570+ return r0, r1
571+}
572+
573+// MockKeybindingSetter_Execute_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Execute'
574+type MockKeybindingSetter_Execute_Call struct {
575+ *mock.Call
576+}
577+
578+// Execute is a helper method to define mock.On call
579+// - ctx context.Context
580+// - req port.SetKeybindingRequest
581+func (_e *MockKeybindingSetter_Expecter) Execute(ctx any, req any) *MockKeybindingSetter_Execute_Call {
582+ return &MockKeybindingSetter_Execute_Call{Call: _e.mock.On("Execute", ctx, req)}
583+}
584+
585+func (_c *MockKeybindingSetter_Execute_Call) Run(run func(ctx context.Context, req port.SetKeybindingRequest)) *MockKeybindingSetter_Execute_Call {
586+ _c.Call.Run(func(args mock.Arguments) {
587+ var arg0 context.Context
588+ if args[0] != nil {
589+ arg0 = args[0].(context.Context)
590+ }
591+ var arg1 port.SetKeybindingRequest
592+ if args[1] != nil {
593+ arg1 = args[1].(port.SetKeybindingRequest)
594+ }
595+ run(
596+ arg0,
597+ arg1,
598+ )
599+ })
600+ return _c
601+}
602+
603+func (_c *MockKeybindingSetter_Execute_Call) Return(setKeybindingResponse port.SetKeybindingResponse, err error) *MockKeybindingSetter_Execute_Call {
604+ _c.Call.Return(setKeybindingResponse, err)
605+ return _c
606+}
607+
608+func (_c *MockKeybindingSetter_Execute_Call) RunAndReturn(run func(ctx context.Context, req port.SetKeybindingRequest) (port.SetKeybindingResponse, error)) *MockKeybindingSetter_Execute_Call {
609+ _c.Call.Return(run)
610+ return _c
611+}
612+
613+// NewMockKeybindingResetter creates a new instance of MockKeybindingResetter. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
614+// The first argument is typically a *testing.T value.
615+func NewMockKeybindingResetter(t interface {
616+ mock.TestingT
617+ Cleanup(func())
618+}) *MockKeybindingResetter {
619+ mock := &MockKeybindingResetter{}
620+ mock.Mock.Test(t)
621+
622+ t.Cleanup(func() { mock.AssertExpectations(t) })
623+
624+ return mock
625+}
626+
627+// MockKeybindingResetter is an autogenerated mock type for the KeybindingResetter type
628+type MockKeybindingResetter struct {
629+ mock.Mock
630+}
631+
632+type MockKeybindingResetter_Expecter struct {
633+ mock *mock.Mock
634+}
635+
636+func (_m *MockKeybindingResetter) EXPECT() *MockKeybindingResetter_Expecter {
637+ return &MockKeybindingResetter_Expecter{mock: &_m.Mock}
638+}
639+
640+// Execute provides a mock function for the type MockKeybindingResetter
641+func (_mock *MockKeybindingResetter) Execute(ctx context.Context, req port.ResetKeybindingRequest) error {
642+ ret := _mock.Called(ctx, req)
643+
644+ if len(ret) == 0 {
645+ panic("no return value specified for Execute")
646+ }
647+
648+ var r0 error
649+ if returnFunc, ok := ret.Get(0).(func(context.Context, port.ResetKeybindingRequest) error); ok {
650+ r0 = returnFunc(ctx, req)
651+ } else {
652+ r0 = ret.Error(0)
653+ }
654+ return r0
655+}
656+
657+// MockKeybindingResetter_Execute_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Execute'
658+type MockKeybindingResetter_Execute_Call struct {
659+ *mock.Call
660+}
661+
662+// Execute is a helper method to define mock.On call
663+// - ctx context.Context
664+// - req port.ResetKeybindingRequest
665+func (_e *MockKeybindingResetter_Expecter) Execute(ctx any, req any) *MockKeybindingResetter_Execute_Call {
666+ return &MockKeybindingResetter_Execute_Call{Call: _e.mock.On("Execute", ctx, req)}
667+}
668+
669+func (_c *MockKeybindingResetter_Execute_Call) Run(run func(ctx context.Context, req port.ResetKeybindingRequest)) *MockKeybindingResetter_Execute_Call {
670+ _c.Call.Run(func(args mock.Arguments) {
671+ var arg0 context.Context
672+ if args[0] != nil {
673+ arg0 = args[0].(context.Context)
674+ }
675+ var arg1 port.ResetKeybindingRequest
676+ if args[1] != nil {
677+ arg1 = args[1].(port.ResetKeybindingRequest)
678+ }
679+ run(
680+ arg0,
681+ arg1,
682+ )
683+ })
684+ return _c
685+}
686+
687+func (_c *MockKeybindingResetter_Execute_Call) Return(err error) *MockKeybindingResetter_Execute_Call {
688+ _c.Call.Return(err)
689+ return _c
690+}
691+
692+func (_c *MockKeybindingResetter_Execute_Call) RunAndReturn(run func(ctx context.Context, req port.ResetKeybindingRequest) error) *MockKeybindingResetter_Execute_Call {
693+ _c.Call.Return(run)
694+ return _c
695+}
696+
697+// NewMockAllKeybindingsResetter creates a new instance of MockAllKeybindingsResetter. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
698+// The first argument is typically a *testing.T value.
699+func NewMockAllKeybindingsResetter(t interface {
700+ mock.TestingT
701+ Cleanup(func())
702+}) *MockAllKeybindingsResetter {
703+ mock := &MockAllKeybindingsResetter{}
704+ mock.Mock.Test(t)
705+
706+ t.Cleanup(func() { mock.AssertExpectations(t) })
707+
708+ return mock
709+}
710+
711+// MockAllKeybindingsResetter is an autogenerated mock type for the AllKeybindingsResetter type
712+type MockAllKeybindingsResetter struct {
713+ mock.Mock
714+}
715+
716+type MockAllKeybindingsResetter_Expecter struct {
717+ mock *mock.Mock
718+}
719+
720+func (_m *MockAllKeybindingsResetter) EXPECT() *MockAllKeybindingsResetter_Expecter {
721+ return &MockAllKeybindingsResetter_Expecter{mock: &_m.Mock}
722+}
723+
724+// Execute provides a mock function for the type MockAllKeybindingsResetter
725+func (_mock *MockAllKeybindingsResetter) Execute(ctx context.Context) error {
726+ ret := _mock.Called(ctx)
727+
728+ if len(ret) == 0 {
729+ panic("no return value specified for Execute")
730+ }
731+
732+ var r0 error
733+ if returnFunc, ok := ret.Get(0).(func(context.Context) error); ok {
734+ r0 = returnFunc(ctx)
735+ } else {
736+ r0 = ret.Error(0)
737+ }
738+ return r0
739+}
740+
741+// MockAllKeybindingsResetter_Execute_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Execute'
742+type MockAllKeybindingsResetter_Execute_Call struct {
743+ *mock.Call
744+}
745+
746+// Execute is a helper method to define mock.On call
747+// - ctx context.Context
748+func (_e *MockAllKeybindingsResetter_Expecter) Execute(ctx any) *MockAllKeybindingsResetter_Execute_Call {
749+ return &MockAllKeybindingsResetter_Execute_Call{Call: _e.mock.On("Execute", ctx)}
750+}
751+
752+func (_c *MockAllKeybindingsResetter_Execute_Call) Run(run func(ctx context.Context)) *MockAllKeybindingsResetter_Execute_Call {
753+ _c.Call.Run(func(args mock.Arguments) {
754+ var arg0 context.Context
755+ if args[0] != nil {
756+ arg0 = args[0].(context.Context)
757+ }
758+ run(
759+ arg0,
760+ )
761+ })
762+ return _c
763+}
764+
765+func (_c *MockAllKeybindingsResetter_Execute_Call) Return(err error) *MockAllKeybindingsResetter_Execute_Call {
766+ _c.Call.Return(err)
767+ return _c
768+}
769+
770+func (_c *MockAllKeybindingsResetter_Execute_Call) RunAndReturn(run func(ctx context.Context) error) *MockAllKeybindingsResetter_Execute_Call {
771+ _c.Call.Return(run)
772+ return _c
773+}
A internal/application/port/mocks/media.go +92 -0
@@ -0,0 +1,92 @@
1+// Code generated by mockery; DO NOT EDIT.
2+// github.com/vektra/mockery
3+// template: testify
4+
5+package mocks
6+
7+import (
8+ "context"
9+
10+ "github.com/bnema/dumber/internal/application/port"
11+ mock "github.com/stretchr/testify/mock"
12+)
13+
14+// NewMockMediaDiagnostics creates a new instance of MockMediaDiagnostics. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
15+// The first argument is typically a *testing.T value.
16+func NewMockMediaDiagnostics(t interface {
17+ mock.TestingT
18+ Cleanup(func())
19+}) *MockMediaDiagnostics {
20+ mock := &MockMediaDiagnostics{}
21+ mock.Mock.Test(t)
22+
23+ t.Cleanup(func() { mock.AssertExpectations(t) })
24+
25+ return mock
26+}
27+
28+// MockMediaDiagnostics is an autogenerated mock type for the MediaDiagnostics type
29+type MockMediaDiagnostics struct {
30+ mock.Mock
31+}
32+
33+type MockMediaDiagnostics_Expecter struct {
34+ mock *mock.Mock
35+}
36+
37+func (_m *MockMediaDiagnostics) EXPECT() *MockMediaDiagnostics_Expecter {
38+ return &MockMediaDiagnostics_Expecter{mock: &_m.Mock}
39+}
40+
41+// RunDiagnostics provides a mock function for the type MockMediaDiagnostics
42+func (_mock *MockMediaDiagnostics) RunDiagnostics(ctx context.Context) *port.MediaDiagnosticsResult {
43+ ret := _mock.Called(ctx)
44+
45+ if len(ret) == 0 {
46+ panic("no return value specified for RunDiagnostics")
47+ }
48+
49+ var r0 *port.MediaDiagnosticsResult
50+ if returnFunc, ok := ret.Get(0).(func(context.Context) *port.MediaDiagnosticsResult); ok {
51+ r0 = returnFunc(ctx)
52+ } else {
53+ if ret.Get(0) != nil {
54+ r0 = ret.Get(0).(*port.MediaDiagnosticsResult)
55+ }
56+ }
57+ return r0
58+}
59+
60+// MockMediaDiagnostics_RunDiagnostics_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'RunDiagnostics'
61+type MockMediaDiagnostics_RunDiagnostics_Call struct {
62+ *mock.Call
63+}
64+
65+// RunDiagnostics is a helper method to define mock.On call
66+// - ctx context.Context
67+func (_e *MockMediaDiagnostics_Expecter) RunDiagnostics(ctx any) *MockMediaDiagnostics_RunDiagnostics_Call {
68+ return &MockMediaDiagnostics_RunDiagnostics_Call{Call: _e.mock.On("RunDiagnostics", ctx)}
69+}
70+
71+func (_c *MockMediaDiagnostics_RunDiagnostics_Call) Run(run func(ctx context.Context)) *MockMediaDiagnostics_RunDiagnostics_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+ run(
78+ arg0,
79+ )
80+ })
81+ return _c
82+}
83+
84+func (_c *MockMediaDiagnostics_RunDiagnostics_Call) Return(mediaDiagnosticsResult *port.MediaDiagnosticsResult) *MockMediaDiagnostics_RunDiagnostics_Call {
85+ _c.Call.Return(mediaDiagnosticsResult)
86+ return _c
87+}
88+
89+func (_c *MockMediaDiagnostics_RunDiagnostics_Call) RunAndReturn(run func(ctx context.Context) *port.MediaDiagnosticsResult) *MockMediaDiagnostics_RunDiagnostics_Call {
90+ _c.Call.Return(run)
91+ return _c
92+}
D internal/application/port/mocks/mocks.go +0 -16515 large diff (16515 lines changed): collapsed
A internal/application/port/mocks/notification.go +251 -0
@@ -0,0 +1,251 @@
1+// Code generated by mockery; DO NOT EDIT.
2+// github.com/vektra/mockery
3+// template: testify
4+
5+package mocks
6+
7+import (
8+ "context"
9+
10+ "github.com/bnema/dumber/internal/application/port"
11+ mock "github.com/stretchr/testify/mock"
12+)
13+
14+// NewMockNotification creates a new instance of MockNotification. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
15+// The first argument is typically a *testing.T value.
16+func NewMockNotification(t interface {
17+ mock.TestingT
18+ Cleanup(func())
19+}) *MockNotification {
20+ mock := &MockNotification{}
21+ mock.Mock.Test(t)
22+
23+ t.Cleanup(func() { mock.AssertExpectations(t) })
24+
25+ return mock
26+}
27+
28+// MockNotification is an autogenerated mock type for the Notification type
29+type MockNotification struct {
30+ mock.Mock
31+}
32+
33+type MockNotification_Expecter struct {
34+ mock *mock.Mock
35+}
36+
37+func (_m *MockNotification) EXPECT() *MockNotification_Expecter {
38+ return &MockNotification_Expecter{mock: &_m.Mock}
39+}
40+
41+// Clear provides a mock function for the type MockNotification
42+func (_mock *MockNotification) Clear(ctx context.Context) {
43+ _mock.Called(ctx)
44+ return
45+}
46+
47+// MockNotification_Clear_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Clear'
48+type MockNotification_Clear_Call struct {
49+ *mock.Call
50+}
51+
52+// Clear is a helper method to define mock.On call
53+// - ctx context.Context
54+func (_e *MockNotification_Expecter) Clear(ctx any) *MockNotification_Clear_Call {
55+ return &MockNotification_Clear_Call{Call: _e.mock.On("Clear", ctx)}
56+}
57+
58+func (_c *MockNotification_Clear_Call) Run(run func(ctx context.Context)) *MockNotification_Clear_Call {
59+ _c.Call.Run(func(args mock.Arguments) {
60+ var arg0 context.Context
61+ if args[0] != nil {
62+ arg0 = args[0].(context.Context)
63+ }
64+ run(
65+ arg0,
66+ )
67+ })
68+ return _c
69+}
70+
71+func (_c *MockNotification_Clear_Call) Return() *MockNotification_Clear_Call {
72+ _c.Call.Return()
73+ return _c
74+}
75+
76+func (_c *MockNotification_Clear_Call) RunAndReturn(run func(ctx context.Context)) *MockNotification_Clear_Call {
77+ _c.Run(run)
78+ return _c
79+}
80+
81+// Dismiss provides a mock function for the type MockNotification
82+func (_mock *MockNotification) Dismiss(ctx context.Context, id port.NotificationID) {
83+ _mock.Called(ctx, id)
84+ return
85+}
86+
87+// MockNotification_Dismiss_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Dismiss'
88+type MockNotification_Dismiss_Call struct {
89+ *mock.Call
90+}
91+
92+// Dismiss is a helper method to define mock.On call
93+// - ctx context.Context
94+// - id port.NotificationID
95+func (_e *MockNotification_Expecter) Dismiss(ctx any, id any) *MockNotification_Dismiss_Call {
96+ return &MockNotification_Dismiss_Call{Call: _e.mock.On("Dismiss", ctx, id)}
97+}
98+
99+func (_c *MockNotification_Dismiss_Call) Run(run func(ctx context.Context, id port.NotificationID)) *MockNotification_Dismiss_Call {
100+ _c.Call.Run(func(args mock.Arguments) {
101+ var arg0 context.Context
102+ if args[0] != nil {
103+ arg0 = args[0].(context.Context)
104+ }
105+ var arg1 port.NotificationID
106+ if args[1] != nil {
107+ arg1 = args[1].(port.NotificationID)
108+ }
109+ run(
110+ arg0,
111+ arg1,
112+ )
113+ })
114+ return _c
115+}
116+
117+func (_c *MockNotification_Dismiss_Call) Return() *MockNotification_Dismiss_Call {
118+ _c.Call.Return()
119+ return _c
120+}
121+
122+func (_c *MockNotification_Dismiss_Call) RunAndReturn(run func(ctx context.Context, id port.NotificationID)) *MockNotification_Dismiss_Call {
123+ _c.Run(run)
124+ return _c
125+}
126+
127+// Show provides a mock function for the type MockNotification
128+func (_mock *MockNotification) Show(ctx context.Context, message string, notifType port.NotificationType, durationMs int) port.NotificationID {
129+ ret := _mock.Called(ctx, message, notifType, durationMs)
130+
131+ if len(ret) == 0 {
132+ panic("no return value specified for Show")
133+ }
134+
135+ var r0 port.NotificationID
136+ if returnFunc, ok := ret.Get(0).(func(context.Context, string, port.NotificationType, int) port.NotificationID); ok {
137+ r0 = returnFunc(ctx, message, notifType, durationMs)
138+ } else {
139+ r0 = ret.Get(0).(port.NotificationID)
140+ }
141+ return r0
142+}
143+
144+// MockNotification_Show_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Show'
145+type MockNotification_Show_Call struct {
146+ *mock.Call
147+}
148+
149+// Show is a helper method to define mock.On call
150+// - ctx context.Context
151+// - message string
152+// - notifType port.NotificationType
153+// - durationMs int
154+func (_e *MockNotification_Expecter) Show(ctx any, message any, notifType any, durationMs any) *MockNotification_Show_Call {
155+ return &MockNotification_Show_Call{Call: _e.mock.On("Show", ctx, message, notifType, durationMs)}
156+}
157+
158+func (_c *MockNotification_Show_Call) Run(run func(ctx context.Context, message string, notifType port.NotificationType, durationMs int)) *MockNotification_Show_Call {
159+ _c.Call.Run(func(args mock.Arguments) {
160+ var arg0 context.Context
161+ if args[0] != nil {
162+ arg0 = args[0].(context.Context)
163+ }
164+ var arg1 string
165+ if args[1] != nil {
166+ arg1 = args[1].(string)
167+ }
168+ var arg2 port.NotificationType
169+ if args[2] != nil {
170+ arg2 = args[2].(port.NotificationType)
171+ }
172+ var arg3 int
173+ if args[3] != nil {
174+ arg3 = args[3].(int)
175+ }
176+ run(
177+ arg0,
178+ arg1,
179+ arg2,
180+ arg3,
181+ )
182+ })
183+ return _c
184+}
185+
186+func (_c *MockNotification_Show_Call) Return(notificationID port.NotificationID) *MockNotification_Show_Call {
187+ _c.Call.Return(notificationID)
188+ return _c
189+}
190+
191+func (_c *MockNotification_Show_Call) RunAndReturn(run func(ctx context.Context, message string, notifType port.NotificationType, durationMs int) port.NotificationID) *MockNotification_Show_Call {
192+ _c.Call.Return(run)
193+ return _c
194+}
195+
196+// ShowZoom provides a mock function for the type MockNotification
197+func (_mock *MockNotification) ShowZoom(ctx context.Context, zoomPercent int) port.NotificationID {
198+ ret := _mock.Called(ctx, zoomPercent)
199+
200+ if len(ret) == 0 {
201+ panic("no return value specified for ShowZoom")
202+ }
203+
204+ var r0 port.NotificationID
205+ if returnFunc, ok := ret.Get(0).(func(context.Context, int) port.NotificationID); ok {
206+ r0 = returnFunc(ctx, zoomPercent)
207+ } else {
208+ r0 = ret.Get(0).(port.NotificationID)
209+ }
210+ return r0
211+}
212+
213+// MockNotification_ShowZoom_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ShowZoom'
214+type MockNotification_ShowZoom_Call struct {
215+ *mock.Call
216+}
217+
218+// ShowZoom is a helper method to define mock.On call
219+// - ctx context.Context
220+// - zoomPercent int
221+func (_e *MockNotification_Expecter) ShowZoom(ctx any, zoomPercent any) *MockNotification_ShowZoom_Call {
222+ return &MockNotification_ShowZoom_Call{Call: _e.mock.On("ShowZoom", ctx, zoomPercent)}
223+}
224+
225+func (_c *MockNotification_ShowZoom_Call) Run(run func(ctx context.Context, zoomPercent int)) *MockNotification_ShowZoom_Call {
226+ _c.Call.Run(func(args mock.Arguments) {
227+ var arg0 context.Context
228+ if args[0] != nil {
229+ arg0 = args[0].(context.Context)
230+ }
231+ var arg1 int
232+ if args[1] != nil {
233+ arg1 = args[1].(int)
234+ }
235+ run(
236+ arg0,
237+ arg1,
238+ )
239+ })
240+ return _c
241+}
242+
243+func (_c *MockNotification_ShowZoom_Call) Return(notificationID port.NotificationID) *MockNotification_ShowZoom_Call {
244+ _c.Call.Return(notificationID)
245+ return _c
246+}
247+
248+func (_c *MockNotification_ShowZoom_Call) RunAndReturn(run func(ctx context.Context, zoomPercent int) port.NotificationID) *MockNotification_ShowZoom_Call {
249+ _c.Call.Return(run)
250+ return _c
251+}
A internal/application/port/mocks/omnibox_preferences.go +96 -0
@@ -0,0 +1,96 @@
1+// Code generated by mockery; DO NOT EDIT.
2+// github.com/vektra/mockery
3+// template: testify
4+
5+package mocks
6+
7+import (
8+ "context"
9+
10+ "github.com/bnema/dumber/internal/domain/entity"
11+ mock "github.com/stretchr/testify/mock"
12+)
13+
14+// NewMockOmniboxPreferencesSaver creates a new instance of MockOmniboxPreferencesSaver. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
15+// The first argument is typically a *testing.T value.
16+func NewMockOmniboxPreferencesSaver(t interface {
17+ mock.TestingT
18+ Cleanup(func())
19+}) *MockOmniboxPreferencesSaver {
20+ mock := &MockOmniboxPreferencesSaver{}
21+ mock.Mock.Test(t)
22+
23+ t.Cleanup(func() { mock.AssertExpectations(t) })
24+
25+ return mock
26+}
27+
28+// MockOmniboxPreferencesSaver is an autogenerated mock type for the OmniboxPreferencesSaver type
29+type MockOmniboxPreferencesSaver struct {
30+ mock.Mock
31+}
32+
33+type MockOmniboxPreferencesSaver_Expecter struct {
34+ mock *mock.Mock
35+}
36+
37+func (_m *MockOmniboxPreferencesSaver) EXPECT() *MockOmniboxPreferencesSaver_Expecter {
38+ return &MockOmniboxPreferencesSaver_Expecter{mock: &_m.Mock}
39+}
40+
41+// SaveOmniboxInitialBehavior provides a mock function for the type MockOmniboxPreferencesSaver
42+func (_mock *MockOmniboxPreferencesSaver) SaveOmniboxInitialBehavior(ctx context.Context, behavior entity.OmniboxInitialBehavior) error {
43+ ret := _mock.Called(ctx, behavior)
44+
45+ if len(ret) == 0 {
46+ panic("no return value specified for SaveOmniboxInitialBehavior")
47+ }
48+
49+ var r0 error
50+ if returnFunc, ok := ret.Get(0).(func(context.Context, entity.OmniboxInitialBehavior) error); ok {
51+ r0 = returnFunc(ctx, behavior)
52+ } else {
53+ r0 = ret.Error(0)
54+ }
55+ return r0
56+}
57+
58+// MockOmniboxPreferencesSaver_SaveOmniboxInitialBehavior_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'SaveOmniboxInitialBehavior'
59+type MockOmniboxPreferencesSaver_SaveOmniboxInitialBehavior_Call struct {
60+ *mock.Call
61+}
62+
63+// SaveOmniboxInitialBehavior is a helper method to define mock.On call
64+// - ctx context.Context
65+// - behavior entity.OmniboxInitialBehavior
66+func (_e *MockOmniboxPreferencesSaver_Expecter) SaveOmniboxInitialBehavior(ctx any, behavior any) *MockOmniboxPreferencesSaver_SaveOmniboxInitialBehavior_Call {
67+ return &MockOmniboxPreferencesSaver_SaveOmniboxInitialBehavior_Call{Call: _e.mock.On("SaveOmniboxInitialBehavior", ctx, behavior)}
68+}
69+
70+func (_c *MockOmniboxPreferencesSaver_SaveOmniboxInitialBehavior_Call) Run(run func(ctx context.Context, behavior entity.OmniboxInitialBehavior)) *MockOmniboxPreferencesSaver_SaveOmniboxInitialBehavior_Call {
71+ _c.Call.Run(func(args mock.Arguments) {
72+ var arg0 context.Context
73+ if args[0] != nil {
74+ arg0 = args[0].(context.Context)
75+ }
76+ var arg1 entity.OmniboxInitialBehavior
77+ if args[1] != nil {
78+ arg1 = args[1].(entity.OmniboxInitialBehavior)
79+ }
80+ run(
81+ arg0,
82+ arg1,
83+ )
84+ })
85+ return _c
86+}
87+
88+func (_c *MockOmniboxPreferencesSaver_SaveOmniboxInitialBehavior_Call) Return(err error) *MockOmniboxPreferencesSaver_SaveOmniboxInitialBehavior_Call {
89+ _c.Call.Return(err)
90+ return _c
91+}
92+
93+func (_c *MockOmniboxPreferencesSaver_SaveOmniboxInitialBehavior_Call) RunAndReturn(run func(ctx context.Context, behavior entity.OmniboxInitialBehavior) error) *MockOmniboxPreferencesSaver_SaveOmniboxInitialBehavior_Call {
94+ _c.Call.Return(run)
95+ return _c
96+}
A internal/application/port/mocks/permission.go +104 -0
@@ -0,0 +1,104 @@
1+// Code generated by mockery; DO NOT EDIT.
2+// github.com/vektra/mockery
3+// template: testify
4+
5+package mocks
6+
7+import (
8+ "context"
9+
10+ "github.com/bnema/dumber/internal/application/port"
11+ "github.com/bnema/dumber/internal/domain/entity"
12+ mock "github.com/stretchr/testify/mock"
13+)
14+
15+// NewMockPermissionDialogPresenter creates a new instance of MockPermissionDialogPresenter. 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.
17+func NewMockPermissionDialogPresenter(t interface {
18+ mock.TestingT
19+ Cleanup(func())
20+}) *MockPermissionDialogPresenter {
21+ mock := &MockPermissionDialogPresenter{}
22+ mock.Mock.Test(t)
23+
24+ t.Cleanup(func() { mock.AssertExpectations(t) })
25+
26+ return mock
27+}
28+
29+// MockPermissionDialogPresenter is an autogenerated mock type for the PermissionDialogPresenter type
30+type MockPermissionDialogPresenter struct {
31+ mock.Mock
32+}
33+
34+type MockPermissionDialogPresenter_Expecter struct {
35+ mock *mock.Mock
36+}
37+
38+func (_m *MockPermissionDialogPresenter) EXPECT() *MockPermissionDialogPresenter_Expecter {
39+ return &MockPermissionDialogPresenter_Expecter{mock: &_m.Mock}
40+}
41+
42+// ShowPermissionDialog provides a mock function for the type MockPermissionDialogPresenter
43+func (_mock *MockPermissionDialogPresenter) ShowPermissionDialog(ctx context.Context, origin string, permTypes []entity.PermissionType, metadata entity.PermissionMetadata, callback func(result port.PermissionDialogResult)) {
44+ _mock.Called(ctx, origin, permTypes, metadata, callback)
45+ return
46+}
47+
48+// MockPermissionDialogPresenter_ShowPermissionDialog_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ShowPermissionDialog'
49+type MockPermissionDialogPresenter_ShowPermissionDialog_Call struct {
50+ *mock.Call
51+}
52+
53+// ShowPermissionDialog is a helper method to define mock.On call
54+// - ctx context.Context
55+// - origin string
56+// - permTypes []entity.PermissionType
57+// - metadata entity.PermissionMetadata
58+// - callback func(result port.PermissionDialogResult)
59+func (_e *MockPermissionDialogPresenter_Expecter) ShowPermissionDialog(ctx any, origin any, permTypes any, metadata any, callback any) *MockPermissionDialogPresenter_ShowPermissionDialog_Call {
60+ return &MockPermissionDialogPresenter_ShowPermissionDialog_Call{Call: _e.mock.On("ShowPermissionDialog", ctx, origin, permTypes, metadata, callback)}
61+}
62+
63+func (_c *MockPermissionDialogPresenter_ShowPermissionDialog_Call) Run(run func(ctx context.Context, origin string, permTypes []entity.PermissionType, metadata entity.PermissionMetadata, callback func(result port.PermissionDialogResult))) *MockPermissionDialogPresenter_ShowPermissionDialog_Call {
64+ _c.Call.Run(func(args mock.Arguments) {
65+ var arg0 context.Context
66+ if args[0] != nil {
67+ arg0 = args[0].(context.Context)
68+ }
69+ var arg1 string
70+ if args[1] != nil {
71+ arg1 = args[1].(string)
72+ }
73+ var arg2 []entity.PermissionType
74+ if args[2] != nil {
75+ arg2 = args[2].([]entity.PermissionType)
76+ }
77+ var arg3 entity.PermissionMetadata
78+ if args[3] != nil {
79+ arg3 = args[3].(entity.PermissionMetadata)
80+ }
81+ var arg4 func(result port.PermissionDialogResult)
82+ if args[4] != nil {
83+ arg4 = args[4].(func(result port.PermissionDialogResult))
84+ }
85+ run(
86+ arg0,
87+ arg1,
88+ arg2,
89+ arg3,
90+ arg4,
91+ )
92+ })
93+ return _c
94+}
95+
96+func (_c *MockPermissionDialogPresenter_ShowPermissionDialog_Call) Return() *MockPermissionDialogPresenter_ShowPermissionDialog_Call {
97+ _c.Call.Return()
98+ return _c
99+}
100+
101+func (_c *MockPermissionDialogPresenter_ShowPermissionDialog_Call) RunAndReturn(run func(ctx context.Context, origin string, permTypes []entity.PermissionType, metadata entity.PermissionMetadata, callback func(result port.PermissionDialogResult))) *MockPermissionDialogPresenter_ShowPermissionDialog_Call {
102+ _c.Run(run)
103+ return _c
104+}
A internal/application/port/mocks/permission_repository.go +301 -0
@@ -0,0 +1,301 @@
1+// Code generated by mockery; DO NOT EDIT.
2+// github.com/vektra/mockery
3+// template: testify
4+
5+package mocks
6+
7+import (
8+ "context"
9+
10+ "github.com/bnema/dumber/internal/domain/entity"
11+ mock "github.com/stretchr/testify/mock"
12+)
13+
14+// NewMockPermissionRepository creates a new instance of MockPermissionRepository. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
15+// The first argument is typically a *testing.T value.
16+func NewMockPermissionRepository(t interface {
17+ mock.TestingT
18+ Cleanup(func())
19+}) *MockPermissionRepository {
20+ mock := &MockPermissionRepository{}
21+ mock.Mock.Test(t)
22+
23+ t.Cleanup(func() { mock.AssertExpectations(t) })
24+
25+ return mock
26+}
27+
28+// MockPermissionRepository is an autogenerated mock type for the PermissionRepository type
29+type MockPermissionRepository struct {
30+ mock.Mock
31+}
32+
33+type MockPermissionRepository_Expecter struct {
34+ mock *mock.Mock
35+}
36+
37+func (_m *MockPermissionRepository) EXPECT() *MockPermissionRepository_Expecter {
38+ return &MockPermissionRepository_Expecter{mock: &_m.Mock}
39+}
40+
41+// Delete provides a mock function for the type MockPermissionRepository
42+func (_mock *MockPermissionRepository) Delete(ctx context.Context, origin string, permType entity.PermissionType) error {
43+ ret := _mock.Called(ctx, origin, permType)
44+
45+ if len(ret) == 0 {
46+ panic("no return value specified for Delete")
47+ }
48+
49+ var r0 error
50+ if returnFunc, ok := ret.Get(0).(func(context.Context, string, entity.PermissionType) error); ok {
51+ r0 = returnFunc(ctx, origin, permType)
52+ } else {
53+ r0 = ret.Error(0)
54+ }
55+ return r0
56+}
57+
58+// MockPermissionRepository_Delete_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Delete'
59+type MockPermissionRepository_Delete_Call struct {
60+ *mock.Call
61+}
62+
63+// Delete is a helper method to define mock.On call
64+// - ctx context.Context
65+// - origin string
66+// - permType entity.PermissionType
67+func (_e *MockPermissionRepository_Expecter) Delete(ctx any, origin any, permType any) *MockPermissionRepository_Delete_Call {
68+ return &MockPermissionRepository_Delete_Call{Call: _e.mock.On("Delete", ctx, origin, permType)}
69+}
70+
71+func (_c *MockPermissionRepository_Delete_Call) Run(run func(ctx context.Context, origin string, permType entity.PermissionType)) *MockPermissionRepository_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 string
78+ if args[1] != nil {
79+ arg1 = args[1].(string)
80+ }
81+ var arg2 entity.PermissionType
82+ if args[2] != nil {
83+ arg2 = args[2].(entity.PermissionType)
84+ }
85+ run(
86+ arg0,
87+ arg1,
88+ arg2,
89+ )
90+ })
91+ return _c
92+}
93+
94+func (_c *MockPermissionRepository_Delete_Call) Return(err error) *MockPermissionRepository_Delete_Call {
95+ _c.Call.Return(err)
96+ return _c
97+}
98+
99+func (_c *MockPermissionRepository_Delete_Call) RunAndReturn(run func(ctx context.Context, origin string, permType entity.PermissionType) error) *MockPermissionRepository_Delete_Call {
100+ _c.Call.Return(run)
101+ return _c
102+}
103+
104+// Get provides a mock function for the type MockPermissionRepository
105+func (_mock *MockPermissionRepository) Get(ctx context.Context, origin string, permType entity.PermissionType) (*entity.PermissionRecord, error) {
106+ ret := _mock.Called(ctx, origin, permType)
107+
108+ if len(ret) == 0 {
109+ panic("no return value specified for Get")
110+ }
111+
112+ var r0 *entity.PermissionRecord
113+ var r1 error
114+ if returnFunc, ok := ret.Get(0).(func(context.Context, string, entity.PermissionType) (*entity.PermissionRecord, error)); ok {
115+ return returnFunc(ctx, origin, permType)
116+ }
117+ if returnFunc, ok := ret.Get(0).(func(context.Context, string, entity.PermissionType) *entity.PermissionRecord); ok {
118+ r0 = returnFunc(ctx, origin, permType)
119+ } else {
120+ if ret.Get(0) != nil {
121+ r0 = ret.Get(0).(*entity.PermissionRecord)
122+ }
123+ }
124+ if returnFunc, ok := ret.Get(1).(func(context.Context, string, entity.PermissionType) error); ok {
125+ r1 = returnFunc(ctx, origin, permType)
126+ } else {
127+ r1 = ret.Error(1)
128+ }
129+ return r0, r1
130+}
131+
132+// MockPermissionRepository_Get_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Get'
133+type MockPermissionRepository_Get_Call struct {
134+ *mock.Call
135+}
136+
137+// Get is a helper method to define mock.On call
138+// - ctx context.Context
139+// - origin string
140+// - permType entity.PermissionType
141+func (_e *MockPermissionRepository_Expecter) Get(ctx any, origin any, permType any) *MockPermissionRepository_Get_Call {
142+ return &MockPermissionRepository_Get_Call{Call: _e.mock.On("Get", ctx, origin, permType)}
143+}
144+
145+func (_c *MockPermissionRepository_Get_Call) Run(run func(ctx context.Context, origin string, permType entity.PermissionType)) *MockPermissionRepository_Get_Call {
146+ _c.Call.Run(func(args mock.Arguments) {
147+ var arg0 context.Context
148+ if args[0] != nil {
149+ arg0 = args[0].(context.Context)
150+ }
151+ var arg1 string
152+ if args[1] != nil {
153+ arg1 = args[1].(string)
154+ }
155+ var arg2 entity.PermissionType
156+ if args[2] != nil {
157+ arg2 = args[2].(entity.PermissionType)
158+ }
159+ run(
160+ arg0,
161+ arg1,
162+ arg2,
163+ )
164+ })
165+ return _c
166+}
167+
168+func (_c *MockPermissionRepository_Get_Call) Return(permissionRecord *entity.PermissionRecord, err error) *MockPermissionRepository_Get_Call {
169+ _c.Call.Return(permissionRecord, err)
170+ return _c
171+}
172+
173+func (_c *MockPermissionRepository_Get_Call) RunAndReturn(run func(ctx context.Context, origin string, permType entity.PermissionType) (*entity.PermissionRecord, error)) *MockPermissionRepository_Get_Call {
174+ _c.Call.Return(run)
175+ return _c
176+}
177+
178+// GetAll provides a mock function for the type MockPermissionRepository
179+func (_mock *MockPermissionRepository) GetAll(ctx context.Context, origin string) ([]*entity.PermissionRecord, error) {
180+ ret := _mock.Called(ctx, origin)
181+
182+ if len(ret) == 0 {
183+ panic("no return value specified for GetAll")
184+ }
185+
186+ var r0 []*entity.PermissionRecord
187+ var r1 error
188+ if returnFunc, ok := ret.Get(0).(func(context.Context, string) ([]*entity.PermissionRecord, error)); ok {
189+ return returnFunc(ctx, origin)
190+ }
191+ if returnFunc, ok := ret.Get(0).(func(context.Context, string) []*entity.PermissionRecord); ok {
192+ r0 = returnFunc(ctx, origin)
193+ } else {
194+ if ret.Get(0) != nil {
195+ r0 = ret.Get(0).([]*entity.PermissionRecord)
196+ }
197+ }
198+ if returnFunc, ok := ret.Get(1).(func(context.Context, string) error); ok {
199+ r1 = returnFunc(ctx, origin)
200+ } else {
201+ r1 = ret.Error(1)
202+ }
203+ return r0, r1
204+}
205+
206+// MockPermissionRepository_GetAll_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetAll'
207+type MockPermissionRepository_GetAll_Call struct {
208+ *mock.Call
209+}
210+
211+// GetAll is a helper method to define mock.On call
212+// - ctx context.Context
213+// - origin string
214+func (_e *MockPermissionRepository_Expecter) GetAll(ctx any, origin any) *MockPermissionRepository_GetAll_Call {
215+ return &MockPermissionRepository_GetAll_Call{Call: _e.mock.On("GetAll", ctx, origin)}
216+}
217+
218+func (_c *MockPermissionRepository_GetAll_Call) Run(run func(ctx context.Context, origin string)) *MockPermissionRepository_GetAll_Call {
219+ _c.Call.Run(func(args mock.Arguments) {
220+ var arg0 context.Context
221+ if args[0] != nil {
222+ arg0 = args[0].(context.Context)
223+ }
224+ var arg1 string
225+ if args[1] != nil {
226+ arg1 = args[1].(string)
227+ }
228+ run(
229+ arg0,
230+ arg1,
231+ )
232+ })
233+ return _c
234+}
235+
236+func (_c *MockPermissionRepository_GetAll_Call) Return(permissionRecords []*entity.PermissionRecord, err error) *MockPermissionRepository_GetAll_Call {
237+ _c.Call.Return(permissionRecords, err)
238+ return _c
239+}
240+
241+func (_c *MockPermissionRepository_GetAll_Call) RunAndReturn(run func(ctx context.Context, origin string) ([]*entity.PermissionRecord, error)) *MockPermissionRepository_GetAll_Call {
242+ _c.Call.Return(run)
243+ return _c
244+}
245+
246+// Set provides a mock function for the type MockPermissionRepository
247+func (_mock *MockPermissionRepository) Set(ctx context.Context, record *entity.PermissionRecord) error {
248+ ret := _mock.Called(ctx, record)
249+
250+ if len(ret) == 0 {
251+ panic("no return value specified for Set")
252+ }
253+
254+ var r0 error
255+ if returnFunc, ok := ret.Get(0).(func(context.Context, *entity.PermissionRecord) error); ok {
256+ r0 = returnFunc(ctx, record)
257+ } else {
258+ r0 = ret.Error(0)
259+ }
260+ return r0
261+}
262+
263+// MockPermissionRepository_Set_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Set'
264+type MockPermissionRepository_Set_Call struct {
265+ *mock.Call
266+}
267+
268+// Set is a helper method to define mock.On call
269+// - ctx context.Context
270+// - record *entity.PermissionRecord
271+func (_e *MockPermissionRepository_Expecter) Set(ctx any, record any) *MockPermissionRepository_Set_Call {
272+ return &MockPermissionRepository_Set_Call{Call: _e.mock.On("Set", ctx, record)}
273+}
274+
275+func (_c *MockPermissionRepository_Set_Call) Run(run func(ctx context.Context, record *entity.PermissionRecord)) *MockPermissionRepository_Set_Call {
276+ _c.Call.Run(func(args mock.Arguments) {
277+ var arg0 context.Context
278+ if args[0] != nil {
279+ arg0 = args[0].(context.Context)
280+ }
281+ var arg1 *entity.PermissionRecord
282+ if args[1] != nil {
283+ arg1 = args[1].(*entity.PermissionRecord)
284+ }
285+ run(
286+ arg0,
287+ arg1,
288+ )
289+ })
290+ return _c
291+}
292+
293+func (_c *MockPermissionRepository_Set_Call) Return(err error) *MockPermissionRepository_Set_Call {
294+ _c.Call.Return(err)
295+ return _c
296+}
297+
298+func (_c *MockPermissionRepository_Set_Call) RunAndReturn(run func(ctx context.Context, record *entity.PermissionRecord) error) *MockPermissionRepository_Set_Call {
299+ _c.Call.Return(run)
300+ return _c
301+}
A internal/application/port/mocks/rendering_env.go +136 -0
@@ -0,0 +1,136 @@
1+// Code generated by mockery; DO NOT EDIT.
2+// github.com/vektra/mockery
3+// template: testify
4+
5+package mocks
6+
7+import (
8+ "context"
9+
10+ "github.com/bnema/dumber/internal/application/port"
11+ mock "github.com/stretchr/testify/mock"
12+)
13+
14+// NewMockRenderingEnvManager creates a new instance of MockRenderingEnvManager. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
15+// The first argument is typically a *testing.T value.
16+func NewMockRenderingEnvManager(t interface {
17+ mock.TestingT
18+ Cleanup(func())
19+}) *MockRenderingEnvManager {
20+ mock := &MockRenderingEnvManager{}
21+ mock.Mock.Test(t)
22+
23+ t.Cleanup(func() { mock.AssertExpectations(t) })
24+
25+ return mock
26+}
27+
28+// MockRenderingEnvManager is an autogenerated mock type for the RenderingEnvManager type
29+type MockRenderingEnvManager struct {
30+ mock.Mock
31+}
32+
33+type MockRenderingEnvManager_Expecter struct {
34+ mock *mock.Mock
35+}
36+
37+func (_m *MockRenderingEnvManager) EXPECT() *MockRenderingEnvManager_Expecter {
38+ return &MockRenderingEnvManager_Expecter{mock: &_m.Mock}
39+}
40+
41+// DetectGPUVendor provides a mock function for the type MockRenderingEnvManager
42+func (_mock *MockRenderingEnvManager) DetectGPUVendor(ctx context.Context) port.GPUVendor {
43+ ret := _mock.Called(ctx)
44+
45+ if len(ret) == 0 {
46+ panic("no return value specified for DetectGPUVendor")
47+ }
48+
49+ var r0 port.GPUVendor
50+ if returnFunc, ok := ret.Get(0).(func(context.Context) port.GPUVendor); ok {
51+ r0 = returnFunc(ctx)
52+ } else {
53+ r0 = ret.Get(0).(port.GPUVendor)
54+ }
55+ return r0
56+}
57+
58+// MockRenderingEnvManager_DetectGPUVendor_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'DetectGPUVendor'
59+type MockRenderingEnvManager_DetectGPUVendor_Call struct {
60+ *mock.Call
61+}
62+
63+// DetectGPUVendor is a helper method to define mock.On call
64+// - ctx context.Context
65+func (_e *MockRenderingEnvManager_Expecter) DetectGPUVendor(ctx any) *MockRenderingEnvManager_DetectGPUVendor_Call {
66+ return &MockRenderingEnvManager_DetectGPUVendor_Call{Call: _e.mock.On("DetectGPUVendor", ctx)}
67+}
68+
69+func (_c *MockRenderingEnvManager_DetectGPUVendor_Call) Run(run func(ctx context.Context)) *MockRenderingEnvManager_DetectGPUVendor_Call {
70+ _c.Call.Run(func(args mock.Arguments) {
71+ var arg0 context.Context
72+ if args[0] != nil {
73+ arg0 = args[0].(context.Context)
74+ }
75+ run(
76+ arg0,
77+ )
78+ })
79+ return _c
80+}
81+
82+func (_c *MockRenderingEnvManager_DetectGPUVendor_Call) Return(gPUVendor port.GPUVendor) *MockRenderingEnvManager_DetectGPUVendor_Call {
83+ _c.Call.Return(gPUVendor)
84+ return _c
85+}
86+
87+func (_c *MockRenderingEnvManager_DetectGPUVendor_Call) RunAndReturn(run func(ctx context.Context) port.GPUVendor) *MockRenderingEnvManager_DetectGPUVendor_Call {
88+ _c.Call.Return(run)
89+ return _c
90+}
91+
92+// GetAppliedVars provides a mock function for the type MockRenderingEnvManager
93+func (_mock *MockRenderingEnvManager) GetAppliedVars() map[string]string {
94+ ret := _mock.Called()
95+
96+ if len(ret) == 0 {
97+ panic("no return value specified for GetAppliedVars")
98+ }
99+
100+ var r0 map[string]string
101+ if returnFunc, ok := ret.Get(0).(func() map[string]string); ok {
102+ r0 = returnFunc()
103+ } else {
104+ if ret.Get(0) != nil {
105+ r0 = ret.Get(0).(map[string]string)
106+ }
107+ }
108+ return r0
109+}
110+
111+// MockRenderingEnvManager_GetAppliedVars_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetAppliedVars'
112+type MockRenderingEnvManager_GetAppliedVars_Call struct {
113+ *mock.Call
114+}
115+
116+// GetAppliedVars is a helper method to define mock.On call
117+func (_e *MockRenderingEnvManager_Expecter) GetAppliedVars() *MockRenderingEnvManager_GetAppliedVars_Call {
118+ return &MockRenderingEnvManager_GetAppliedVars_Call{Call: _e.mock.On("GetAppliedVars")}
119+}
120+
121+func (_c *MockRenderingEnvManager_GetAppliedVars_Call) Run(run func()) *MockRenderingEnvManager_GetAppliedVars_Call {
122+ _c.Call.Run(func(args mock.Arguments) {
123+ run()
124+ })
125+ return _c
126+}
127+
128+func (_c *MockRenderingEnvManager_GetAppliedVars_Call) Return(stringToString map[string]string) *MockRenderingEnvManager_GetAppliedVars_Call {
129+ _c.Call.Return(stringToString)
130+ return _c
131+}
132+
133+func (_c *MockRenderingEnvManager_GetAppliedVars_Call) RunAndReturn(run func() map[string]string) *MockRenderingEnvManager_GetAppliedVars_Call {
134+ _c.Call.Return(run)
135+ return _c
136+}
A internal/application/port/mocks/runtime.go +110 -0
@@ -0,0 +1,110 @@
1+// Code generated by mockery; DO NOT EDIT.
2+// github.com/vektra/mockery
3+// template: testify
4+
5+package mocks
6+
7+import (
8+ "context"
9+
10+ mock "github.com/stretchr/testify/mock"
11+)
12+
13+// NewMockRuntimeVersionProbe creates a new instance of MockRuntimeVersionProbe. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
14+// The first argument is typically a *testing.T value.
15+func NewMockRuntimeVersionProbe(t interface {
16+ mock.TestingT
17+ Cleanup(func())
18+}) *MockRuntimeVersionProbe {
19+ mock := &MockRuntimeVersionProbe{}
20+ mock.Mock.Test(t)
21+
22+ t.Cleanup(func() { mock.AssertExpectations(t) })
23+
24+ return mock
25+}
26+
27+// MockRuntimeVersionProbe is an autogenerated mock type for the RuntimeVersionProbe type
28+type MockRuntimeVersionProbe struct {
29+ mock.Mock
30+}
31+
32+type MockRuntimeVersionProbe_Expecter struct {
33+ mock *mock.Mock
34+}
35+
36+func (_m *MockRuntimeVersionProbe) EXPECT() *MockRuntimeVersionProbe_Expecter {
37+ return &MockRuntimeVersionProbe_Expecter{mock: &_m.Mock}
38+}
39+
40+// PkgConfigModVersion provides a mock function for the type MockRuntimeVersionProbe
41+func (_mock *MockRuntimeVersionProbe) PkgConfigModVersion(ctx context.Context, pkgName string, prefix string) (string, error) {
42+ ret := _mock.Called(ctx, pkgName, prefix)
43+
44+ if len(ret) == 0 {
45+ panic("no return value specified for PkgConfigModVersion")
46+ }
47+
48+ var r0 string
49+ var r1 error
50+ if returnFunc, ok := ret.Get(0).(func(context.Context, string, string) (string, error)); ok {
51+ return returnFunc(ctx, pkgName, prefix)
52+ }
53+ if returnFunc, ok := ret.Get(0).(func(context.Context, string, string) string); ok {
54+ r0 = returnFunc(ctx, pkgName, prefix)
55+ } else {
56+ r0 = ret.Get(0).(string)
57+ }
58+ if returnFunc, ok := ret.Get(1).(func(context.Context, string, string) error); ok {
59+ r1 = returnFunc(ctx, pkgName, prefix)
60+ } else {
61+ r1 = ret.Error(1)
62+ }
63+ return r0, r1
64+}
65+
66+// MockRuntimeVersionProbe_PkgConfigModVersion_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'PkgConfigModVersion'
67+type MockRuntimeVersionProbe_PkgConfigModVersion_Call struct {
68+ *mock.Call
69+}
70+
71+// PkgConfigModVersion is a helper method to define mock.On call
72+// - ctx context.Context
73+// - pkgName string
74+// - prefix string
75+func (_e *MockRuntimeVersionProbe_Expecter) PkgConfigModVersion(ctx any, pkgName any, prefix any) *MockRuntimeVersionProbe_PkgConfigModVersion_Call {
76+ return &MockRuntimeVersionProbe_PkgConfigModVersion_Call{Call: _e.mock.On("PkgConfigModVersion", ctx, pkgName, prefix)}
77+}
78+
79+func (_c *MockRuntimeVersionProbe_PkgConfigModVersion_Call) Run(run func(ctx context.Context, pkgName string, prefix string)) *MockRuntimeVersionProbe_PkgConfigModVersion_Call {
80+ _c.Call.Run(func(args mock.Arguments) {
81+ var arg0 context.Context
82+ if args[0] != nil {
83+ arg0 = args[0].(context.Context)
84+ }
85+ var arg1 string
86+ if args[1] != nil {
87+ arg1 = args[1].(string)
88+ }
89+ var arg2 string
90+ if args[2] != nil {
91+ arg2 = args[2].(string)
92+ }
93+ run(
94+ arg0,
95+ arg1,
96+ arg2,
97+ )
98+ })
99+ return _c
100+}
101+
102+func (_c *MockRuntimeVersionProbe_PkgConfigModVersion_Call) Return(s string, err error) *MockRuntimeVersionProbe_PkgConfigModVersion_Call {
103+ _c.Call.Return(s, err)
104+ return _c
105+}
106+
107+func (_c *MockRuntimeVersionProbe_PkgConfigModVersion_Call) RunAndReturn(run func(ctx context.Context, pkgName string, prefix string) (string, error)) *MockRuntimeVersionProbe_PkgConfigModVersion_Call {
108+ _c.Call.Return(run)
109+ return _c
110+}
A internal/application/port/mocks/runtime_config.go +165 -0
@@ -0,0 +1,165 @@
1+// Code generated by mockery; DO NOT EDIT.
2+// github.com/vektra/mockery
3+// template: testify
4+
5+package mocks
6+
7+import (
8+ "github.com/bnema/dumber/internal/domain/entity"
9+ mock "github.com/stretchr/testify/mock"
10+)
11+
12+// NewMockRuntimeConfigProvider creates a new instance of MockRuntimeConfigProvider. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
13+// The first argument is typically a *testing.T value.
14+func NewMockRuntimeConfigProvider(t interface {
15+ mock.TestingT
16+ Cleanup(func())
17+}) *MockRuntimeConfigProvider {
18+ mock := &MockRuntimeConfigProvider{}
19+ mock.Mock.Test(t)
20+
21+ t.Cleanup(func() { mock.AssertExpectations(t) })
22+
23+ return mock
24+}
25+
26+// MockRuntimeConfigProvider is an autogenerated mock type for the RuntimeConfigProvider type
27+type MockRuntimeConfigProvider struct {
28+ mock.Mock
29+}
30+
31+type MockRuntimeConfigProvider_Expecter struct {
32+ mock *mock.Mock
33+}
34+
35+func (_m *MockRuntimeConfigProvider) EXPECT() *MockRuntimeConfigProvider_Expecter {
36+ return &MockRuntimeConfigProvider_Expecter{mock: &_m.Mock}
37+}
38+
39+// Current provides a mock function for the type MockRuntimeConfigProvider
40+func (_mock *MockRuntimeConfigProvider) Current() entity.RuntimeConfigSnapshot {
41+ ret := _mock.Called()
42+
43+ if len(ret) == 0 {
44+ panic("no return value specified for Current")
45+ }
46+
47+ var r0 entity.RuntimeConfigSnapshot
48+ if returnFunc, ok := ret.Get(0).(func() entity.RuntimeConfigSnapshot); ok {
49+ r0 = returnFunc()
50+ } else {
51+ r0 = ret.Get(0).(entity.RuntimeConfigSnapshot)
52+ }
53+ return r0
54+}
55+
56+// MockRuntimeConfigProvider_Current_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Current'
57+type MockRuntimeConfigProvider_Current_Call struct {
58+ *mock.Call
59+}
60+
61+// Current is a helper method to define mock.On call
62+func (_e *MockRuntimeConfigProvider_Expecter) Current() *MockRuntimeConfigProvider_Current_Call {
63+ return &MockRuntimeConfigProvider_Current_Call{Call: _e.mock.On("Current")}
64+}
65+
66+func (_c *MockRuntimeConfigProvider_Current_Call) Run(run func()) *MockRuntimeConfigProvider_Current_Call {
67+ _c.Call.Run(func(args mock.Arguments) {
68+ run()
69+ })
70+ return _c
71+}
72+
73+func (_c *MockRuntimeConfigProvider_Current_Call) Return(runtimeConfigSnapshot entity.RuntimeConfigSnapshot) *MockRuntimeConfigProvider_Current_Call {
74+ _c.Call.Return(runtimeConfigSnapshot)
75+ return _c
76+}
77+
78+func (_c *MockRuntimeConfigProvider_Current_Call) RunAndReturn(run func() entity.RuntimeConfigSnapshot) *MockRuntimeConfigProvider_Current_Call {
79+ _c.Call.Return(run)
80+ return _c
81+}
82+
83+// OnChange provides a mock function for the type MockRuntimeConfigProvider
84+func (_mock *MockRuntimeConfigProvider) OnChange(fn func(entity.RuntimeConfigSnapshot)) {
85+ _mock.Called(fn)
86+ return
87+}
88+
89+// MockRuntimeConfigProvider_OnChange_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'OnChange'
90+type MockRuntimeConfigProvider_OnChange_Call struct {
91+ *mock.Call
92+}
93+
94+// OnChange is a helper method to define mock.On call
95+// - fn func(entity.RuntimeConfigSnapshot)
96+func (_e *MockRuntimeConfigProvider_Expecter) OnChange(fn any) *MockRuntimeConfigProvider_OnChange_Call {
97+ return &MockRuntimeConfigProvider_OnChange_Call{Call: _e.mock.On("OnChange", fn)}
98+}
99+
100+func (_c *MockRuntimeConfigProvider_OnChange_Call) Run(run func(fn func(entity.RuntimeConfigSnapshot))) *MockRuntimeConfigProvider_OnChange_Call {
101+ _c.Call.Run(func(args mock.Arguments) {
102+ var arg0 func(entity.RuntimeConfigSnapshot)
103+ if args[0] != nil {
104+ arg0 = args[0].(func(entity.RuntimeConfigSnapshot))
105+ }
106+ run(
107+ arg0,
108+ )
109+ })
110+ return _c
111+}
112+
113+func (_c *MockRuntimeConfigProvider_OnChange_Call) Return() *MockRuntimeConfigProvider_OnChange_Call {
114+ _c.Call.Return()
115+ return _c
116+}
117+
118+func (_c *MockRuntimeConfigProvider_OnChange_Call) RunAndReturn(run func(fn func(entity.RuntimeConfigSnapshot))) *MockRuntimeConfigProvider_OnChange_Call {
119+ _c.Run(run)
120+ return _c
121+}
122+
123+// Watch provides a mock function for the type MockRuntimeConfigProvider
124+func (_mock *MockRuntimeConfigProvider) Watch() error {
125+ ret := _mock.Called()
126+
127+ if len(ret) == 0 {
128+ panic("no return value specified for Watch")
129+ }
130+
131+ var r0 error
132+ if returnFunc, ok := ret.Get(0).(func() error); ok {
133+ r0 = returnFunc()
134+ } else {
135+ r0 = ret.Error(0)
136+ }
137+ return r0
138+}
139+
140+// MockRuntimeConfigProvider_Watch_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Watch'
141+type MockRuntimeConfigProvider_Watch_Call struct {
142+ *mock.Call
143+}
144+
145+// Watch is a helper method to define mock.On call
146+func (_e *MockRuntimeConfigProvider_Expecter) Watch() *MockRuntimeConfigProvider_Watch_Call {
147+ return &MockRuntimeConfigProvider_Watch_Call{Call: _e.mock.On("Watch")}
148+}
149+
150+func (_c *MockRuntimeConfigProvider_Watch_Call) Run(run func()) *MockRuntimeConfigProvider_Watch_Call {
151+ _c.Call.Run(func(args mock.Arguments) {
152+ run()
153+ })
154+ return _c
155+}
156+
157+func (_c *MockRuntimeConfigProvider_Watch_Call) Return(err error) *MockRuntimeConfigProvider_Watch_Call {
158+ _c.Call.Return(err)
159+ return _c
160+}
161+
162+func (_c *MockRuntimeConfigProvider_Watch_Call) RunAndReturn(run func() error) *MockRuntimeConfigProvider_Watch_Call {
163+ _c.Call.Return(run)
164+ return _c
165+}
A internal/application/port/mocks/session_logger.go +121 -0
@@ -0,0 +1,121 @@
1+// Code generated by mockery; DO NOT EDIT.
2+// github.com/vektra/mockery
3+// template: testify
4+
5+package mocks
6+
7+import (
8+ "context"
9+
10+ "github.com/bnema/dumber/internal/application/port"
11+ "github.com/bnema/dumber/internal/domain/entity"
12+ "github.com/rs/zerolog"
13+ mock "github.com/stretchr/testify/mock"
14+)
15+
16+// NewMockSessionLogger creates a new instance of MockSessionLogger. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
17+// The first argument is typically a *testing.T value.
18+func NewMockSessionLogger(t interface {
19+ mock.TestingT
20+ Cleanup(func())
21+}) *MockSessionLogger {
22+ mock := &MockSessionLogger{}
23+ mock.Mock.Test(t)
24+
25+ t.Cleanup(func() { mock.AssertExpectations(t) })
26+
27+ return mock
28+}
29+
30+// MockSessionLogger is an autogenerated mock type for the SessionLogger type
31+type MockSessionLogger struct {
32+ mock.Mock
33+}
34+
35+type MockSessionLogger_Expecter struct {
36+ mock *mock.Mock
37+}
38+
39+func (_m *MockSessionLogger) EXPECT() *MockSessionLogger_Expecter {
40+ return &MockSessionLogger_Expecter{mock: &_m.Mock}
41+}
42+
43+// CreateLogger provides a mock function for the type MockSessionLogger
44+func (_mock *MockSessionLogger) CreateLogger(ctx context.Context, sessionID entity.SessionID, cfg port.SessionLogConfig) (zerolog.Logger, func(), error) {
45+ ret := _mock.Called(ctx, sessionID, cfg)
46+
47+ if len(ret) == 0 {
48+ panic("no return value specified for CreateLogger")
49+ }
50+
51+ var r0 zerolog.Logger
52+ var r1 func()
53+ var r2 error
54+ if returnFunc, ok := ret.Get(0).(func(context.Context, entity.SessionID, port.SessionLogConfig) (zerolog.Logger, func(), error)); ok {
55+ return returnFunc(ctx, sessionID, cfg)
56+ }
57+ if returnFunc, ok := ret.Get(0).(func(context.Context, entity.SessionID, port.SessionLogConfig) zerolog.Logger); ok {
58+ r0 = returnFunc(ctx, sessionID, cfg)
59+ } else {
60+ r0 = ret.Get(0).(zerolog.Logger)
61+ }
62+ if returnFunc, ok := ret.Get(1).(func(context.Context, entity.SessionID, port.SessionLogConfig) func()); ok {
63+ r1 = returnFunc(ctx, sessionID, cfg)
64+ } else {
65+ if ret.Get(1) != nil {
66+ r1 = ret.Get(1).(func())
67+ }
68+ }
69+ if returnFunc, ok := ret.Get(2).(func(context.Context, entity.SessionID, port.SessionLogConfig) error); ok {
70+ r2 = returnFunc(ctx, sessionID, cfg)
71+ } else {
72+ r2 = ret.Error(2)
73+ }
74+ return r0, r1, r2
75+}
76+
77+// MockSessionLogger_CreateLogger_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'CreateLogger'
78+type MockSessionLogger_CreateLogger_Call struct {
79+ *mock.Call
80+}
81+
82+// CreateLogger is a helper method to define mock.On call
83+// - ctx context.Context
84+// - sessionID entity.SessionID
85+// - cfg port.SessionLogConfig
86+func (_e *MockSessionLogger_Expecter) CreateLogger(ctx any, sessionID any, cfg any) *MockSessionLogger_CreateLogger_Call {
87+ return &MockSessionLogger_CreateLogger_Call{Call: _e.mock.On("CreateLogger", ctx, sessionID, cfg)}
88+}
89+
90+func (_c *MockSessionLogger_CreateLogger_Call) Run(run func(ctx context.Context, sessionID entity.SessionID, cfg port.SessionLogConfig)) *MockSessionLogger_CreateLogger_Call {
91+ _c.Call.Run(func(args mock.Arguments) {
92+ var arg0 context.Context
93+ if args[0] != nil {
94+ arg0 = args[0].(context.Context)
95+ }
96+ var arg1 entity.SessionID
97+ if args[1] != nil {
98+ arg1 = args[1].(entity.SessionID)
99+ }
100+ var arg2 port.SessionLogConfig
101+ if args[2] != nil {
102+ arg2 = args[2].(port.SessionLogConfig)
103+ }
104+ run(
105+ arg0,
106+ arg1,
107+ arg2,
108+ )
109+ })
110+ return _c
111+}
112+
113+func (_c *MockSessionLogger_CreateLogger_Call) Return(logger zerolog.Logger, fn func(), err error) *MockSessionLogger_CreateLogger_Call {
114+ _c.Call.Return(logger, fn, err)
115+ return _c
116+}
117+
118+func (_c *MockSessionLogger_CreateLogger_Call) RunAndReturn(run func(ctx context.Context, sessionID entity.SessionID, cfg port.SessionLogConfig) (zerolog.Logger, func(), error)) *MockSessionLogger_CreateLogger_Call {
119+ _c.Call.Return(run)
120+ return _c
121+}
A internal/application/port/mocks/session_process.go +104 -0
@@ -0,0 +1,104 @@
1+// Code generated by mockery; DO NOT EDIT.
2+// github.com/vektra/mockery
3+// template: testify
4+
5+package mocks
6+
7+import (
8+ "context"
9+
10+ mock "github.com/stretchr/testify/mock"
11+)
12+
13+// NewMockSessionProcessProbe creates a new instance of MockSessionProcessProbe. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
14+// The first argument is typically a *testing.T value.
15+func NewMockSessionProcessProbe(t interface {
16+ mock.TestingT
17+ Cleanup(func())
18+}) *MockSessionProcessProbe {
19+ mock := &MockSessionProcessProbe{}
20+ mock.Mock.Test(t)
21+
22+ t.Cleanup(func() { mock.AssertExpectations(t) })
23+
24+ return mock
25+}
26+
27+// MockSessionProcessProbe is an autogenerated mock type for the SessionProcessProbe type
28+type MockSessionProcessProbe struct {
29+ mock.Mock
30+}
31+
32+type MockSessionProcessProbe_Expecter struct {
33+ mock *mock.Mock
34+}
35+
36+func (_m *MockSessionProcessProbe) EXPECT() *MockSessionProcessProbe_Expecter {
37+ return &MockSessionProcessProbe_Expecter{mock: &_m.Mock}
38+}
39+
40+// IsProcessAlive provides a mock function for the type MockSessionProcessProbe
41+func (_mock *MockSessionProcessProbe) IsProcessAlive(ctx context.Context, pid int) (bool, error) {
42+ ret := _mock.Called(ctx, pid)
43+
44+ if len(ret) == 0 {
45+ panic("no return value specified for IsProcessAlive")
46+ }
47+
48+ var r0 bool
49+ var r1 error
50+ if returnFunc, ok := ret.Get(0).(func(context.Context, int) (bool, error)); ok {
51+ return returnFunc(ctx, pid)
52+ }
53+ if returnFunc, ok := ret.Get(0).(func(context.Context, int) bool); ok {
54+ r0 = returnFunc(ctx, pid)
55+ } else {
56+ r0 = ret.Get(0).(bool)
57+ }
58+ if returnFunc, ok := ret.Get(1).(func(context.Context, int) error); ok {
59+ r1 = returnFunc(ctx, pid)
60+ } else {
61+ r1 = ret.Error(1)
62+ }
63+ return r0, r1
64+}
65+
66+// MockSessionProcessProbe_IsProcessAlive_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'IsProcessAlive'
67+type MockSessionProcessProbe_IsProcessAlive_Call struct {
68+ *mock.Call
69+}
70+
71+// IsProcessAlive is a helper method to define mock.On call
72+// - ctx context.Context
73+// - pid int
74+func (_e *MockSessionProcessProbe_Expecter) IsProcessAlive(ctx any, pid any) *MockSessionProcessProbe_IsProcessAlive_Call {
75+ return &MockSessionProcessProbe_IsProcessAlive_Call{Call: _e.mock.On("IsProcessAlive", ctx, pid)}
76+}
77+
78+func (_c *MockSessionProcessProbe_IsProcessAlive_Call) Run(run func(ctx context.Context, pid int)) *MockSessionProcessProbe_IsProcessAlive_Call {
79+ _c.Call.Run(func(args mock.Arguments) {
80+ var arg0 context.Context
81+ if args[0] != nil {
82+ arg0 = args[0].(context.Context)
83+ }
84+ var arg1 int
85+ if args[1] != nil {
86+ arg1 = args[1].(int)
87+ }
88+ run(
89+ arg0,
90+ arg1,
91+ )
92+ })
93+ return _c
94+}
95+
96+func (_c *MockSessionProcessProbe_IsProcessAlive_Call) Return(b bool, err error) *MockSessionProcessProbe_IsProcessAlive_Call {
97+ _c.Call.Return(b, err)
98+ return _c
99+}
100+
101+func (_c *MockSessionProcessProbe_IsProcessAlive_Call) RunAndReturn(run func(ctx context.Context, pid int) (bool, error)) *MockSessionProcessProbe_IsProcessAlive_Call {
102+ _c.Call.Return(run)
103+ return _c
104+}
A internal/application/port/mocks/session_state.go +541 -0
@@ -0,0 +1,541 @@
1+// Code generated by mockery; DO NOT EDIT.
2+// github.com/vektra/mockery
3+// template: testify
4+
5+package mocks
6+
7+import (
8+ "context"
9+
10+ "github.com/bnema/dumber/internal/domain/entity"
11+ mock "github.com/stretchr/testify/mock"
12+)
13+
14+// NewMockWindowStateProvider creates a new instance of MockWindowStateProvider. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
15+// The first argument is typically a *testing.T value.
16+func NewMockWindowStateProvider(t interface {
17+ mock.TestingT
18+ Cleanup(func())
19+}) *MockWindowStateProvider {
20+ mock := &MockWindowStateProvider{}
21+ mock.Mock.Test(t)
22+
23+ t.Cleanup(func() { mock.AssertExpectations(t) })
24+
25+ return mock
26+}
27+
28+// MockWindowStateProvider is an autogenerated mock type for the WindowStateProvider type
29+type MockWindowStateProvider struct {
30+ mock.Mock
31+}
32+
33+type MockWindowStateProvider_Expecter struct {
34+ mock *mock.Mock
35+}
36+
37+func (_m *MockWindowStateProvider) EXPECT() *MockWindowStateProvider_Expecter {
38+ return &MockWindowStateProvider_Expecter{mock: &_m.Mock}
39+}
40+
41+// GetActiveWindowIndex provides a mock function for the type MockWindowStateProvider
42+func (_mock *MockWindowStateProvider) GetActiveWindowIndex() int {
43+ ret := _mock.Called()
44+
45+ if len(ret) == 0 {
46+ panic("no return value specified for GetActiveWindowIndex")
47+ }
48+
49+ var r0 int
50+ if returnFunc, ok := ret.Get(0).(func() int); ok {
51+ r0 = returnFunc()
52+ } else {
53+ r0 = ret.Get(0).(int)
54+ }
55+ return r0
56+}
57+
58+// MockWindowStateProvider_GetActiveWindowIndex_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetActiveWindowIndex'
59+type MockWindowStateProvider_GetActiveWindowIndex_Call struct {
60+ *mock.Call
61+}
62+
63+// GetActiveWindowIndex is a helper method to define mock.On call
64+func (_e *MockWindowStateProvider_Expecter) GetActiveWindowIndex() *MockWindowStateProvider_GetActiveWindowIndex_Call {
65+ return &MockWindowStateProvider_GetActiveWindowIndex_Call{Call: _e.mock.On("GetActiveWindowIndex")}
66+}
67+
68+func (_c *MockWindowStateProvider_GetActiveWindowIndex_Call) Run(run func()) *MockWindowStateProvider_GetActiveWindowIndex_Call {
69+ _c.Call.Run(func(args mock.Arguments) {
70+ run()
71+ })
72+ return _c
73+}
74+
75+func (_c *MockWindowStateProvider_GetActiveWindowIndex_Call) Return(n int) *MockWindowStateProvider_GetActiveWindowIndex_Call {
76+ _c.Call.Return(n)
77+ return _c
78+}
79+
80+func (_c *MockWindowStateProvider_GetActiveWindowIndex_Call) RunAndReturn(run func() int) *MockWindowStateProvider_GetActiveWindowIndex_Call {
81+ _c.Call.Return(run)
82+ return _c
83+}
84+
85+// GetSessionID provides a mock function for the type MockWindowStateProvider
86+func (_mock *MockWindowStateProvider) GetSessionID() entity.SessionID {
87+ ret := _mock.Called()
88+
89+ if len(ret) == 0 {
90+ panic("no return value specified for GetSessionID")
91+ }
92+
93+ var r0 entity.SessionID
94+ if returnFunc, ok := ret.Get(0).(func() entity.SessionID); ok {
95+ r0 = returnFunc()
96+ } else {
97+ r0 = ret.Get(0).(entity.SessionID)
98+ }
99+ return r0
100+}
101+
102+// MockWindowStateProvider_GetSessionID_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetSessionID'
103+type MockWindowStateProvider_GetSessionID_Call struct {
104+ *mock.Call
105+}
106+
107+// GetSessionID is a helper method to define mock.On call
108+func (_e *MockWindowStateProvider_Expecter) GetSessionID() *MockWindowStateProvider_GetSessionID_Call {
109+ return &MockWindowStateProvider_GetSessionID_Call{Call: _e.mock.On("GetSessionID")}
110+}
111+
112+func (_c *MockWindowStateProvider_GetSessionID_Call) Run(run func()) *MockWindowStateProvider_GetSessionID_Call {
113+ _c.Call.Run(func(args mock.Arguments) {
114+ run()
115+ })
116+ return _c
117+}
118+
119+func (_c *MockWindowStateProvider_GetSessionID_Call) Return(sessionID entity.SessionID) *MockWindowStateProvider_GetSessionID_Call {
120+ _c.Call.Return(sessionID)
121+ return _c
122+}
123+
124+func (_c *MockWindowStateProvider_GetSessionID_Call) RunAndReturn(run func() entity.SessionID) *MockWindowStateProvider_GetSessionID_Call {
125+ _c.Call.Return(run)
126+ return _c
127+}
128+
129+// GetWindowSnapshotState provides a mock function for the type MockWindowStateProvider
130+func (_mock *MockWindowStateProvider) GetWindowSnapshotState() ([]entity.WindowTabListState, int) {
131+ ret := _mock.Called()
132+
133+ if len(ret) == 0 {
134+ panic("no return value specified for GetWindowSnapshotState")
135+ }
136+
137+ var r0 []entity.WindowTabListState
138+ var r1 int
139+ if returnFunc, ok := ret.Get(0).(func() ([]entity.WindowTabListState, int)); ok {
140+ return returnFunc()
141+ }
142+ if returnFunc, ok := ret.Get(0).(func() []entity.WindowTabListState); ok {
143+ r0 = returnFunc()
144+ } else {
145+ if ret.Get(0) != nil {
146+ r0 = ret.Get(0).([]entity.WindowTabListState)
147+ }
148+ }
149+ if returnFunc, ok := ret.Get(1).(func() int); ok {
150+ r1 = returnFunc()
151+ } else {
152+ r1 = ret.Get(1).(int)
153+ }
154+ return r0, r1
155+}
156+
157+// MockWindowStateProvider_GetWindowSnapshotState_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetWindowSnapshotState'
158+type MockWindowStateProvider_GetWindowSnapshotState_Call struct {
159+ *mock.Call
160+}
161+
162+// GetWindowSnapshotState is a helper method to define mock.On call
163+func (_e *MockWindowStateProvider_Expecter) GetWindowSnapshotState() *MockWindowStateProvider_GetWindowSnapshotState_Call {
164+ return &MockWindowStateProvider_GetWindowSnapshotState_Call{Call: _e.mock.On("GetWindowSnapshotState")}
165+}
166+
167+func (_c *MockWindowStateProvider_GetWindowSnapshotState_Call) Run(run func()) *MockWindowStateProvider_GetWindowSnapshotState_Call {
168+ _c.Call.Run(func(args mock.Arguments) {
169+ run()
170+ })
171+ return _c
172+}
173+
174+func (_c *MockWindowStateProvider_GetWindowSnapshotState_Call) Return(windowTabListStates []entity.WindowTabListState, n int) *MockWindowStateProvider_GetWindowSnapshotState_Call {
175+ _c.Call.Return(windowTabListStates, n)
176+ return _c
177+}
178+
179+func (_c *MockWindowStateProvider_GetWindowSnapshotState_Call) RunAndReturn(run func() ([]entity.WindowTabListState, int)) *MockWindowStateProvider_GetWindowSnapshotState_Call {
180+ _c.Call.Return(run)
181+ return _c
182+}
183+
184+// GetWindowTabLists provides a mock function for the type MockWindowStateProvider
185+func (_mock *MockWindowStateProvider) GetWindowTabLists() []entity.WindowTabListState {
186+ ret := _mock.Called()
187+
188+ if len(ret) == 0 {
189+ panic("no return value specified for GetWindowTabLists")
190+ }
191+
192+ var r0 []entity.WindowTabListState
193+ if returnFunc, ok := ret.Get(0).(func() []entity.WindowTabListState); ok {
194+ r0 = returnFunc()
195+ } else {
196+ if ret.Get(0) != nil {
197+ r0 = ret.Get(0).([]entity.WindowTabListState)
198+ }
199+ }
200+ return r0
201+}
202+
203+// MockWindowStateProvider_GetWindowTabLists_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetWindowTabLists'
204+type MockWindowStateProvider_GetWindowTabLists_Call struct {
205+ *mock.Call
206+}
207+
208+// GetWindowTabLists is a helper method to define mock.On call
209+func (_e *MockWindowStateProvider_Expecter) GetWindowTabLists() *MockWindowStateProvider_GetWindowTabLists_Call {
210+ return &MockWindowStateProvider_GetWindowTabLists_Call{Call: _e.mock.On("GetWindowTabLists")}
211+}
212+
213+func (_c *MockWindowStateProvider_GetWindowTabLists_Call) Run(run func()) *MockWindowStateProvider_GetWindowTabLists_Call {
214+ _c.Call.Run(func(args mock.Arguments) {
215+ run()
216+ })
217+ return _c
218+}
219+
220+func (_c *MockWindowStateProvider_GetWindowTabLists_Call) Return(windowTabListStates []entity.WindowTabListState) *MockWindowStateProvider_GetWindowTabLists_Call {
221+ _c.Call.Return(windowTabListStates)
222+ return _c
223+}
224+
225+func (_c *MockWindowStateProvider_GetWindowTabLists_Call) RunAndReturn(run func() []entity.WindowTabListState) *MockWindowStateProvider_GetWindowTabLists_Call {
226+ _c.Call.Return(run)
227+ return _c
228+}
229+
230+// NewMockSessionSpawner creates a new instance of MockSessionSpawner. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
231+// The first argument is typically a *testing.T value.
232+func NewMockSessionSpawner(t interface {
233+ mock.TestingT
234+ Cleanup(func())
235+}) *MockSessionSpawner {
236+ mock := &MockSessionSpawner{}
237+ mock.Mock.Test(t)
238+
239+ t.Cleanup(func() { mock.AssertExpectations(t) })
240+
241+ return mock
242+}
243+
244+// MockSessionSpawner is an autogenerated mock type for the SessionSpawner type
245+type MockSessionSpawner struct {
246+ mock.Mock
247+}
248+
249+type MockSessionSpawner_Expecter struct {
250+ mock *mock.Mock
251+}
252+
253+func (_m *MockSessionSpawner) EXPECT() *MockSessionSpawner_Expecter {
254+ return &MockSessionSpawner_Expecter{mock: &_m.Mock}
255+}
256+
257+// SpawnWithSession provides a mock function for the type MockSessionSpawner
258+func (_mock *MockSessionSpawner) SpawnWithSession(sessionID entity.SessionID) error {
259+ ret := _mock.Called(sessionID)
260+
261+ if len(ret) == 0 {
262+ panic("no return value specified for SpawnWithSession")
263+ }
264+
265+ var r0 error
266+ if returnFunc, ok := ret.Get(0).(func(entity.SessionID) error); ok {
267+ r0 = returnFunc(sessionID)
268+ } else {
269+ r0 = ret.Error(0)
270+ }
271+ return r0
272+}
273+
274+// MockSessionSpawner_SpawnWithSession_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'SpawnWithSession'
275+type MockSessionSpawner_SpawnWithSession_Call struct {
276+ *mock.Call
277+}
278+
279+// SpawnWithSession is a helper method to define mock.On call
280+// - sessionID entity.SessionID
281+func (_e *MockSessionSpawner_Expecter) SpawnWithSession(sessionID any) *MockSessionSpawner_SpawnWithSession_Call {
282+ return &MockSessionSpawner_SpawnWithSession_Call{Call: _e.mock.On("SpawnWithSession", sessionID)}
283+}
284+
285+func (_c *MockSessionSpawner_SpawnWithSession_Call) Run(run func(sessionID entity.SessionID)) *MockSessionSpawner_SpawnWithSession_Call {
286+ _c.Call.Run(func(args mock.Arguments) {
287+ var arg0 entity.SessionID
288+ if args[0] != nil {
289+ arg0 = args[0].(entity.SessionID)
290+ }
291+ run(
292+ arg0,
293+ )
294+ })
295+ return _c
296+}
297+
298+func (_c *MockSessionSpawner_SpawnWithSession_Call) Return(err error) *MockSessionSpawner_SpawnWithSession_Call {
299+ _c.Call.Return(err)
300+ return _c
301+}
302+
303+func (_c *MockSessionSpawner_SpawnWithSession_Call) RunAndReturn(run func(sessionID entity.SessionID) error) *MockSessionSpawner_SpawnWithSession_Call {
304+ _c.Call.Return(run)
305+ return _c
306+}
307+
308+// NewMockSnapshotService creates a new instance of MockSnapshotService. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
309+// The first argument is typically a *testing.T value.
310+func NewMockSnapshotService(t interface {
311+ mock.TestingT
312+ Cleanup(func())
313+}) *MockSnapshotService {
314+ mock := &MockSnapshotService{}
315+ mock.Mock.Test(t)
316+
317+ t.Cleanup(func() { mock.AssertExpectations(t) })
318+
319+ return mock
320+}
321+
322+// MockSnapshotService is an autogenerated mock type for the SnapshotService type
323+type MockSnapshotService struct {
324+ mock.Mock
325+}
326+
327+type MockSnapshotService_Expecter struct {
328+ mock *mock.Mock
329+}
330+
331+func (_m *MockSnapshotService) EXPECT() *MockSnapshotService_Expecter {
332+ return &MockSnapshotService_Expecter{mock: &_m.Mock}
333+}
334+
335+// MarkDirty provides a mock function for the type MockSnapshotService
336+func (_mock *MockSnapshotService) MarkDirty() {
337+ _mock.Called()
338+ return
339+}
340+
341+// MockSnapshotService_MarkDirty_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'MarkDirty'
342+type MockSnapshotService_MarkDirty_Call struct {
343+ *mock.Call
344+}
345+
346+// MarkDirty is a helper method to define mock.On call
347+func (_e *MockSnapshotService_Expecter) MarkDirty() *MockSnapshotService_MarkDirty_Call {
348+ return &MockSnapshotService_MarkDirty_Call{Call: _e.mock.On("MarkDirty")}
349+}
350+
351+func (_c *MockSnapshotService_MarkDirty_Call) Run(run func()) *MockSnapshotService_MarkDirty_Call {
352+ _c.Call.Run(func(args mock.Arguments) {
353+ run()
354+ })
355+ return _c
356+}
357+
358+func (_c *MockSnapshotService_MarkDirty_Call) Return() *MockSnapshotService_MarkDirty_Call {
359+ _c.Call.Return()
360+ return _c
361+}
362+
363+func (_c *MockSnapshotService_MarkDirty_Call) RunAndReturn(run func()) *MockSnapshotService_MarkDirty_Call {
364+ _c.Run(run)
365+ return _c
366+}
367+
368+// SaveNow provides a mock function for the type MockSnapshotService
369+func (_mock *MockSnapshotService) SaveNow(ctx context.Context) error {
370+ ret := _mock.Called(ctx)
371+
372+ if len(ret) == 0 {
373+ panic("no return value specified for SaveNow")
374+ }
375+
376+ var r0 error
377+ if returnFunc, ok := ret.Get(0).(func(context.Context) error); ok {
378+ r0 = returnFunc(ctx)
379+ } else {
380+ r0 = ret.Error(0)
381+ }
382+ return r0
383+}
384+
385+// MockSnapshotService_SaveNow_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'SaveNow'
386+type MockSnapshotService_SaveNow_Call struct {
387+ *mock.Call
388+}
389+
390+// SaveNow is a helper method to define mock.On call
391+// - ctx context.Context
392+func (_e *MockSnapshotService_Expecter) SaveNow(ctx any) *MockSnapshotService_SaveNow_Call {
393+ return &MockSnapshotService_SaveNow_Call{Call: _e.mock.On("SaveNow", ctx)}
394+}
395+
396+func (_c *MockSnapshotService_SaveNow_Call) Run(run func(ctx context.Context)) *MockSnapshotService_SaveNow_Call {
397+ _c.Call.Run(func(args mock.Arguments) {
398+ var arg0 context.Context
399+ if args[0] != nil {
400+ arg0 = args[0].(context.Context)
401+ }
402+ run(
403+ arg0,
404+ )
405+ })
406+ return _c
407+}
408+
409+func (_c *MockSnapshotService_SaveNow_Call) Return(err error) *MockSnapshotService_SaveNow_Call {
410+ _c.Call.Return(err)
411+ return _c
412+}
413+
414+func (_c *MockSnapshotService_SaveNow_Call) RunAndReturn(run func(ctx context.Context) error) *MockSnapshotService_SaveNow_Call {
415+ _c.Call.Return(run)
416+ return _c
417+}
418+
419+// SetReady provides a mock function for the type MockSnapshotService
420+func (_mock *MockSnapshotService) SetReady() {
421+ _mock.Called()
422+ return
423+}
424+
425+// MockSnapshotService_SetReady_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'SetReady'
426+type MockSnapshotService_SetReady_Call struct {
427+ *mock.Call
428+}
429+
430+// SetReady is a helper method to define mock.On call
431+func (_e *MockSnapshotService_Expecter) SetReady() *MockSnapshotService_SetReady_Call {
432+ return &MockSnapshotService_SetReady_Call{Call: _e.mock.On("SetReady")}
433+}
434+
435+func (_c *MockSnapshotService_SetReady_Call) Run(run func()) *MockSnapshotService_SetReady_Call {
436+ _c.Call.Run(func(args mock.Arguments) {
437+ run()
438+ })
439+ return _c
440+}
441+
442+func (_c *MockSnapshotService_SetReady_Call) Return() *MockSnapshotService_SetReady_Call {
443+ _c.Call.Return()
444+ return _c
445+}
446+
447+func (_c *MockSnapshotService_SetReady_Call) RunAndReturn(run func()) *MockSnapshotService_SetReady_Call {
448+ _c.Run(run)
449+ return _c
450+}
451+
452+// Start provides a mock function for the type MockSnapshotService
453+func (_mock *MockSnapshotService) Start(ctx context.Context) {
454+ _mock.Called(ctx)
455+ return
456+}
457+
458+// MockSnapshotService_Start_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Start'
459+type MockSnapshotService_Start_Call struct {
460+ *mock.Call
461+}
462+
463+// Start is a helper method to define mock.On call
464+// - ctx context.Context
465+func (_e *MockSnapshotService_Expecter) Start(ctx any) *MockSnapshotService_Start_Call {
466+ return &MockSnapshotService_Start_Call{Call: _e.mock.On("Start", ctx)}
467+}
468+
469+func (_c *MockSnapshotService_Start_Call) Run(run func(ctx context.Context)) *MockSnapshotService_Start_Call {
470+ _c.Call.Run(func(args mock.Arguments) {
471+ var arg0 context.Context
472+ if args[0] != nil {
473+ arg0 = args[0].(context.Context)
474+ }
475+ run(
476+ arg0,
477+ )
478+ })
479+ return _c
480+}
481+
482+func (_c *MockSnapshotService_Start_Call) Return() *MockSnapshotService_Start_Call {
483+ _c.Call.Return()
484+ return _c
485+}
486+
487+func (_c *MockSnapshotService_Start_Call) RunAndReturn(run func(ctx context.Context)) *MockSnapshotService_Start_Call {
488+ _c.Run(run)
489+ return _c
490+}
491+
492+// Stop provides a mock function for the type MockSnapshotService
493+func (_mock *MockSnapshotService) Stop(ctx context.Context) error {
494+ ret := _mock.Called(ctx)
495+
496+ if len(ret) == 0 {
497+ panic("no return value specified for Stop")
498+ }
499+
500+ var r0 error
501+ if returnFunc, ok := ret.Get(0).(func(context.Context) error); ok {
502+ r0 = returnFunc(ctx)
503+ } else {
504+ r0 = ret.Error(0)
505+ }
506+ return r0
507+}
508+
509+// MockSnapshotService_Stop_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Stop'
510+type MockSnapshotService_Stop_Call struct {
511+ *mock.Call
512+}
513+
514+// Stop is a helper method to define mock.On call
515+// - ctx context.Context
516+func (_e *MockSnapshotService_Expecter) Stop(ctx any) *MockSnapshotService_Stop_Call {
517+ return &MockSnapshotService_Stop_Call{Call: _e.mock.On("Stop", ctx)}
518+}
519+
520+func (_c *MockSnapshotService_Stop_Call) Run(run func(ctx context.Context)) *MockSnapshotService_Stop_Call {
521+ _c.Call.Run(func(args mock.Arguments) {
522+ var arg0 context.Context
523+ if args[0] != nil {
524+ arg0 = args[0].(context.Context)
525+ }
526+ run(
527+ arg0,
528+ )
529+ })
530+ return _c
531+}
532+
533+func (_c *MockSnapshotService_Stop_Call) Return(err error) *MockSnapshotService_Stop_Call {
534+ _c.Call.Return(err)
535+ return _c
536+}
537+
538+func (_c *MockSnapshotService_Stop_Call) RunAndReturn(run func(ctx context.Context) error) *MockSnapshotService_Stop_Call {
539+ _c.Call.Return(run)
540+ return _c
541+}
A internal/application/port/mocks/text_input.go +518 -0
@@ -0,0 +1,518 @@
1+// Code generated by mockery; DO NOT EDIT.
2+// github.com/vektra/mockery
3+// template: testify
4+
5+package mocks
6+
7+import (
8+ "context"
9+
10+ "github.com/bnema/dumber/internal/application/port"
11+ mock "github.com/stretchr/testify/mock"
12+)
13+
14+// NewMockTextInputTarget creates a new instance of MockTextInputTarget. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
15+// The first argument is typically a *testing.T value.
16+func NewMockTextInputTarget(t interface {
17+ mock.TestingT
18+ Cleanup(func())
19+}) *MockTextInputTarget {
20+ mock := &MockTextInputTarget{}
21+ mock.Mock.Test(t)
22+
23+ t.Cleanup(func() { mock.AssertExpectations(t) })
24+
25+ return mock
26+}
27+
28+// MockTextInputTarget is an autogenerated mock type for the TextInputTarget type
29+type MockTextInputTarget struct {
30+ mock.Mock
31+}
32+
33+type MockTextInputTarget_Expecter struct {
34+ mock *mock.Mock
35+}
36+
37+func (_m *MockTextInputTarget) EXPECT() *MockTextInputTarget_Expecter {
38+ return &MockTextInputTarget_Expecter{mock: &_m.Mock}
39+}
40+
41+// DeleteBeforeCursor provides a mock function for the type MockTextInputTarget
42+func (_mock *MockTextInputTarget) DeleteBeforeCursor(ctx context.Context, n int) error {
43+ ret := _mock.Called(ctx, n)
44+
45+ if len(ret) == 0 {
46+ panic("no return value specified for DeleteBeforeCursor")
47+ }
48+
49+ var r0 error
50+ if returnFunc, ok := ret.Get(0).(func(context.Context, int) error); ok {
51+ r0 = returnFunc(ctx, n)
52+ } else {
53+ r0 = ret.Error(0)
54+ }
55+ return r0
56+}
57+
58+// MockTextInputTarget_DeleteBeforeCursor_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'DeleteBeforeCursor'
59+type MockTextInputTarget_DeleteBeforeCursor_Call struct {
60+ *mock.Call
61+}
62+
63+// DeleteBeforeCursor is a helper method to define mock.On call
64+// - ctx context.Context
65+// - n int
66+func (_e *MockTextInputTarget_Expecter) DeleteBeforeCursor(ctx any, n any) *MockTextInputTarget_DeleteBeforeCursor_Call {
67+ return &MockTextInputTarget_DeleteBeforeCursor_Call{Call: _e.mock.On("DeleteBeforeCursor", ctx, n)}
68+}
69+
70+func (_c *MockTextInputTarget_DeleteBeforeCursor_Call) Run(run func(ctx context.Context, n int)) *MockTextInputTarget_DeleteBeforeCursor_Call {
71+ _c.Call.Run(func(args mock.Arguments) {
72+ var arg0 context.Context
73+ if args[0] != nil {
74+ arg0 = args[0].(context.Context)
75+ }
76+ var arg1 int
77+ if args[1] != nil {
78+ arg1 = args[1].(int)
79+ }
80+ run(
81+ arg0,
82+ arg1,
83+ )
84+ })
85+ return _c
86+}
87+
88+func (_c *MockTextInputTarget_DeleteBeforeCursor_Call) Return(err error) *MockTextInputTarget_DeleteBeforeCursor_Call {
89+ _c.Call.Return(err)
90+ return _c
91+}
92+
93+func (_c *MockTextInputTarget_DeleteBeforeCursor_Call) RunAndReturn(run func(ctx context.Context, n int) error) *MockTextInputTarget_DeleteBeforeCursor_Call {
94+ _c.Call.Return(run)
95+ return _c
96+}
97+
98+// InsertText provides a mock function for the type MockTextInputTarget
99+func (_mock *MockTextInputTarget) InsertText(ctx context.Context, text string) error {
100+ ret := _mock.Called(ctx, text)
101+
102+ if len(ret) == 0 {
103+ panic("no return value specified for InsertText")
104+ }
105+
106+ var r0 error
107+ if returnFunc, ok := ret.Get(0).(func(context.Context, string) error); ok {
108+ r0 = returnFunc(ctx, text)
109+ } else {
110+ r0 = ret.Error(0)
111+ }
112+ return r0
113+}
114+
115+// MockTextInputTarget_InsertText_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'InsertText'
116+type MockTextInputTarget_InsertText_Call struct {
117+ *mock.Call
118+}
119+
120+// InsertText is a helper method to define mock.On call
121+// - ctx context.Context
122+// - text string
123+func (_e *MockTextInputTarget_Expecter) InsertText(ctx any, text any) *MockTextInputTarget_InsertText_Call {
124+ return &MockTextInputTarget_InsertText_Call{Call: _e.mock.On("InsertText", ctx, text)}
125+}
126+
127+func (_c *MockTextInputTarget_InsertText_Call) Run(run func(ctx context.Context, text string)) *MockTextInputTarget_InsertText_Call {
128+ _c.Call.Run(func(args mock.Arguments) {
129+ var arg0 context.Context
130+ if args[0] != nil {
131+ arg0 = args[0].(context.Context)
132+ }
133+ var arg1 string
134+ if args[1] != nil {
135+ arg1 = args[1].(string)
136+ }
137+ run(
138+ arg0,
139+ arg1,
140+ )
141+ })
142+ return _c
143+}
144+
145+func (_c *MockTextInputTarget_InsertText_Call) Return(err error) *MockTextInputTarget_InsertText_Call {
146+ _c.Call.Return(err)
147+ return _c
148+}
149+
150+func (_c *MockTextInputTarget_InsertText_Call) RunAndReturn(run func(ctx context.Context, text string) error) *MockTextInputTarget_InsertText_Call {
151+ _c.Call.Return(run)
152+ return _c
153+}
154+
155+// NewMockFocusable creates a new instance of MockFocusable. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
156+// The first argument is typically a *testing.T value.
157+func NewMockFocusable(t interface {
158+ mock.TestingT
159+ Cleanup(func())
160+}) *MockFocusable {
161+ mock := &MockFocusable{}
162+ mock.Mock.Test(t)
163+
164+ t.Cleanup(func() { mock.AssertExpectations(t) })
165+
166+ return mock
167+}
168+
169+// MockFocusable is an autogenerated mock type for the Focusable type
170+type MockFocusable struct {
171+ mock.Mock
172+}
173+
174+type MockFocusable_Expecter struct {
175+ mock *mock.Mock
176+}
177+
178+func (_m *MockFocusable) EXPECT() *MockFocusable_Expecter {
179+ return &MockFocusable_Expecter{mock: &_m.Mock}
180+}
181+
182+// Focus provides a mock function for the type MockFocusable
183+func (_mock *MockFocusable) Focus(ctx context.Context) {
184+ _mock.Called(ctx)
185+ return
186+}
187+
188+// MockFocusable_Focus_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Focus'
189+type MockFocusable_Focus_Call struct {
190+ *mock.Call
191+}
192+
193+// Focus is a helper method to define mock.On call
194+// - ctx context.Context
195+func (_e *MockFocusable_Expecter) Focus(ctx any) *MockFocusable_Focus_Call {
196+ return &MockFocusable_Focus_Call{Call: _e.mock.On("Focus", ctx)}
197+}
198+
199+func (_c *MockFocusable_Focus_Call) Run(run func(ctx context.Context)) *MockFocusable_Focus_Call {
200+ _c.Call.Run(func(args mock.Arguments) {
201+ var arg0 context.Context
202+ if args[0] != nil {
203+ arg0 = args[0].(context.Context)
204+ }
205+ run(
206+ arg0,
207+ )
208+ })
209+ return _c
210+}
211+
212+func (_c *MockFocusable_Focus_Call) Return() *MockFocusable_Focus_Call {
213+ _c.Call.Return()
214+ return _c
215+}
216+
217+func (_c *MockFocusable_Focus_Call) RunAndReturn(run func(ctx context.Context)) *MockFocusable_Focus_Call {
218+ _c.Run(run)
219+ return _c
220+}
221+
222+// NewMockEntryInputTarget creates a new instance of MockEntryInputTarget. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
223+// The first argument is typically a *testing.T value.
224+func NewMockEntryInputTarget(t interface {
225+ mock.TestingT
226+ Cleanup(func())
227+}) *MockEntryInputTarget {
228+ mock := &MockEntryInputTarget{}
229+ mock.Mock.Test(t)
230+
231+ t.Cleanup(func() { mock.AssertExpectations(t) })
232+
233+ return mock
234+}
235+
236+// MockEntryInputTarget is an autogenerated mock type for the EntryInputTarget type
237+type MockEntryInputTarget struct {
238+ mock.Mock
239+}
240+
241+type MockEntryInputTarget_Expecter struct {
242+ mock *mock.Mock
243+}
244+
245+func (_m *MockEntryInputTarget) EXPECT() *MockEntryInputTarget_Expecter {
246+ return &MockEntryInputTarget_Expecter{mock: &_m.Mock}
247+}
248+
249+// DeleteBeforeCursor provides a mock function for the type MockEntryInputTarget
250+func (_mock *MockEntryInputTarget) DeleteBeforeCursor(ctx context.Context, n int) error {
251+ ret := _mock.Called(ctx, n)
252+
253+ if len(ret) == 0 {
254+ panic("no return value specified for DeleteBeforeCursor")
255+ }
256+
257+ var r0 error
258+ if returnFunc, ok := ret.Get(0).(func(context.Context, int) error); ok {
259+ r0 = returnFunc(ctx, n)
260+ } else {
261+ r0 = ret.Error(0)
262+ }
263+ return r0
264+}
265+
266+// MockEntryInputTarget_DeleteBeforeCursor_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'DeleteBeforeCursor'
267+type MockEntryInputTarget_DeleteBeforeCursor_Call struct {
268+ *mock.Call
269+}
270+
271+// DeleteBeforeCursor is a helper method to define mock.On call
272+// - ctx context.Context
273+// - n int
274+func (_e *MockEntryInputTarget_Expecter) DeleteBeforeCursor(ctx any, n any) *MockEntryInputTarget_DeleteBeforeCursor_Call {
275+ return &MockEntryInputTarget_DeleteBeforeCursor_Call{Call: _e.mock.On("DeleteBeforeCursor", ctx, n)}
276+}
277+
278+func (_c *MockEntryInputTarget_DeleteBeforeCursor_Call) Run(run func(ctx context.Context, n int)) *MockEntryInputTarget_DeleteBeforeCursor_Call {
279+ _c.Call.Run(func(args mock.Arguments) {
280+ var arg0 context.Context
281+ if args[0] != nil {
282+ arg0 = args[0].(context.Context)
283+ }
284+ var arg1 int
285+ if args[1] != nil {
286+ arg1 = args[1].(int)
287+ }
288+ run(
289+ arg0,
290+ arg1,
291+ )
292+ })
293+ return _c
294+}
295+
296+func (_c *MockEntryInputTarget_DeleteBeforeCursor_Call) Return(err error) *MockEntryInputTarget_DeleteBeforeCursor_Call {
297+ _c.Call.Return(err)
298+ return _c
299+}
300+
301+func (_c *MockEntryInputTarget_DeleteBeforeCursor_Call) RunAndReturn(run func(ctx context.Context, n int) error) *MockEntryInputTarget_DeleteBeforeCursor_Call {
302+ _c.Call.Return(run)
303+ return _c
304+}
305+
306+// InsertText provides a mock function for the type MockEntryInputTarget
307+func (_mock *MockEntryInputTarget) InsertText(ctx context.Context, text string) error {
308+ ret := _mock.Called(ctx, text)
309+
310+ if len(ret) == 0 {
311+ panic("no return value specified for InsertText")
312+ }
313+
314+ var r0 error
315+ if returnFunc, ok := ret.Get(0).(func(context.Context, string) error); ok {
316+ r0 = returnFunc(ctx, text)
317+ } else {
318+ r0 = ret.Error(0)
319+ }
320+ return r0
321+}
322+
323+// MockEntryInputTarget_InsertText_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'InsertText'
324+type MockEntryInputTarget_InsertText_Call struct {
325+ *mock.Call
326+}
327+
328+// InsertText is a helper method to define mock.On call
329+// - ctx context.Context
330+// - text string
331+func (_e *MockEntryInputTarget_Expecter) InsertText(ctx any, text any) *MockEntryInputTarget_InsertText_Call {
332+ return &MockEntryInputTarget_InsertText_Call{Call: _e.mock.On("InsertText", ctx, text)}
333+}
334+
335+func (_c *MockEntryInputTarget_InsertText_Call) Run(run func(ctx context.Context, text string)) *MockEntryInputTarget_InsertText_Call {
336+ _c.Call.Run(func(args mock.Arguments) {
337+ var arg0 context.Context
338+ if args[0] != nil {
339+ arg0 = args[0].(context.Context)
340+ }
341+ var arg1 string
342+ if args[1] != nil {
343+ arg1 = args[1].(string)
344+ }
345+ run(
346+ arg0,
347+ arg1,
348+ )
349+ })
350+ return _c
351+}
352+
353+func (_c *MockEntryInputTarget_InsertText_Call) Return(err error) *MockEntryInputTarget_InsertText_Call {
354+ _c.Call.Return(err)
355+ return _c
356+}
357+
358+func (_c *MockEntryInputTarget_InsertText_Call) RunAndReturn(run func(ctx context.Context, text string) error) *MockEntryInputTarget_InsertText_Call {
359+ _c.Call.Return(run)
360+ return _c
361+}
362+
363+// IsGTKEntryTarget provides a mock function for the type MockEntryInputTarget
364+func (_mock *MockEntryInputTarget) IsGTKEntryTarget() bool {
365+ ret := _mock.Called()
366+
367+ if len(ret) == 0 {
368+ panic("no return value specified for IsGTKEntryTarget")
369+ }
370+
371+ var r0 bool
372+ if returnFunc, ok := ret.Get(0).(func() bool); ok {
373+ r0 = returnFunc()
374+ } else {
375+ r0 = ret.Get(0).(bool)
376+ }
377+ return r0
378+}
379+
380+// MockEntryInputTarget_IsGTKEntryTarget_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'IsGTKEntryTarget'
381+type MockEntryInputTarget_IsGTKEntryTarget_Call struct {
382+ *mock.Call
383+}
384+
385+// IsGTKEntryTarget is a helper method to define mock.On call
386+func (_e *MockEntryInputTarget_Expecter) IsGTKEntryTarget() *MockEntryInputTarget_IsGTKEntryTarget_Call {
387+ return &MockEntryInputTarget_IsGTKEntryTarget_Call{Call: _e.mock.On("IsGTKEntryTarget")}
388+}
389+
390+func (_c *MockEntryInputTarget_IsGTKEntryTarget_Call) Run(run func()) *MockEntryInputTarget_IsGTKEntryTarget_Call {
391+ _c.Call.Run(func(args mock.Arguments) {
392+ run()
393+ })
394+ return _c
395+}
396+
397+func (_c *MockEntryInputTarget_IsGTKEntryTarget_Call) Return(b bool) *MockEntryInputTarget_IsGTKEntryTarget_Call {
398+ _c.Call.Return(b)
399+ return _c
400+}
401+
402+func (_c *MockEntryInputTarget_IsGTKEntryTarget_Call) RunAndReturn(run func() bool) *MockEntryInputTarget_IsGTKEntryTarget_Call {
403+ _c.Call.Return(run)
404+ return _c
405+}
406+
407+// NewMockFocusedInputProvider creates a new instance of MockFocusedInputProvider. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
408+// The first argument is typically a *testing.T value.
409+func NewMockFocusedInputProvider(t interface {
410+ mock.TestingT
411+ Cleanup(func())
412+}) *MockFocusedInputProvider {
413+ mock := &MockFocusedInputProvider{}
414+ mock.Mock.Test(t)
415+
416+ t.Cleanup(func() { mock.AssertExpectations(t) })
417+
418+ return mock
419+}
420+
421+// MockFocusedInputProvider is an autogenerated mock type for the FocusedInputProvider type
422+type MockFocusedInputProvider struct {
423+ mock.Mock
424+}
425+
426+type MockFocusedInputProvider_Expecter struct {
427+ mock *mock.Mock
428+}
429+
430+func (_m *MockFocusedInputProvider) EXPECT() *MockFocusedInputProvider_Expecter {
431+ return &MockFocusedInputProvider_Expecter{mock: &_m.Mock}
432+}
433+
434+// GetFocusedInput provides a mock function for the type MockFocusedInputProvider
435+func (_mock *MockFocusedInputProvider) GetFocusedInput() port.TextInputTarget {
436+ ret := _mock.Called()
437+
438+ if len(ret) == 0 {
439+ panic("no return value specified for GetFocusedInput")
440+ }
441+
442+ var r0 port.TextInputTarget
443+ if returnFunc, ok := ret.Get(0).(func() port.TextInputTarget); ok {
444+ r0 = returnFunc()
445+ } else {
446+ if ret.Get(0) != nil {
447+ r0 = ret.Get(0).(port.TextInputTarget)
448+ }
449+ }
450+ return r0
451+}
452+
453+// MockFocusedInputProvider_GetFocusedInput_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetFocusedInput'
454+type MockFocusedInputProvider_GetFocusedInput_Call struct {
455+ *mock.Call
456+}
457+
458+// GetFocusedInput is a helper method to define mock.On call
459+func (_e *MockFocusedInputProvider_Expecter) GetFocusedInput() *MockFocusedInputProvider_GetFocusedInput_Call {
460+ return &MockFocusedInputProvider_GetFocusedInput_Call{Call: _e.mock.On("GetFocusedInput")}
461+}
462+
463+func (_c *MockFocusedInputProvider_GetFocusedInput_Call) Run(run func()) *MockFocusedInputProvider_GetFocusedInput_Call {
464+ _c.Call.Run(func(args mock.Arguments) {
465+ run()
466+ })
467+ return _c
468+}
469+
470+func (_c *MockFocusedInputProvider_GetFocusedInput_Call) Return(textInputTarget port.TextInputTarget) *MockFocusedInputProvider_GetFocusedInput_Call {
471+ _c.Call.Return(textInputTarget)
472+ return _c
473+}
474+
475+func (_c *MockFocusedInputProvider_GetFocusedInput_Call) RunAndReturn(run func() port.TextInputTarget) *MockFocusedInputProvider_GetFocusedInput_Call {
476+ _c.Call.Return(run)
477+ return _c
478+}
479+
480+// SetFocusedInput provides a mock function for the type MockFocusedInputProvider
481+func (_mock *MockFocusedInputProvider) SetFocusedInput(target port.TextInputTarget) {
482+ _mock.Called(target)
483+ return
484+}
485+
486+// MockFocusedInputProvider_SetFocusedInput_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'SetFocusedInput'
487+type MockFocusedInputProvider_SetFocusedInput_Call struct {
488+ *mock.Call
489+}
490+
491+// SetFocusedInput is a helper method to define mock.On call
492+// - target port.TextInputTarget
493+func (_e *MockFocusedInputProvider_Expecter) SetFocusedInput(target any) *MockFocusedInputProvider_SetFocusedInput_Call {
494+ return &MockFocusedInputProvider_SetFocusedInput_Call{Call: _e.mock.On("SetFocusedInput", target)}
495+}
496+
497+func (_c *MockFocusedInputProvider_SetFocusedInput_Call) Run(run func(target port.TextInputTarget)) *MockFocusedInputProvider_SetFocusedInput_Call {
498+ _c.Call.Run(func(args mock.Arguments) {
499+ var arg0 port.TextInputTarget
500+ if args[0] != nil {
501+ arg0 = args[0].(port.TextInputTarget)
502+ }
503+ run(
504+ arg0,
505+ )
506+ })
507+ return _c
508+}
509+
510+func (_c *MockFocusedInputProvider_SetFocusedInput_Call) Return() *MockFocusedInputProvider_SetFocusedInput_Call {
511+ _c.Call.Return()
512+ return _c
513+}
514+
515+func (_c *MockFocusedInputProvider_SetFocusedInput_Call) RunAndReturn(run func(target port.TextInputTarget)) *MockFocusedInputProvider_SetFocusedInput_Call {
516+ _c.Run(run)
517+ return _c
518+}
A internal/application/port/mocks/updater.go +680 -0
@@ -0,0 +1,680 @@
1+// Code generated by mockery; DO NOT EDIT.
2+// github.com/vektra/mockery
3+// template: testify
4+
5+package mocks
6+
7+import (
8+ "context"
9+
10+ "github.com/bnema/dumber/internal/application/port"
11+ "github.com/bnema/dumber/internal/domain/entity"
12+ mock "github.com/stretchr/testify/mock"
13+)
14+
15+// NewMockUpdateChecker creates a new instance of MockUpdateChecker. 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.
17+func NewMockUpdateChecker(t interface {
18+ mock.TestingT
19+ Cleanup(func())
20+}) *MockUpdateChecker {
21+ mock := &MockUpdateChecker{}
22+ mock.Mock.Test(t)
23+
24+ t.Cleanup(func() { mock.AssertExpectations(t) })
25+
26+ return mock
27+}
28+
29+// MockUpdateChecker is an autogenerated mock type for the UpdateChecker type
30+type MockUpdateChecker struct {
31+ mock.Mock
32+}
33+
34+type MockUpdateChecker_Expecter struct {
35+ mock *mock.Mock
36+}
37+
38+func (_m *MockUpdateChecker) EXPECT() *MockUpdateChecker_Expecter {
39+ return &MockUpdateChecker_Expecter{mock: &_m.Mock}
40+}
41+
42+// CheckForUpdate provides a mock function for the type MockUpdateChecker
43+func (_mock *MockUpdateChecker) CheckForUpdate(ctx context.Context, currentVersion string) (*entity.UpdateInfo, error) {
44+ ret := _mock.Called(ctx, currentVersion)
45+
46+ if len(ret) == 0 {
47+ panic("no return value specified for CheckForUpdate")
48+ }
49+
50+ var r0 *entity.UpdateInfo
51+ var r1 error
52+ if returnFunc, ok := ret.Get(0).(func(context.Context, string) (*entity.UpdateInfo, error)); ok {
53+ return returnFunc(ctx, currentVersion)
54+ }
55+ if returnFunc, ok := ret.Get(0).(func(context.Context, string) *entity.UpdateInfo); ok {
56+ r0 = returnFunc(ctx, currentVersion)
57+ } else {
58+ if ret.Get(0) != nil {
59+ r0 = ret.Get(0).(*entity.UpdateInfo)
60+ }
61+ }
62+ if returnFunc, ok := ret.Get(1).(func(context.Context, string) error); ok {
63+ r1 = returnFunc(ctx, currentVersion)
64+ } else {
65+ r1 = ret.Error(1)
66+ }
67+ return r0, r1
68+}
69+
70+// MockUpdateChecker_CheckForUpdate_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'CheckForUpdate'
71+type MockUpdateChecker_CheckForUpdate_Call struct {
72+ *mock.Call
73+}
74+
75+// CheckForUpdate is a helper method to define mock.On call
76+// - ctx context.Context
77+// - currentVersion string
78+func (_e *MockUpdateChecker_Expecter) CheckForUpdate(ctx any, currentVersion any) *MockUpdateChecker_CheckForUpdate_Call {
79+ return &MockUpdateChecker_CheckForUpdate_Call{Call: _e.mock.On("CheckForUpdate", ctx, currentVersion)}
80+}
81+
82+func (_c *MockUpdateChecker_CheckForUpdate_Call) Run(run func(ctx context.Context, currentVersion string)) *MockUpdateChecker_CheckForUpdate_Call {
83+ _c.Call.Run(func(args mock.Arguments) {
84+ var arg0 context.Context
85+ if args[0] != nil {
86+ arg0 = args[0].(context.Context)
87+ }
88+ var arg1 string
89+ if args[1] != nil {
90+ arg1 = args[1].(string)
91+ }
92+ run(
93+ arg0,
94+ arg1,
95+ )
96+ })
97+ return _c
98+}
99+
100+func (_c *MockUpdateChecker_CheckForUpdate_Call) Return(updateInfo *entity.UpdateInfo, err error) *MockUpdateChecker_CheckForUpdate_Call {
101+ _c.Call.Return(updateInfo, err)
102+ return _c
103+}
104+
105+func (_c *MockUpdateChecker_CheckForUpdate_Call) RunAndReturn(run func(ctx context.Context, currentVersion string) (*entity.UpdateInfo, error)) *MockUpdateChecker_CheckForUpdate_Call {
106+ _c.Call.Return(run)
107+ return _c
108+}
109+
110+// NewMockUpdateDownloader creates a new instance of MockUpdateDownloader. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
111+// The first argument is typically a *testing.T value.
112+func NewMockUpdateDownloader(t interface {
113+ mock.TestingT
114+ Cleanup(func())
115+}) *MockUpdateDownloader {
116+ mock := &MockUpdateDownloader{}
117+ mock.Mock.Test(t)
118+
119+ t.Cleanup(func() { mock.AssertExpectations(t) })
120+
121+ return mock
122+}
123+
124+// MockUpdateDownloader is an autogenerated mock type for the UpdateDownloader type
125+type MockUpdateDownloader struct {
126+ mock.Mock
127+}
128+
129+type MockUpdateDownloader_Expecter struct {
130+ mock *mock.Mock
131+}
132+
133+func (_m *MockUpdateDownloader) EXPECT() *MockUpdateDownloader_Expecter {
134+ return &MockUpdateDownloader_Expecter{mock: &_m.Mock}
135+}
136+
137+// Download provides a mock function for the type MockUpdateDownloader
138+func (_mock *MockUpdateDownloader) Download(ctx context.Context, downloadURL string, destDir string) (string, error) {
139+ ret := _mock.Called(ctx, downloadURL, destDir)
140+
141+ if len(ret) == 0 {
142+ panic("no return value specified for Download")
143+ }
144+
145+ var r0 string
146+ var r1 error
147+ if returnFunc, ok := ret.Get(0).(func(context.Context, string, string) (string, error)); ok {
148+ return returnFunc(ctx, downloadURL, destDir)
149+ }
150+ if returnFunc, ok := ret.Get(0).(func(context.Context, string, string) string); ok {
151+ r0 = returnFunc(ctx, downloadURL, destDir)
152+ } else {
153+ r0 = ret.Get(0).(string)
154+ }
155+ if returnFunc, ok := ret.Get(1).(func(context.Context, string, string) error); ok {
156+ r1 = returnFunc(ctx, downloadURL, destDir)
157+ } else {
158+ r1 = ret.Error(1)
159+ }
160+ return r0, r1
161+}
162+
163+// MockUpdateDownloader_Download_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Download'
164+type MockUpdateDownloader_Download_Call struct {
165+ *mock.Call
166+}
167+
168+// Download is a helper method to define mock.On call
169+// - ctx context.Context
170+// - downloadURL string
171+// - destDir string
172+func (_e *MockUpdateDownloader_Expecter) Download(ctx any, downloadURL any, destDir any) *MockUpdateDownloader_Download_Call {
173+ return &MockUpdateDownloader_Download_Call{Call: _e.mock.On("Download", ctx, downloadURL, destDir)}
174+}
175+
176+func (_c *MockUpdateDownloader_Download_Call) Run(run func(ctx context.Context, downloadURL string, destDir string)) *MockUpdateDownloader_Download_Call {
177+ _c.Call.Run(func(args mock.Arguments) {
178+ var arg0 context.Context
179+ if args[0] != nil {
180+ arg0 = args[0].(context.Context)
181+ }
182+ var arg1 string
183+ if args[1] != nil {
184+ arg1 = args[1].(string)
185+ }
186+ var arg2 string
187+ if args[2] != nil {
188+ arg2 = args[2].(string)
189+ }
190+ run(
191+ arg0,
192+ arg1,
193+ arg2,
194+ )
195+ })
196+ return _c
197+}
198+
199+func (_c *MockUpdateDownloader_Download_Call) Return(archivePath string, err error) *MockUpdateDownloader_Download_Call {
200+ _c.Call.Return(archivePath, err)
201+ return _c
202+}
203+
204+func (_c *MockUpdateDownloader_Download_Call) RunAndReturn(run func(ctx context.Context, downloadURL string, destDir string) (string, error)) *MockUpdateDownloader_Download_Call {
205+ _c.Call.Return(run)
206+ return _c
207+}
208+
209+// Extract provides a mock function for the type MockUpdateDownloader
210+func (_mock *MockUpdateDownloader) Extract(ctx context.Context, archivePath string, destDir string) (string, error) {
211+ ret := _mock.Called(ctx, archivePath, destDir)
212+
213+ if len(ret) == 0 {
214+ panic("no return value specified for Extract")
215+ }
216+
217+ var r0 string
218+ var r1 error
219+ if returnFunc, ok := ret.Get(0).(func(context.Context, string, string) (string, error)); ok {
220+ return returnFunc(ctx, archivePath, destDir)
221+ }
222+ if returnFunc, ok := ret.Get(0).(func(context.Context, string, string) string); ok {
223+ r0 = returnFunc(ctx, archivePath, destDir)
224+ } else {
225+ r0 = ret.Get(0).(string)
226+ }
227+ if returnFunc, ok := ret.Get(1).(func(context.Context, string, string) error); ok {
228+ r1 = returnFunc(ctx, archivePath, destDir)
229+ } else {
230+ r1 = ret.Error(1)
231+ }
232+ return r0, r1
233+}
234+
235+// MockUpdateDownloader_Extract_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Extract'
236+type MockUpdateDownloader_Extract_Call struct {
237+ *mock.Call
238+}
239+
240+// Extract is a helper method to define mock.On call
241+// - ctx context.Context
242+// - archivePath string
243+// - destDir string
244+func (_e *MockUpdateDownloader_Expecter) Extract(ctx any, archivePath any, destDir any) *MockUpdateDownloader_Extract_Call {
245+ return &MockUpdateDownloader_Extract_Call{Call: _e.mock.On("Extract", ctx, archivePath, destDir)}
246+}
247+
248+func (_c *MockUpdateDownloader_Extract_Call) Run(run func(ctx context.Context, archivePath string, destDir string)) *MockUpdateDownloader_Extract_Call {
249+ _c.Call.Run(func(args mock.Arguments) {
250+ var arg0 context.Context
251+ if args[0] != nil {
252+ arg0 = args[0].(context.Context)
253+ }
254+ var arg1 string
255+ if args[1] != nil {
256+ arg1 = args[1].(string)
257+ }
258+ var arg2 string
259+ if args[2] != nil {
260+ arg2 = args[2].(string)
261+ }
262+ run(
263+ arg0,
264+ arg1,
265+ arg2,
266+ )
267+ })
268+ return _c
269+}
270+
271+func (_c *MockUpdateDownloader_Extract_Call) Return(binaryPath string, err error) *MockUpdateDownloader_Extract_Call {
272+ _c.Call.Return(binaryPath, err)
273+ return _c
274+}
275+
276+func (_c *MockUpdateDownloader_Extract_Call) RunAndReturn(run func(ctx context.Context, archivePath string, destDir string) (string, error)) *MockUpdateDownloader_Extract_Call {
277+ _c.Call.Return(run)
278+ return _c
279+}
280+
281+// NewMockUpdateApplier creates a new instance of MockUpdateApplier. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
282+// The first argument is typically a *testing.T value.
283+func NewMockUpdateApplier(t interface {
284+ mock.TestingT
285+ Cleanup(func())
286+}) *MockUpdateApplier {
287+ mock := &MockUpdateApplier{}
288+ mock.Mock.Test(t)
289+
290+ t.Cleanup(func() { mock.AssertExpectations(t) })
291+
292+ return mock
293+}
294+
295+// MockUpdateApplier is an autogenerated mock type for the UpdateApplier type
296+type MockUpdateApplier struct {
297+ mock.Mock
298+}
299+
300+type MockUpdateApplier_Expecter struct {
301+ mock *mock.Mock
302+}
303+
304+func (_m *MockUpdateApplier) EXPECT() *MockUpdateApplier_Expecter {
305+ return &MockUpdateApplier_Expecter{mock: &_m.Mock}
306+}
307+
308+// ApplyOnExit provides a mock function for the type MockUpdateApplier
309+func (_mock *MockUpdateApplier) ApplyOnExit(ctx context.Context) (string, error) {
310+ ret := _mock.Called(ctx)
311+
312+ if len(ret) == 0 {
313+ panic("no return value specified for ApplyOnExit")
314+ }
315+
316+ var r0 string
317+ var r1 error
318+ if returnFunc, ok := ret.Get(0).(func(context.Context) (string, error)); ok {
319+ return returnFunc(ctx)
320+ }
321+ if returnFunc, ok := ret.Get(0).(func(context.Context) string); ok {
322+ r0 = returnFunc(ctx)
323+ } else {
324+ r0 = ret.Get(0).(string)
325+ }
326+ if returnFunc, ok := ret.Get(1).(func(context.Context) error); ok {
327+ r1 = returnFunc(ctx)
328+ } else {
329+ r1 = ret.Error(1)
330+ }
331+ return r0, r1
332+}
333+
334+// MockUpdateApplier_ApplyOnExit_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ApplyOnExit'
335+type MockUpdateApplier_ApplyOnExit_Call struct {
336+ *mock.Call
337+}
338+
339+// ApplyOnExit is a helper method to define mock.On call
340+// - ctx context.Context
341+func (_e *MockUpdateApplier_Expecter) ApplyOnExit(ctx any) *MockUpdateApplier_ApplyOnExit_Call {
342+ return &MockUpdateApplier_ApplyOnExit_Call{Call: _e.mock.On("ApplyOnExit", ctx)}
343+}
344+
345+func (_c *MockUpdateApplier_ApplyOnExit_Call) Run(run func(ctx context.Context)) *MockUpdateApplier_ApplyOnExit_Call {
346+ _c.Call.Run(func(args mock.Arguments) {
347+ var arg0 context.Context
348+ if args[0] != nil {
349+ arg0 = args[0].(context.Context)
350+ }
351+ run(
352+ arg0,
353+ )
354+ })
355+ return _c
356+}
357+
358+func (_c *MockUpdateApplier_ApplyOnExit_Call) Return(backupPath string, err error) *MockUpdateApplier_ApplyOnExit_Call {
359+ _c.Call.Return(backupPath, err)
360+ return _c
361+}
362+
363+func (_c *MockUpdateApplier_ApplyOnExit_Call) RunAndReturn(run func(ctx context.Context) (string, error)) *MockUpdateApplier_ApplyOnExit_Call {
364+ _c.Call.Return(run)
365+ return _c
366+}
367+
368+// CanSelfUpdate provides a mock function for the type MockUpdateApplier
369+func (_mock *MockUpdateApplier) CanSelfUpdate(ctx context.Context) bool {
370+ ret := _mock.Called(ctx)
371+
372+ if len(ret) == 0 {
373+ panic("no return value specified for CanSelfUpdate")
374+ }
375+
376+ var r0 bool
377+ if returnFunc, ok := ret.Get(0).(func(context.Context) bool); ok {
378+ r0 = returnFunc(ctx)
379+ } else {
380+ r0 = ret.Get(0).(bool)
381+ }
382+ return r0
383+}
384+
385+// MockUpdateApplier_CanSelfUpdate_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'CanSelfUpdate'
386+type MockUpdateApplier_CanSelfUpdate_Call struct {
387+ *mock.Call
388+}
389+
390+// CanSelfUpdate is a helper method to define mock.On call
391+// - ctx context.Context
392+func (_e *MockUpdateApplier_Expecter) CanSelfUpdate(ctx any) *MockUpdateApplier_CanSelfUpdate_Call {
393+ return &MockUpdateApplier_CanSelfUpdate_Call{Call: _e.mock.On("CanSelfUpdate", ctx)}
394+}
395+
396+func (_c *MockUpdateApplier_CanSelfUpdate_Call) Run(run func(ctx context.Context)) *MockUpdateApplier_CanSelfUpdate_Call {
397+ _c.Call.Run(func(args mock.Arguments) {
398+ var arg0 context.Context
399+ if args[0] != nil {
400+ arg0 = args[0].(context.Context)
401+ }
402+ run(
403+ arg0,
404+ )
405+ })
406+ return _c
407+}
408+
409+func (_c *MockUpdateApplier_CanSelfUpdate_Call) Return(b bool) *MockUpdateApplier_CanSelfUpdate_Call {
410+ _c.Call.Return(b)
411+ return _c
412+}
413+
414+func (_c *MockUpdateApplier_CanSelfUpdate_Call) RunAndReturn(run func(ctx context.Context) bool) *MockUpdateApplier_CanSelfUpdate_Call {
415+ _c.Call.Return(run)
416+ return _c
417+}
418+
419+// ClearStagedUpdate provides a mock function for the type MockUpdateApplier
420+func (_mock *MockUpdateApplier) ClearStagedUpdate(ctx context.Context) error {
421+ ret := _mock.Called(ctx)
422+
423+ if len(ret) == 0 {
424+ panic("no return value specified for ClearStagedUpdate")
425+ }
426+
427+ var r0 error
428+ if returnFunc, ok := ret.Get(0).(func(context.Context) error); ok {
429+ r0 = returnFunc(ctx)
430+ } else {
431+ r0 = ret.Error(0)
432+ }
433+ return r0
434+}
435+
436+// MockUpdateApplier_ClearStagedUpdate_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ClearStagedUpdate'
437+type MockUpdateApplier_ClearStagedUpdate_Call struct {
438+ *mock.Call
439+}
440+
441+// ClearStagedUpdate is a helper method to define mock.On call
442+// - ctx context.Context
443+func (_e *MockUpdateApplier_Expecter) ClearStagedUpdate(ctx any) *MockUpdateApplier_ClearStagedUpdate_Call {
444+ return &MockUpdateApplier_ClearStagedUpdate_Call{Call: _e.mock.On("ClearStagedUpdate", ctx)}
445+}
446+
447+func (_c *MockUpdateApplier_ClearStagedUpdate_Call) Run(run func(ctx context.Context)) *MockUpdateApplier_ClearStagedUpdate_Call {
448+ _c.Call.Run(func(args mock.Arguments) {
449+ var arg0 context.Context
450+ if args[0] != nil {
451+ arg0 = args[0].(context.Context)
452+ }
453+ run(
454+ arg0,
455+ )
456+ })
457+ return _c
458+}
459+
460+func (_c *MockUpdateApplier_ClearStagedUpdate_Call) Return(err error) *MockUpdateApplier_ClearStagedUpdate_Call {
461+ _c.Call.Return(err)
462+ return _c
463+}
464+
465+func (_c *MockUpdateApplier_ClearStagedUpdate_Call) RunAndReturn(run func(ctx context.Context) error) *MockUpdateApplier_ClearStagedUpdate_Call {
466+ _c.Call.Return(run)
467+ return _c
468+}
469+
470+// GetBinaryPath provides a mock function for the type MockUpdateApplier
471+func (_mock *MockUpdateApplier) GetBinaryPath() (string, error) {
472+ ret := _mock.Called()
473+
474+ if len(ret) == 0 {
475+ panic("no return value specified for GetBinaryPath")
476+ }
477+
478+ var r0 string
479+ var r1 error
480+ if returnFunc, ok := ret.Get(0).(func() (string, error)); ok {
481+ return returnFunc()
482+ }
483+ if returnFunc, ok := ret.Get(0).(func() string); ok {
484+ r0 = returnFunc()
485+ } else {
486+ r0 = ret.Get(0).(string)
487+ }
488+ if returnFunc, ok := ret.Get(1).(func() error); ok {
489+ r1 = returnFunc()
490+ } else {
491+ r1 = ret.Error(1)
492+ }
493+ return r0, r1
494+}
495+
496+// MockUpdateApplier_GetBinaryPath_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetBinaryPath'
497+type MockUpdateApplier_GetBinaryPath_Call struct {
498+ *mock.Call
499+}
500+
501+// GetBinaryPath is a helper method to define mock.On call
502+func (_e *MockUpdateApplier_Expecter) GetBinaryPath() *MockUpdateApplier_GetBinaryPath_Call {
503+ return &MockUpdateApplier_GetBinaryPath_Call{Call: _e.mock.On("GetBinaryPath")}
504+}
505+
506+func (_c *MockUpdateApplier_GetBinaryPath_Call) Run(run func()) *MockUpdateApplier_GetBinaryPath_Call {
507+ _c.Call.Run(func(args mock.Arguments) {
508+ run()
509+ })
510+ return _c
511+}
512+
513+func (_c *MockUpdateApplier_GetBinaryPath_Call) Return(s string, err error) *MockUpdateApplier_GetBinaryPath_Call {
514+ _c.Call.Return(s, err)
515+ return _c
516+}
517+
518+func (_c *MockUpdateApplier_GetBinaryPath_Call) RunAndReturn(run func() (string, error)) *MockUpdateApplier_GetBinaryPath_Call {
519+ _c.Call.Return(run)
520+ return _c
521+}
522+
523+// HasStagedUpdate provides a mock function for the type MockUpdateApplier
524+func (_mock *MockUpdateApplier) HasStagedUpdate(ctx context.Context) bool {
525+ ret := _mock.Called(ctx)
526+
527+ if len(ret) == 0 {
528+ panic("no return value specified for HasStagedUpdate")
529+ }
530+
531+ var r0 bool
532+ if returnFunc, ok := ret.Get(0).(func(context.Context) bool); ok {
533+ r0 = returnFunc(ctx)
534+ } else {
535+ r0 = ret.Get(0).(bool)
536+ }
537+ return r0
538+}
539+
540+// MockUpdateApplier_HasStagedUpdate_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'HasStagedUpdate'
541+type MockUpdateApplier_HasStagedUpdate_Call struct {
542+ *mock.Call
543+}
544+
545+// HasStagedUpdate is a helper method to define mock.On call
546+// - ctx context.Context
547+func (_e *MockUpdateApplier_Expecter) HasStagedUpdate(ctx any) *MockUpdateApplier_HasStagedUpdate_Call {
548+ return &MockUpdateApplier_HasStagedUpdate_Call{Call: _e.mock.On("HasStagedUpdate", ctx)}
549+}
550+
551+func (_c *MockUpdateApplier_HasStagedUpdate_Call) Run(run func(ctx context.Context)) *MockUpdateApplier_HasStagedUpdate_Call {
552+ _c.Call.Run(func(args mock.Arguments) {
553+ var arg0 context.Context
554+ if args[0] != nil {
555+ arg0 = args[0].(context.Context)
556+ }
557+ run(
558+ arg0,
559+ )
560+ })
561+ return _c
562+}
563+
564+func (_c *MockUpdateApplier_HasStagedUpdate_Call) Return(b bool) *MockUpdateApplier_HasStagedUpdate_Call {
565+ _c.Call.Return(b)
566+ return _c
567+}
568+
569+func (_c *MockUpdateApplier_HasStagedUpdate_Call) RunAndReturn(run func(ctx context.Context) bool) *MockUpdateApplier_HasStagedUpdate_Call {
570+ _c.Call.Return(run)
571+ return _c
572+}
573+
574+// SelfUpdateBlockedReason provides a mock function for the type MockUpdateApplier
575+func (_mock *MockUpdateApplier) SelfUpdateBlockedReason(ctx context.Context) port.SelfUpdateBlockedReason {
576+ ret := _mock.Called(ctx)
577+
578+ if len(ret) == 0 {
579+ panic("no return value specified for SelfUpdateBlockedReason")
580+ }
581+
582+ var r0 port.SelfUpdateBlockedReason
583+ if returnFunc, ok := ret.Get(0).(func(context.Context) port.SelfUpdateBlockedReason); ok {
584+ r0 = returnFunc(ctx)
585+ } else {
586+ r0 = ret.Get(0).(port.SelfUpdateBlockedReason)
587+ }
588+ return r0
589+}
590+
591+// MockUpdateApplier_SelfUpdateBlockedReason_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'SelfUpdateBlockedReason'
592+type MockUpdateApplier_SelfUpdateBlockedReason_Call struct {
593+ *mock.Call
594+}
595+
596+// SelfUpdateBlockedReason is a helper method to define mock.On call
597+// - ctx context.Context
598+func (_e *MockUpdateApplier_Expecter) SelfUpdateBlockedReason(ctx any) *MockUpdateApplier_SelfUpdateBlockedReason_Call {
599+ return &MockUpdateApplier_SelfUpdateBlockedReason_Call{Call: _e.mock.On("SelfUpdateBlockedReason", ctx)}
600+}
601+
602+func (_c *MockUpdateApplier_SelfUpdateBlockedReason_Call) Run(run func(ctx context.Context)) *MockUpdateApplier_SelfUpdateBlockedReason_Call {
603+ _c.Call.Run(func(args mock.Arguments) {
604+ var arg0 context.Context
605+ if args[0] != nil {
606+ arg0 = args[0].(context.Context)
607+ }
608+ run(
609+ arg0,
610+ )
611+ })
612+ return _c
613+}
614+
615+func (_c *MockUpdateApplier_SelfUpdateBlockedReason_Call) Return(selfUpdateBlockedReason port.SelfUpdateBlockedReason) *MockUpdateApplier_SelfUpdateBlockedReason_Call {
616+ _c.Call.Return(selfUpdateBlockedReason)
617+ return _c
618+}
619+
620+func (_c *MockUpdateApplier_SelfUpdateBlockedReason_Call) RunAndReturn(run func(ctx context.Context) port.SelfUpdateBlockedReason) *MockUpdateApplier_SelfUpdateBlockedReason_Call {
621+ _c.Call.Return(run)
622+ return _c
623+}
624+
625+// StageUpdate provides a mock function for the type MockUpdateApplier
626+func (_mock *MockUpdateApplier) StageUpdate(ctx context.Context, newBinaryPath string) error {
627+ ret := _mock.Called(ctx, newBinaryPath)
628+
629+ if len(ret) == 0 {
630+ panic("no return value specified for StageUpdate")
631+ }
632+
633+ var r0 error
634+ if returnFunc, ok := ret.Get(0).(func(context.Context, string) error); ok {
635+ r0 = returnFunc(ctx, newBinaryPath)
636+ } else {
637+ r0 = ret.Error(0)
638+ }
639+ return r0
640+}
641+
642+// MockUpdateApplier_StageUpdate_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'StageUpdate'
643+type MockUpdateApplier_StageUpdate_Call struct {
644+ *mock.Call
645+}
646+
647+// StageUpdate is a helper method to define mock.On call
648+// - ctx context.Context
649+// - newBinaryPath string
650+func (_e *MockUpdateApplier_Expecter) StageUpdate(ctx any, newBinaryPath any) *MockUpdateApplier_StageUpdate_Call {
651+ return &MockUpdateApplier_StageUpdate_Call{Call: _e.mock.On("StageUpdate", ctx, newBinaryPath)}
652+}
653+
654+func (_c *MockUpdateApplier_StageUpdate_Call) Run(run func(ctx context.Context, newBinaryPath string)) *MockUpdateApplier_StageUpdate_Call {
655+ _c.Call.Run(func(args mock.Arguments) {
656+ var arg0 context.Context
657+ if args[0] != nil {
658+ arg0 = args[0].(context.Context)
659+ }
660+ var arg1 string
661+ if args[1] != nil {
662+ arg1 = args[1].(string)
663+ }
664+ run(
665+ arg0,
666+ arg1,
667+ )
668+ })
669+ return _c
670+}
671+
672+func (_c *MockUpdateApplier_StageUpdate_Call) Return(err error) *MockUpdateApplier_StageUpdate_Call {
673+ _c.Call.Return(err)
674+ return _c
675+}
676+
677+func (_c *MockUpdateApplier_StageUpdate_Call) RunAndReturn(run func(ctx context.Context, newBinaryPath string) error) *MockUpdateApplier_StageUpdate_Call {
678+ _c.Call.Return(run)
679+ return _c
680+}
A internal/application/port/mocks/webui_config.go +243 -0
@@ -0,0 +1,243 @@
1+// Code generated by mockery; DO NOT EDIT.
2+// github.com/vektra/mockery
3+// template: testify
4+
5+package mocks
6+
7+import (
8+ "context"
9+
10+ "github.com/bnema/dumber/internal/application/dto"
11+ mock "github.com/stretchr/testify/mock"
12+)
13+
14+// NewMockSystemviewConfigReader creates a new instance of MockSystemviewConfigReader. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
15+// The first argument is typically a *testing.T value.
16+func NewMockSystemviewConfigReader(t interface {
17+ mock.TestingT
18+ Cleanup(func())
19+}) *MockSystemviewConfigReader {
20+ mock := &MockSystemviewConfigReader{}
21+ mock.Mock.Test(t)
22+
23+ t.Cleanup(func() { mock.AssertExpectations(t) })
24+
25+ return mock
26+}
27+
28+// MockSystemviewConfigReader is an autogenerated mock type for the SystemviewConfigReader type
29+type MockSystemviewConfigReader struct {
30+ mock.Mock
31+}
32+
33+type MockSystemviewConfigReader_Expecter struct {
34+ mock *mock.Mock
35+}
36+
37+func (_m *MockSystemviewConfigReader) EXPECT() *MockSystemviewConfigReader_Expecter {
38+ return &MockSystemviewConfigReader_Expecter{mock: &_m.Mock}
39+}
40+
41+// Current provides a mock function for the type MockSystemviewConfigReader
42+func (_mock *MockSystemviewConfigReader) Current(ctx context.Context) (dto.SystemviewConfigPayload, error) {
43+ ret := _mock.Called(ctx)
44+
45+ if len(ret) == 0 {
46+ panic("no return value specified for Current")
47+ }
48+
49+ var r0 dto.SystemviewConfigPayload
50+ var r1 error
51+ if returnFunc, ok := ret.Get(0).(func(context.Context) (dto.SystemviewConfigPayload, error)); ok {
52+ return returnFunc(ctx)
53+ }
54+ if returnFunc, ok := ret.Get(0).(func(context.Context) dto.SystemviewConfigPayload); ok {
55+ r0 = returnFunc(ctx)
56+ } else {
57+ r0 = ret.Get(0).(dto.SystemviewConfigPayload)
58+ }
59+ if returnFunc, ok := ret.Get(1).(func(context.Context) error); ok {
60+ r1 = returnFunc(ctx)
61+ } else {
62+ r1 = ret.Error(1)
63+ }
64+ return r0, r1
65+}
66+
67+// MockSystemviewConfigReader_Current_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Current'
68+type MockSystemviewConfigReader_Current_Call struct {
69+ *mock.Call
70+}
71+
72+// Current is a helper method to define mock.On call
73+// - ctx context.Context
74+func (_e *MockSystemviewConfigReader_Expecter) Current(ctx any) *MockSystemviewConfigReader_Current_Call {
75+ return &MockSystemviewConfigReader_Current_Call{Call: _e.mock.On("Current", ctx)}
76+}
77+
78+func (_c *MockSystemviewConfigReader_Current_Call) Run(run func(ctx context.Context)) *MockSystemviewConfigReader_Current_Call {
79+ _c.Call.Run(func(args mock.Arguments) {
80+ var arg0 context.Context
81+ if args[0] != nil {
82+ arg0 = args[0].(context.Context)
83+ }
84+ run(
85+ arg0,
86+ )
87+ })
88+ return _c
89+}
90+
91+func (_c *MockSystemviewConfigReader_Current_Call) Return(systemviewConfigPayload dto.SystemviewConfigPayload, err error) *MockSystemviewConfigReader_Current_Call {
92+ _c.Call.Return(systemviewConfigPayload, err)
93+ return _c
94+}
95+
96+func (_c *MockSystemviewConfigReader_Current_Call) RunAndReturn(run func(ctx context.Context) (dto.SystemviewConfigPayload, error)) *MockSystemviewConfigReader_Current_Call {
97+ _c.Call.Return(run)
98+ return _c
99+}
100+
101+// Default provides a mock function for the type MockSystemviewConfigReader
102+func (_mock *MockSystemviewConfigReader) Default(ctx context.Context) (dto.SystemviewConfigPayload, error) {
103+ ret := _mock.Called(ctx)
104+
105+ if len(ret) == 0 {
106+ panic("no return value specified for Default")
107+ }
108+
109+ var r0 dto.SystemviewConfigPayload
110+ var r1 error
111+ if returnFunc, ok := ret.Get(0).(func(context.Context) (dto.SystemviewConfigPayload, error)); ok {
112+ return returnFunc(ctx)
113+ }
114+ if returnFunc, ok := ret.Get(0).(func(context.Context) dto.SystemviewConfigPayload); ok {
115+ r0 = returnFunc(ctx)
116+ } else {
117+ r0 = ret.Get(0).(dto.SystemviewConfigPayload)
118+ }
119+ if returnFunc, ok := ret.Get(1).(func(context.Context) error); ok {
120+ r1 = returnFunc(ctx)
121+ } else {
122+ r1 = ret.Error(1)
123+ }
124+ return r0, r1
125+}
126+
127+// MockSystemviewConfigReader_Default_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Default'
128+type MockSystemviewConfigReader_Default_Call struct {
129+ *mock.Call
130+}
131+
132+// Default is a helper method to define mock.On call
133+// - ctx context.Context
134+func (_e *MockSystemviewConfigReader_Expecter) Default(ctx any) *MockSystemviewConfigReader_Default_Call {
135+ return &MockSystemviewConfigReader_Default_Call{Call: _e.mock.On("Default", ctx)}
136+}
137+
138+func (_c *MockSystemviewConfigReader_Default_Call) Run(run func(ctx context.Context)) *MockSystemviewConfigReader_Default_Call {
139+ _c.Call.Run(func(args mock.Arguments) {
140+ var arg0 context.Context
141+ if args[0] != nil {
142+ arg0 = args[0].(context.Context)
143+ }
144+ run(
145+ arg0,
146+ )
147+ })
148+ return _c
149+}
150+
151+func (_c *MockSystemviewConfigReader_Default_Call) Return(systemviewConfigPayload dto.SystemviewConfigPayload, err error) *MockSystemviewConfigReader_Default_Call {
152+ _c.Call.Return(systemviewConfigPayload, err)
153+ return _c
154+}
155+
156+func (_c *MockSystemviewConfigReader_Default_Call) RunAndReturn(run func(ctx context.Context) (dto.SystemviewConfigPayload, error)) *MockSystemviewConfigReader_Default_Call {
157+ _c.Call.Return(run)
158+ return _c
159+}
160+
161+// NewMockWebUIConfigSaver creates a new instance of MockWebUIConfigSaver. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
162+// The first argument is typically a *testing.T value.
163+func NewMockWebUIConfigSaver(t interface {
164+ mock.TestingT
165+ Cleanup(func())
166+}) *MockWebUIConfigSaver {
167+ mock := &MockWebUIConfigSaver{}
168+ mock.Mock.Test(t)
169+
170+ t.Cleanup(func() { mock.AssertExpectations(t) })
171+
172+ return mock
173+}
174+
175+// MockWebUIConfigSaver is an autogenerated mock type for the WebUIConfigSaver type
176+type MockWebUIConfigSaver struct {
177+ mock.Mock
178+}
179+
180+type MockWebUIConfigSaver_Expecter struct {
181+ mock *mock.Mock
182+}
183+
184+func (_m *MockWebUIConfigSaver) EXPECT() *MockWebUIConfigSaver_Expecter {
185+ return &MockWebUIConfigSaver_Expecter{mock: &_m.Mock}
186+}
187+
188+// SaveWebUIConfig provides a mock function for the type MockWebUIConfigSaver
189+func (_mock *MockWebUIConfigSaver) SaveWebUIConfig(ctx context.Context, cfg dto.WebUIConfig) error {
190+ ret := _mock.Called(ctx, cfg)
191+
192+ if len(ret) == 0 {
193+ panic("no return value specified for SaveWebUIConfig")
194+ }
195+
196+ var r0 error
197+ if returnFunc, ok := ret.Get(0).(func(context.Context, dto.WebUIConfig) error); ok {
198+ r0 = returnFunc(ctx, cfg)
199+ } else {
200+ r0 = ret.Error(0)
201+ }
202+ return r0
203+}
204+
205+// MockWebUIConfigSaver_SaveWebUIConfig_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'SaveWebUIConfig'
206+type MockWebUIConfigSaver_SaveWebUIConfig_Call struct {
207+ *mock.Call
208+}
209+
210+// SaveWebUIConfig is a helper method to define mock.On call
211+// - ctx context.Context
212+// - cfg dto.WebUIConfig
213+func (_e *MockWebUIConfigSaver_Expecter) SaveWebUIConfig(ctx any, cfg any) *MockWebUIConfigSaver_SaveWebUIConfig_Call {
214+ return &MockWebUIConfigSaver_SaveWebUIConfig_Call{Call: _e.mock.On("SaveWebUIConfig", ctx, cfg)}
215+}
216+
217+func (_c *MockWebUIConfigSaver_SaveWebUIConfig_Call) Run(run func(ctx context.Context, cfg dto.WebUIConfig)) *MockWebUIConfigSaver_SaveWebUIConfig_Call {
218+ _c.Call.Run(func(args mock.Arguments) {
219+ var arg0 context.Context
220+ if args[0] != nil {
221+ arg0 = args[0].(context.Context)
222+ }
223+ var arg1 dto.WebUIConfig
224+ if args[1] != nil {
225+ arg1 = args[1].(dto.WebUIConfig)
226+ }
227+ run(
228+ arg0,
229+ arg1,
230+ )
231+ })
232+ return _c
233+}
234+
235+func (_c *MockWebUIConfigSaver_SaveWebUIConfig_Call) Return(err error) *MockWebUIConfigSaver_SaveWebUIConfig_Call {
236+ _c.Call.Return(err)
237+ return _c
238+}
239+
240+func (_c *MockWebUIConfigSaver_SaveWebUIConfig_Call) RunAndReturn(run func(ctx context.Context, cfg dto.WebUIConfig) error) *MockWebUIConfigSaver_SaveWebUIConfig_Call {
241+ _c.Call.Return(run)
242+ return _c
243+}
A internal/application/port/mocks/webview.go +3042 -0 large diff (3042 lines changed): collapsed
A internal/application/port/mocks/xdg.go +566 -0
@@ -0,0 +1,566 @@
1+// Code generated by mockery; DO NOT EDIT.
2+// github.com/vektra/mockery
3+// template: testify
4+
5+package mocks
6+
7+import (
8+ mock "github.com/stretchr/testify/mock"
9+)
10+
11+// NewMockXDGPaths creates a new instance of MockXDGPaths. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
12+// The first argument is typically a *testing.T value.
13+func NewMockXDGPaths(t interface {
14+ mock.TestingT
15+ Cleanup(func())
16+}) *MockXDGPaths {
17+ mock := &MockXDGPaths{}
18+ mock.Mock.Test(t)
19+
20+ t.Cleanup(func() { mock.AssertExpectations(t) })
21+
22+ return mock
23+}
24+
25+// MockXDGPaths is an autogenerated mock type for the XDGPaths type
26+type MockXDGPaths struct {
27+ mock.Mock
28+}
29+
30+type MockXDGPaths_Expecter struct {
31+ mock *mock.Mock
32+}
33+
34+func (_m *MockXDGPaths) EXPECT() *MockXDGPaths_Expecter {
35+ return &MockXDGPaths_Expecter{mock: &_m.Mock}
36+}
37+
38+// CacheDir provides a mock function for the type MockXDGPaths
39+func (_mock *MockXDGPaths) CacheDir() (string, error) {
40+ ret := _mock.Called()
41+
42+ if len(ret) == 0 {
43+ panic("no return value specified for CacheDir")
44+ }
45+
46+ var r0 string
47+ var r1 error
48+ if returnFunc, ok := ret.Get(0).(func() (string, error)); ok {
49+ return returnFunc()
50+ }
51+ if returnFunc, ok := ret.Get(0).(func() string); ok {
52+ r0 = returnFunc()
53+ } else {
54+ r0 = ret.Get(0).(string)
55+ }
56+ if returnFunc, ok := ret.Get(1).(func() error); ok {
57+ r1 = returnFunc()
58+ } else {
59+ r1 = ret.Error(1)
60+ }
61+ return r0, r1
62+}
63+
64+// MockXDGPaths_CacheDir_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'CacheDir'
65+type MockXDGPaths_CacheDir_Call struct {
66+ *mock.Call
67+}
68+
69+// CacheDir is a helper method to define mock.On call
70+func (_e *MockXDGPaths_Expecter) CacheDir() *MockXDGPaths_CacheDir_Call {
71+ return &MockXDGPaths_CacheDir_Call{Call: _e.mock.On("CacheDir")}
72+}
73+
74+func (_c *MockXDGPaths_CacheDir_Call) Run(run func()) *MockXDGPaths_CacheDir_Call {
75+ _c.Call.Run(func(args mock.Arguments) {
76+ run()
77+ })
78+ return _c
79+}
80+
81+func (_c *MockXDGPaths_CacheDir_Call) Return(s string, err error) *MockXDGPaths_CacheDir_Call {
82+ _c.Call.Return(s, err)
83+ return _c
84+}
85+
86+func (_c *MockXDGPaths_CacheDir_Call) RunAndReturn(run func() (string, error)) *MockXDGPaths_CacheDir_Call {
87+ _c.Call.Return(run)
88+ return _c
89+}
90+
91+// ConfigDir provides a mock function for the type MockXDGPaths
92+func (_mock *MockXDGPaths) ConfigDir() (string, error) {
93+ ret := _mock.Called()
94+
95+ if len(ret) == 0 {
96+ panic("no return value specified for ConfigDir")
97+ }
98+
99+ var r0 string
100+ var r1 error
101+ if returnFunc, ok := ret.Get(0).(func() (string, error)); ok {
102+ return returnFunc()
103+ }
104+ if returnFunc, ok := ret.Get(0).(func() string); ok {
105+ r0 = returnFunc()
106+ } else {
107+ r0 = ret.Get(0).(string)
108+ }
109+ if returnFunc, ok := ret.Get(1).(func() error); ok {
110+ r1 = returnFunc()
111+ } else {
112+ r1 = ret.Error(1)
113+ }
114+ return r0, r1
115+}
116+
117+// MockXDGPaths_ConfigDir_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ConfigDir'
118+type MockXDGPaths_ConfigDir_Call struct {
119+ *mock.Call
120+}
121+
122+// ConfigDir is a helper method to define mock.On call
123+func (_e *MockXDGPaths_Expecter) ConfigDir() *MockXDGPaths_ConfigDir_Call {
124+ return &MockXDGPaths_ConfigDir_Call{Call: _e.mock.On("ConfigDir")}
125+}
126+
127+func (_c *MockXDGPaths_ConfigDir_Call) Run(run func()) *MockXDGPaths_ConfigDir_Call {
128+ _c.Call.Run(func(args mock.Arguments) {
129+ run()
130+ })
131+ return _c
132+}
133+
134+func (_c *MockXDGPaths_ConfigDir_Call) Return(s string, err error) *MockXDGPaths_ConfigDir_Call {
135+ _c.Call.Return(s, err)
136+ return _c
137+}
138+
139+func (_c *MockXDGPaths_ConfigDir_Call) RunAndReturn(run func() (string, error)) *MockXDGPaths_ConfigDir_Call {
140+ _c.Call.Return(run)
141+ return _c
142+}
143+
144+// DataDir provides a mock function for the type MockXDGPaths
145+func (_mock *MockXDGPaths) DataDir() (string, error) {
146+ ret := _mock.Called()
147+
148+ if len(ret) == 0 {
149+ panic("no return value specified for DataDir")
150+ }
151+
152+ var r0 string
153+ var r1 error
154+ if returnFunc, ok := ret.Get(0).(func() (string, error)); ok {
155+ return returnFunc()
156+ }
157+ if returnFunc, ok := ret.Get(0).(func() string); ok {
158+ r0 = returnFunc()
159+ } else {
160+ r0 = ret.Get(0).(string)
161+ }
162+ if returnFunc, ok := ret.Get(1).(func() error); ok {
163+ r1 = returnFunc()
164+ } else {
165+ r1 = ret.Error(1)
166+ }
167+ return r0, r1
168+}
169+
170+// MockXDGPaths_DataDir_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'DataDir'
171+type MockXDGPaths_DataDir_Call struct {
172+ *mock.Call
173+}
174+
175+// DataDir is a helper method to define mock.On call
176+func (_e *MockXDGPaths_Expecter) DataDir() *MockXDGPaths_DataDir_Call {
177+ return &MockXDGPaths_DataDir_Call{Call: _e.mock.On("DataDir")}
178+}
179+
180+func (_c *MockXDGPaths_DataDir_Call) Run(run func()) *MockXDGPaths_DataDir_Call {
181+ _c.Call.Run(func(args mock.Arguments) {
182+ run()
183+ })
184+ return _c
185+}
186+
187+func (_c *MockXDGPaths_DataDir_Call) Return(s string, err error) *MockXDGPaths_DataDir_Call {
188+ _c.Call.Return(s, err)
189+ return _c
190+}
191+
192+func (_c *MockXDGPaths_DataDir_Call) RunAndReturn(run func() (string, error)) *MockXDGPaths_DataDir_Call {
193+ _c.Call.Return(run)
194+ return _c
195+}
196+
197+// DownloadDir provides a mock function for the type MockXDGPaths
198+func (_mock *MockXDGPaths) DownloadDir() (string, error) {
199+ ret := _mock.Called()
200+
201+ if len(ret) == 0 {
202+ panic("no return value specified for DownloadDir")
203+ }
204+
205+ var r0 string
206+ var r1 error
207+ if returnFunc, ok := ret.Get(0).(func() (string, error)); ok {
208+ return returnFunc()
209+ }
210+ if returnFunc, ok := ret.Get(0).(func() string); ok {
211+ r0 = returnFunc()
212+ } else {
213+ r0 = ret.Get(0).(string)
214+ }
215+ if returnFunc, ok := ret.Get(1).(func() error); ok {
216+ r1 = returnFunc()
217+ } else {
218+ r1 = ret.Error(1)
219+ }
220+ return r0, r1
221+}
222+
223+// MockXDGPaths_DownloadDir_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'DownloadDir'
224+type MockXDGPaths_DownloadDir_Call struct {
225+ *mock.Call
226+}
227+
228+// DownloadDir is a helper method to define mock.On call
229+func (_e *MockXDGPaths_Expecter) DownloadDir() *MockXDGPaths_DownloadDir_Call {
230+ return &MockXDGPaths_DownloadDir_Call{Call: _e.mock.On("DownloadDir")}
231+}
232+
233+func (_c *MockXDGPaths_DownloadDir_Call) Run(run func()) *MockXDGPaths_DownloadDir_Call {
234+ _c.Call.Run(func(args mock.Arguments) {
235+ run()
236+ })
237+ return _c
238+}
239+
240+func (_c *MockXDGPaths_DownloadDir_Call) Return(s string, err error) *MockXDGPaths_DownloadDir_Call {
241+ _c.Call.Return(s, err)
242+ return _c
243+}
244+
245+func (_c *MockXDGPaths_DownloadDir_Call) RunAndReturn(run func() (string, error)) *MockXDGPaths_DownloadDir_Call {
246+ _c.Call.Return(run)
247+ return _c
248+}
249+
250+// FilterCacheDir provides a mock function for the type MockXDGPaths
251+func (_mock *MockXDGPaths) FilterCacheDir() (string, error) {
252+ ret := _mock.Called()
253+
254+ if len(ret) == 0 {
255+ panic("no return value specified for FilterCacheDir")
256+ }
257+
258+ var r0 string
259+ var r1 error
260+ if returnFunc, ok := ret.Get(0).(func() (string, error)); ok {
261+ return returnFunc()
262+ }
263+ if returnFunc, ok := ret.Get(0).(func() string); ok {
264+ r0 = returnFunc()
265+ } else {
266+ r0 = ret.Get(0).(string)
267+ }
268+ if returnFunc, ok := ret.Get(1).(func() error); ok {
269+ r1 = returnFunc()
270+ } else {
271+ r1 = ret.Error(1)
272+ }
273+ return r0, r1
274+}
275+
276+// MockXDGPaths_FilterCacheDir_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'FilterCacheDir'
277+type MockXDGPaths_FilterCacheDir_Call struct {
278+ *mock.Call
279+}
280+
281+// FilterCacheDir is a helper method to define mock.On call
282+func (_e *MockXDGPaths_Expecter) FilterCacheDir() *MockXDGPaths_FilterCacheDir_Call {
283+ return &MockXDGPaths_FilterCacheDir_Call{Call: _e.mock.On("FilterCacheDir")}
284+}
285+
286+func (_c *MockXDGPaths_FilterCacheDir_Call) Run(run func()) *MockXDGPaths_FilterCacheDir_Call {
287+ _c.Call.Run(func(args mock.Arguments) {
288+ run()
289+ })
290+ return _c
291+}
292+
293+func (_c *MockXDGPaths_FilterCacheDir_Call) Return(s string, err error) *MockXDGPaths_FilterCacheDir_Call {
294+ _c.Call.Return(s, err)
295+ return _c
296+}
297+
298+func (_c *MockXDGPaths_FilterCacheDir_Call) RunAndReturn(run func() (string, error)) *MockXDGPaths_FilterCacheDir_Call {
299+ _c.Call.Return(run)
300+ return _c
301+}
302+
303+// FilterJSONDir provides a mock function for the type MockXDGPaths
304+func (_mock *MockXDGPaths) FilterJSONDir() (string, error) {
305+ ret := _mock.Called()
306+
307+ if len(ret) == 0 {
308+ panic("no return value specified for FilterJSONDir")
309+ }
310+
311+ var r0 string
312+ var r1 error
313+ if returnFunc, ok := ret.Get(0).(func() (string, error)); ok {
314+ return returnFunc()
315+ }
316+ if returnFunc, ok := ret.Get(0).(func() string); ok {
317+ r0 = returnFunc()
318+ } else {
319+ r0 = ret.Get(0).(string)
320+ }
321+ if returnFunc, ok := ret.Get(1).(func() error); ok {
322+ r1 = returnFunc()
323+ } else {
324+ r1 = ret.Error(1)
325+ }
326+ return r0, r1
327+}
328+
329+// MockXDGPaths_FilterJSONDir_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'FilterJSONDir'
330+type MockXDGPaths_FilterJSONDir_Call struct {
331+ *mock.Call
332+}
333+
334+// FilterJSONDir is a helper method to define mock.On call
335+func (_e *MockXDGPaths_Expecter) FilterJSONDir() *MockXDGPaths_FilterJSONDir_Call {
336+ return &MockXDGPaths_FilterJSONDir_Call{Call: _e.mock.On("FilterJSONDir")}
337+}
338+
339+func (_c *MockXDGPaths_FilterJSONDir_Call) Run(run func()) *MockXDGPaths_FilterJSONDir_Call {
340+ _c.Call.Run(func(args mock.Arguments) {
341+ run()
342+ })
343+ return _c
344+}
345+
346+func (_c *MockXDGPaths_FilterJSONDir_Call) Return(s string, err error) *MockXDGPaths_FilterJSONDir_Call {
347+ _c.Call.Return(s, err)
348+ return _c
349+}
350+
351+func (_c *MockXDGPaths_FilterJSONDir_Call) RunAndReturn(run func() (string, error)) *MockXDGPaths_FilterJSONDir_Call {
352+ _c.Call.Return(run)
353+ return _c
354+}
355+
356+// FilterStoreDir provides a mock function for the type MockXDGPaths
357+func (_mock *MockXDGPaths) FilterStoreDir() (string, error) {
358+ ret := _mock.Called()
359+
360+ if len(ret) == 0 {
361+ panic("no return value specified for FilterStoreDir")
362+ }
363+
364+ var r0 string
365+ var r1 error
366+ if returnFunc, ok := ret.Get(0).(func() (string, error)); ok {
367+ return returnFunc()
368+ }
369+ if returnFunc, ok := ret.Get(0).(func() string); ok {
370+ r0 = returnFunc()
371+ } else {
372+ r0 = ret.Get(0).(string)
373+ }
374+ if returnFunc, ok := ret.Get(1).(func() error); ok {
375+ r1 = returnFunc()
376+ } else {
377+ r1 = ret.Error(1)
378+ }
379+ return r0, r1
380+}
381+
382+// MockXDGPaths_FilterStoreDir_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'FilterStoreDir'
383+type MockXDGPaths_FilterStoreDir_Call struct {
384+ *mock.Call
385+}
386+
387+// FilterStoreDir is a helper method to define mock.On call
388+func (_e *MockXDGPaths_Expecter) FilterStoreDir() *MockXDGPaths_FilterStoreDir_Call {
389+ return &MockXDGPaths_FilterStoreDir_Call{Call: _e.mock.On("FilterStoreDir")}
390+}
391+
392+func (_c *MockXDGPaths_FilterStoreDir_Call) Run(run func()) *MockXDGPaths_FilterStoreDir_Call {
393+ _c.Call.Run(func(args mock.Arguments) {
394+ run()
395+ })
396+ return _c
397+}
398+
399+func (_c *MockXDGPaths_FilterStoreDir_Call) Return(s string, err error) *MockXDGPaths_FilterStoreDir_Call {
400+ _c.Call.Return(s, err)
401+ return _c
402+}
403+
404+func (_c *MockXDGPaths_FilterStoreDir_Call) RunAndReturn(run func() (string, error)) *MockXDGPaths_FilterStoreDir_Call {
405+ _c.Call.Return(run)
406+ return _c
407+}
408+
409+// ManDir provides a mock function for the type MockXDGPaths
410+func (_mock *MockXDGPaths) ManDir() (string, error) {
411+ ret := _mock.Called()
412+
413+ if len(ret) == 0 {
414+ panic("no return value specified for ManDir")
415+ }
416+
417+ var r0 string
418+ var r1 error
419+ if returnFunc, ok := ret.Get(0).(func() (string, error)); ok {
420+ return returnFunc()
421+ }
422+ if returnFunc, ok := ret.Get(0).(func() string); ok {
423+ r0 = returnFunc()
424+ } else {
425+ r0 = ret.Get(0).(string)
426+ }
427+ if returnFunc, ok := ret.Get(1).(func() error); ok {
428+ r1 = returnFunc()
429+ } else {
430+ r1 = ret.Error(1)
431+ }
432+ return r0, r1
433+}
434+
435+// MockXDGPaths_ManDir_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ManDir'
436+type MockXDGPaths_ManDir_Call struct {
437+ *mock.Call
438+}
439+
440+// ManDir is a helper method to define mock.On call
441+func (_e *MockXDGPaths_Expecter) ManDir() *MockXDGPaths_ManDir_Call {
442+ return &MockXDGPaths_ManDir_Call{Call: _e.mock.On("ManDir")}
443+}
444+
445+func (_c *MockXDGPaths_ManDir_Call) Run(run func()) *MockXDGPaths_ManDir_Call {
446+ _c.Call.Run(func(args mock.Arguments) {
447+ run()
448+ })
449+ return _c
450+}
451+
452+func (_c *MockXDGPaths_ManDir_Call) Return(s string, err error) *MockXDGPaths_ManDir_Call {
453+ _c.Call.Return(s, err)
454+ return _c
455+}
456+
457+func (_c *MockXDGPaths_ManDir_Call) RunAndReturn(run func() (string, error)) *MockXDGPaths_ManDir_Call {
458+ _c.Call.Return(run)
459+ return _c
460+}
461+
462+// RuntimeDir provides a mock function for the type MockXDGPaths
463+func (_mock *MockXDGPaths) RuntimeDir() (string, error) {
464+ ret := _mock.Called()
465+
466+ if len(ret) == 0 {
467+ panic("no return value specified for RuntimeDir")
468+ }
469+
470+ var r0 string
471+ var r1 error
472+ if returnFunc, ok := ret.Get(0).(func() (string, error)); ok {
473+ return returnFunc()
474+ }
475+ if returnFunc, ok := ret.Get(0).(func() string); ok {
476+ r0 = returnFunc()
477+ } else {
478+ r0 = ret.Get(0).(string)
479+ }
480+ if returnFunc, ok := ret.Get(1).(func() error); ok {
481+ r1 = returnFunc()
482+ } else {
483+ r1 = ret.Error(1)
484+ }
485+ return r0, r1
486+}
487+
488+// MockXDGPaths_RuntimeDir_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'RuntimeDir'
489+type MockXDGPaths_RuntimeDir_Call struct {
490+ *mock.Call
491+}
492+
493+// RuntimeDir is a helper method to define mock.On call
494+func (_e *MockXDGPaths_Expecter) RuntimeDir() *MockXDGPaths_RuntimeDir_Call {
495+ return &MockXDGPaths_RuntimeDir_Call{Call: _e.mock.On("RuntimeDir")}
496+}
497+
498+func (_c *MockXDGPaths_RuntimeDir_Call) Run(run func()) *MockXDGPaths_RuntimeDir_Call {
499+ _c.Call.Run(func(args mock.Arguments) {
500+ run()
501+ })
502+ return _c
503+}
504+
505+func (_c *MockXDGPaths_RuntimeDir_Call) Return(s string, err error) *MockXDGPaths_RuntimeDir_Call {
506+ _c.Call.Return(s, err)
507+ return _c
508+}
509+
510+func (_c *MockXDGPaths_RuntimeDir_Call) RunAndReturn(run func() (string, error)) *MockXDGPaths_RuntimeDir_Call {
511+ _c.Call.Return(run)
512+ return _c
513+}
514+
515+// StateDir provides a mock function for the type MockXDGPaths
516+func (_mock *MockXDGPaths) StateDir() (string, error) {
517+ ret := _mock.Called()
518+
519+ if len(ret) == 0 {
520+ panic("no return value specified for StateDir")
521+ }
522+
523+ var r0 string
524+ var r1 error
525+ if returnFunc, ok := ret.Get(0).(func() (string, error)); ok {
526+ return returnFunc()
527+ }
528+ if returnFunc, ok := ret.Get(0).(func() string); ok {
529+ r0 = returnFunc()
530+ } else {
531+ r0 = ret.Get(0).(string)
532+ }
533+ if returnFunc, ok := ret.Get(1).(func() error); ok {
534+ r1 = returnFunc()
535+ } else {
536+ r1 = ret.Error(1)
537+ }
538+ return r0, r1
539+}
540+
541+// MockXDGPaths_StateDir_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'StateDir'
542+type MockXDGPaths_StateDir_Call struct {
543+ *mock.Call
544+}
545+
546+// StateDir is a helper method to define mock.On call
547+func (_e *MockXDGPaths_Expecter) StateDir() *MockXDGPaths_StateDir_Call {
548+ return &MockXDGPaths_StateDir_Call{Call: _e.mock.On("StateDir")}
549+}
550+
551+func (_c *MockXDGPaths_StateDir_Call) Run(run func()) *MockXDGPaths_StateDir_Call {
552+ _c.Call.Run(func(args mock.Arguments) {
553+ run()
554+ })
555+ return _c
556+}
557+
558+func (_c *MockXDGPaths_StateDir_Call) Return(s string, err error) *MockXDGPaths_StateDir_Call {
559+ _c.Call.Return(s, err)
560+ return _c
561+}
562+
563+func (_c *MockXDGPaths_StateDir_Call) RunAndReturn(run func() (string, error)) *MockXDGPaths_StateDir_Call {
564+ _c.Call.Return(run)
565+ return _c
566+}
A internal/application/port/runtime_config.go +9 -0
@@ -0,0 +1,9 @@
1+package port
2+
3+import "github.com/bnema/dumber/internal/domain/entity"
4+
5+type RuntimeConfigProvider interface {
6+ Current() entity.RuntimeConfigSnapshot
7+ Watch() error
8+ OnChange(func(entity.RuntimeConfigSnapshot))
9+}
M internal/application/usecase/execute_context_menu_action_test.go +88 -144
@@ -6,79 +6,21 @@ import (
66 "testing"
77
88 "github.com/bnema/dumber/internal/application/port"
9+ portmocks "github.com/bnema/dumber/internal/application/port/mocks"
910 "github.com/bnema/dumber/internal/domain/entity"
11+ "github.com/stretchr/testify/mock"
1012 "github.com/stretchr/testify/require"
1113 )
1214
13-type fakeClipboard struct {
14- writeTextCalls int
15- writeImageCalls int
16- text string
17- image entity.ImageData
18-}
19-
20-func (f *fakeClipboard) WriteText(_ context.Context, text string) error {
21- f.writeTextCalls++
22- f.text = text
23- return nil
24-}
25-
26-func (f *fakeClipboard) WriteImage(_ context.Context, image entity.ImageData) error {
27- f.writeImageCalls++
28- f.image = image
29- return nil
30-}
31-
32-func (*fakeClipboard) ReadText(context.Context) (string, error) { return "", nil }
33-func (*fakeClipboard) Clear(context.Context) error { return nil }
34-func (*fakeClipboard) HasText(context.Context) (bool, error) { return false, nil }
35-
36-type fakeImageResolver struct {
37- resolveCalls int
38- uri string
39- image entity.ImageData
40- err error
41-}
42-
43-func (f *fakeImageResolver) ResolveImageData(_ context.Context, uri string) (entity.ImageData, error) {
44- f.resolveCalls++
45- f.uri = uri
46- return f.image, f.err
47-}
48-
49-type fakeResolvedImageSaver struct {
50- saveCalls int
51- image entity.ImageData
52- menuContext port.MenuContext
53- err error
54-}
55-
56-func (f *fakeResolvedImageSaver) SaveResolvedImage(_ context.Context, image entity.ImageData, menuContext port.MenuContext) error {
57- f.saveCalls++
58- f.image = image
59- f.menuContext = menuContext
60- return f.err
61-}
62-
63-type fakeMenuActionDelegator struct {
64- delegateCalls int
65- action port.MenuAction
66- menuContext port.MenuContext
67- err error
68-}
69-
70-func (f *fakeMenuActionDelegator) DelegateMenuAction(_ context.Context, action port.MenuAction, menuContext port.MenuContext) error {
71- f.delegateCalls++
72- f.action = action
73- f.menuContext = menuContext
74- return f.err
75-}
76-
7715 func TestExecuteContextMenuActionUseCase_CopyImageFailsWithoutResolvedData(t *testing.T) {
78- clipboard := &fakeClipboard{}
79- resolver := &fakeImageResolver{}
80- saver := &fakeResolvedImageSaver{}
81- delegator := &fakeMenuActionDelegator{}
16+ clipboard := portmocks.NewMockClipboard(t)
17+ resolver := portmocks.NewMockImageDataResolver(t)
18+ saver := portmocks.NewMockResolvedImageSaver(t)
19+ delegator := portmocks.NewMockMenuActionDelegator(t)
20+ resolver.EXPECT().
21+ ResolveImageData(mock.Anything, "https://example.com/image.png").
22+ Return(entity.ImageData{}, nil).
23+ Once()
8224 uc := NewExecuteContextMenuActionUseCase(clipboard, resolver, saver, delegator)
8325
8426 err := uc.Execute(context.Background(), ExecuteContextMenuActionInput{
@@ -89,16 +31,22 @@ func TestExecuteContextMenuActionUseCase_CopyImageFailsWithoutResolvedData(t *te
8931 require.Error(t, err)
9032 require.Contains(t, err.Error(), "copy image:")
9133 require.Contains(t, err.Error(), "image data not available")
92- require.Zero(t, clipboard.writeImageCalls)
93- require.Zero(t, saver.saveCalls)
94- require.Zero(t, delegator.delegateCalls)
9534 }
9635
9736 func TestExecuteContextMenuActionUseCase_CopyImageWritesResolvedImage(t *testing.T) {
98- clipboard := &fakeClipboard{}
99- resolver := &fakeImageResolver{image: entity.ImageData{Bytes: []byte{1, 2, 3}, MimeType: "image/png"}}
100- saver := &fakeResolvedImageSaver{}
101- delegator := &fakeMenuActionDelegator{}
37+ clipboard := portmocks.NewMockClipboard(t)
38+ resolver := portmocks.NewMockImageDataResolver(t)
39+ saver := portmocks.NewMockResolvedImageSaver(t)
40+ delegator := portmocks.NewMockMenuActionDelegator(t)
41+ image := entity.ImageData{Bytes: []byte{1, 2, 3}, MimeType: "image/png"}
42+ resolver.EXPECT().
43+ ResolveImageData(mock.Anything, "https://example.com/image.png").
44+ Return(image, nil).
45+ Once()
46+ clipboard.EXPECT().
47+ WriteImage(mock.Anything, image).
48+ Return(nil).
49+ Once()
10250 uc := NewExecuteContextMenuActionUseCase(clipboard, resolver, saver, delegator)
10351
10452 err := uc.Execute(context.Background(), ExecuteContextMenuActionInput{
@@ -107,18 +55,12 @@ func TestExecuteContextMenuActionUseCase_CopyImageWritesResolvedImage(t *testing
10755 })
10856
10957 require.NoError(t, err)
110- require.Equal(t, 1, resolver.resolveCalls)
111- require.Equal(t, "https://example.com/image.png", resolver.uri)
112- require.Equal(t, 1, clipboard.writeImageCalls)
113- require.Equal(t, entity.ImageData{Bytes: []byte{1, 2, 3}, MimeType: "image/png"}, clipboard.image)
114- require.Zero(t, saver.saveCalls)
115- require.Zero(t, delegator.delegateCalls)
11658 }
11759
11860 func TestExecuteContextMenuActionUseCase_CopyImageFailsFastWithoutClipboard(t *testing.T) {
119- resolver := &fakeImageResolver{}
120- saver := &fakeResolvedImageSaver{}
121- delegator := &fakeMenuActionDelegator{}
61+ resolver := portmocks.NewMockImageDataResolver(t)
62+ saver := portmocks.NewMockResolvedImageSaver(t)
63+ delegator := portmocks.NewMockMenuActionDelegator(t)
12264 uc := NewExecuteContextMenuActionUseCase(nil, resolver, saver, delegator)
12365
12466 err := uc.Execute(context.Background(), ExecuteContextMenuActionInput{
@@ -128,38 +70,37 @@ func TestExecuteContextMenuActionUseCase_CopyImageFailsFastWithoutClipboard(t *t
12870
12971 require.Error(t, err)
13072 require.Contains(t, err.Error(), "clipboard not available")
131- require.Zero(t, resolver.resolveCalls)
132- require.Zero(t, saver.saveCalls)
133- require.Zero(t, delegator.delegateCalls)
13473 }
13574
13675 func TestExecuteContextMenuActionUseCase_SaveImageDelegatesResolvedImage(t *testing.T) {
137- clipboard := &fakeClipboard{}
138- resolver := &fakeImageResolver{image: entity.ImageData{Bytes: []byte{1, 2, 3}, MimeType: "image/png"}}
139- saver := &fakeResolvedImageSaver{}
140- delegator := &fakeMenuActionDelegator{}
76+ clipboard := portmocks.NewMockClipboard(t)
77+ resolver := portmocks.NewMockImageDataResolver(t)
78+ saver := portmocks.NewMockResolvedImageSaver(t)
79+ delegator := portmocks.NewMockMenuActionDelegator(t)
80+ image := entity.ImageData{Bytes: []byte{1, 2, 3}, MimeType: "image/png"}
81+ menuContext := port.MenuContext{ImageURI: "https://example.com/image.png"}
82+ resolver.EXPECT().
83+ ResolveImageData(mock.Anything, menuContext.ImageURI).
84+ Return(image, nil).
85+ Once()
86+ saver.EXPECT().
87+ SaveResolvedImage(mock.Anything, image, menuContext).
88+ Return(nil).
89+ Once()
14190 uc := NewExecuteContextMenuActionUseCase(clipboard, resolver, saver, delegator)
14291
14392 err := uc.Execute(context.Background(), ExecuteContextMenuActionInput{
14493 Action: port.MenuActionSaveImage,
145- Context: port.MenuContext{ImageURI: "https://example.com/image.png"},
94+ Context: menuContext,
14695 })
14796
14897 require.NoError(t, err)
149- require.Equal(t, 1, resolver.resolveCalls)
150- require.Equal(t, "https://example.com/image.png", resolver.uri)
151- require.Equal(t, 1, saver.saveCalls)
152- require.Equal(t, entity.ImageData{Bytes: []byte{1, 2, 3}, MimeType: "image/png"}, saver.image)
153- require.Equal(t, port.MenuContext{ImageURI: "https://example.com/image.png"}, saver.menuContext)
154- require.Zero(t, clipboard.writeTextCalls)
155- require.Zero(t, clipboard.writeImageCalls)
156- require.Zero(t, delegator.delegateCalls)
15798 }
15899
159100 func TestExecuteContextMenuActionUseCase_SaveImageFailsFastWithoutSaver(t *testing.T) {
160- clipboard := &fakeClipboard{}
161- resolver := &fakeImageResolver{}
162- delegator := &fakeMenuActionDelegator{}
101+ clipboard := portmocks.NewMockClipboard(t)
102+ resolver := portmocks.NewMockImageDataResolver(t)
103+ delegator := portmocks.NewMockMenuActionDelegator(t)
163104 uc := NewExecuteContextMenuActionUseCase(clipboard, resolver, nil, delegator)
164105
165106 err := uc.Execute(context.Background(), ExecuteContextMenuActionInput{
@@ -169,42 +110,41 @@ func TestExecuteContextMenuActionUseCase_SaveImageFailsFastWithoutSaver(t *testi
169110
170111 require.Error(t, err)
171112 require.Contains(t, err.Error(), "image saver not available")
172- require.Zero(t, resolver.resolveCalls)
173- require.Zero(t, delegator.delegateCalls)
174113 }
175114
176115 func TestExecuteContextMenuActionUseCase_DelegatesInspect(t *testing.T) {
177- clipboard := &fakeClipboard{}
178- resolver := &fakeImageResolver{}
179- saver := &fakeResolvedImageSaver{}
180- delegator := &fakeMenuActionDelegator{}
181- uc := NewExecuteContextMenuActionUseCase(clipboard, resolver, saver, delegator)
182-
183116 menuContext := port.MenuContext{
184117 PageURI: "https://example.com",
185118 X: 17,
186119 Y: 42,
187120 }
121+ clipboard := portmocks.NewMockClipboard(t)
122+ resolver := portmocks.NewMockImageDataResolver(t)
123+ saver := portmocks.NewMockResolvedImageSaver(t)
124+ delegator := portmocks.NewMockMenuActionDelegator(t)
125+ delegator.EXPECT().
126+ DelegateMenuAction(mock.Anything, port.MenuActionInspectElement, menuContext).
127+ Return(nil).
128+ Once()
129+ uc := NewExecuteContextMenuActionUseCase(clipboard, resolver, saver, delegator)
130+
188131 err := uc.Execute(context.Background(), ExecuteContextMenuActionInput{
189132 Action: port.MenuActionInspectElement,
190133 Context: menuContext,
191134 })
192135
193136 require.NoError(t, err)
194- require.Equal(t, 1, delegator.delegateCalls)
195- require.Equal(t, port.MenuActionInspectElement, delegator.action)
196- require.Equal(t, menuContext, delegator.menuContext)
197- require.Zero(t, clipboard.writeTextCalls)
198- require.Zero(t, clipboard.writeImageCalls)
199- require.Zero(t, resolver.resolveCalls)
200- require.Zero(t, saver.saveCalls)
201137 }
202138
203139 func TestExecuteContextMenuActionUseCase_WrapsDelegateErrors(t *testing.T) {
204- clipboard := &fakeClipboard{}
205- resolver := &fakeImageResolver{}
206- saver := &fakeResolvedImageSaver{}
207- delegator := &fakeMenuActionDelegator{err: errors.New("boom")}
140+ clipboard := portmocks.NewMockClipboard(t)
141+ resolver := portmocks.NewMockImageDataResolver(t)
142+ saver := portmocks.NewMockResolvedImageSaver(t)
143+ delegator := portmocks.NewMockMenuActionDelegator(t)
144+ delegator.EXPECT().
145+ DelegateMenuAction(mock.Anything, port.MenuActionCopySelection, port.MenuContext{HasSelection: true}).
146+ Return(errors.New("boom")).
147+ Once()
208148 uc := NewExecuteContextMenuActionUseCase(clipboard, resolver, saver, delegator)
209149
210150 err := uc.Execute(context.Background(), ExecuteContextMenuActionInput{
@@ -218,10 +158,14 @@ func TestExecuteContextMenuActionUseCase_WrapsDelegateErrors(t *testing.T) {
218158 }
219159
220160 func TestExecuteContextMenuActionUseCase_CopySelectionWritesSelectedText(t *testing.T) {
221- clipboard := &fakeClipboard{}
222- resolver := &fakeImageResolver{}
223- saver := &fakeResolvedImageSaver{}
224- delegator := &fakeMenuActionDelegator{}
161+ clipboard := portmocks.NewMockClipboard(t)
162+ resolver := portmocks.NewMockImageDataResolver(t)
163+ saver := portmocks.NewMockResolvedImageSaver(t)
164+ delegator := portmocks.NewMockMenuActionDelegator(t)
165+ clipboard.EXPECT().
166+ WriteText(mock.Anything, "selected text").
167+ Return(nil).
168+ Once()
225169 uc := NewExecuteContextMenuActionUseCase(clipboard, resolver, saver, delegator)
226170
227171 err := uc.Execute(context.Background(), ExecuteContextMenuActionInput{
@@ -233,15 +177,19 @@ func TestExecuteContextMenuActionUseCase_CopySelectionWritesSelectedText(t *test
233177 })
234178
235179 require.NoError(t, err)
236- require.Equal(t, 1, clipboard.writeTextCalls)
237- require.Equal(t, "selected text", clipboard.text)
238- require.Zero(t, delegator.delegateCalls)
239180 }
240181
241182 func TestExecuteContextMenuActionUseCase_CopySelectionFallsBackToDelegatorWhenClipboardMissing(t *testing.T) {
242- resolver := &fakeImageResolver{}
243- saver := &fakeResolvedImageSaver{}
244- delegator := &fakeMenuActionDelegator{}
183+ resolver := portmocks.NewMockImageDataResolver(t)
184+ saver := portmocks.NewMockResolvedImageSaver(t)
185+ delegator := portmocks.NewMockMenuActionDelegator(t)
186+ delegator.EXPECT().
187+ DelegateMenuAction(mock.Anything, port.MenuActionCopySelection, port.MenuContext{
188+ HasSelection: true,
189+ SelectionText: "selected text",
190+ }).
191+ Return(nil).
192+ Once()
245193 uc := NewExecuteContextMenuActionUseCase(nil, resolver, saver, delegator)
246194
247195 err := uc.Execute(context.Background(), ExecuteContextMenuActionInput{
@@ -253,15 +201,17 @@ func TestExecuteContextMenuActionUseCase_CopySelectionFallsBackToDelegatorWhenCl
253201 })
254202
255203 require.NoError(t, err)
256- require.Equal(t, 1, delegator.delegateCalls)
257- require.Equal(t, port.MenuActionCopySelection, delegator.action)
258204 }
259205
260206 func TestExecuteContextMenuActionUseCase_CopyLinkWritesText(t *testing.T) {
261- clipboard := &fakeClipboard{}
262- resolver := &fakeImageResolver{}
263- saver := &fakeResolvedImageSaver{}
264- delegator := &fakeMenuActionDelegator{}
207+ clipboard := portmocks.NewMockClipboard(t)
208+ resolver := portmocks.NewMockImageDataResolver(t)
209+ saver := portmocks.NewMockResolvedImageSaver(t)
210+ delegator := portmocks.NewMockMenuActionDelegator(t)
211+ clipboard.EXPECT().
212+ WriteText(mock.Anything, "https://example.com/link").
213+ Return(nil).
214+ Once()
265215 uc := NewExecuteContextMenuActionUseCase(clipboard, resolver, saver, delegator)
266216
267217 err := uc.Execute(context.Background(), ExecuteContextMenuActionInput{
@@ -270,10 +220,4 @@ func TestExecuteContextMenuActionUseCase_CopyLinkWritesText(t *testing.T) {
270220 })
271221
272222 require.NoError(t, err)
273- require.Equal(t, 1, clipboard.writeTextCalls)
274- require.Equal(t, "https://example.com/link", clipboard.text)
275- require.Zero(t, clipboard.writeImageCalls)
276- require.Zero(t, resolver.resolveCalls)
277- require.Zero(t, saver.saveCalls)
278- require.Zero(t, delegator.delegateCalls)
279223 }
M internal/application/usecase/favicon_test.go +175 -79
@@ -7,11 +7,13 @@ import (
77 "time"
88
99 appport "github.com/bnema/dumber/internal/application/port"
10+ portmocks "github.com/bnema/dumber/internal/application/port/mocks"
1011 "github.com/bnema/dumber/internal/domain/favicon"
12+ "github.com/stretchr/testify/mock"
1113 )
1214
1315 func TestFaviconResolveExactHit(t *testing.T) {
14- fx := newFaviconFixture()
16+ fx := newFaviconFixture(t)
1517 fx.seed("docs.example.com", []byte("png32"), false)
1618 got, err := fx.uc.Resolve(context.Background(), "https://docs.example.com/a", 32, ResolveOptions{Purpose: ResolvePurposeUI})
1719 if err != nil {
@@ -23,7 +25,7 @@ func TestFaviconResolveExactHit(t *testing.T) {
2325 }
2426
2527 func TestFaviconResolveParentFallback(t *testing.T) {
26- fx := newFaviconFixture()
28+ fx := newFaviconFixture(t)
2729 fx.seed("example.com", []byte("parent"), false)
2830 got, err := fx.uc.Resolve(context.Background(), "https://docs.example.com/a", 32, ResolveOptions{Purpose: ResolvePurposeUI})
2931 if err != nil {
@@ -35,7 +37,7 @@ func TestFaviconResolveParentFallback(t *testing.T) {
3537 }
3638
3739 func TestFaviconResolvePrefersParentPathFallbackBeforeDomain(t *testing.T) {
38- fx := newFaviconFixture()
40+ fx := newFaviconFixture(t)
3941 fx.seed("github.com", []byte("github-default"), false)
4042 fx.seed("github.com/bnema/gordon", []byte("repo-default"), false)
4143
@@ -49,7 +51,7 @@ func TestFaviconResolvePrefersParentPathFallbackBeforeDomain(t *testing.T) {
4951 }
5052
5153 func TestFaviconResolvePathSpecificDoesNotLeakToParentOrSiblings(t *testing.T) {
52- fx := newFaviconFixture()
54+ fx := newFaviconFixture(t)
5355 fx.seed("github.com", []byte("github-default"), false)
5456
5557 if _, err := fx.uc.Observe(
@@ -91,7 +93,7 @@ func TestFaviconResolvePathSpecificDoesNotLeakToParentOrSiblings(t *testing.T) {
9193 }
9294
9395 func TestFaviconResolveRepairsOrphanCanonicalBlobMetadata(t *testing.T) {
94- fx := newFaviconFixture()
96+ fx := newFaviconFixture(t)
9597 fx.blobs.png["example.com"] = []byte("png")
9698 fx.blobs.sized["example.com"] = map[int][]byte{SystemviewIconSize: []byte("png32")}
9799
@@ -112,7 +114,7 @@ func TestFaviconResolveRepairsOrphanCanonicalBlobMetadata(t *testing.T) {
112114 }
113115
114116 func TestFaviconResolveRepairOrphanWithoutConverterReturnsMiss(t *testing.T) {
115- fx := newFaviconFixture()
117+ fx := newFaviconFixture(t)
116118 fx.uc.converter = nil
117119 fx.blobs.original["example.com"] = []byte("original")
118120 fx.blobs.contentTypes["example.com"] = "image/png"
@@ -124,7 +126,7 @@ func TestFaviconResolveRepairOrphanWithoutConverterReturnsMiss(t *testing.T) {
124126 }
125127
126128 func TestFaviconResolveStaleSchedulesDedupedBackgroundRefresh(t *testing.T) {
127- fx := newFaviconFixture()
129+ fx := newFaviconFixture(t)
128130 fx.seed("example.com", []byte("old"), true)
129131 for i := 0; i < 2; i++ {
130132 got, err := fx.uc.Resolve(context.Background(), "https://example.com", 32, ResolveOptions{ScheduleBackgroundRefresh: true})
@@ -144,7 +146,7 @@ func TestFaviconResolveStaleSchedulesDedupedBackgroundRefresh(t *testing.T) {
144146 }
145147
146148 func TestFaviconResolveStaleExactRefreshIgnoresFreshParent(t *testing.T) {
147- fx := newFaviconFixture()
149+ fx := newFaviconFixture(t)
148150 fx.seed("docs.example.com", []byte("old-exact"), true)
149151 fx.seed("example.com", []byte("fresh-parent"), false)
150152 got, err := fx.uc.Resolve(
@@ -166,7 +168,7 @@ func TestFaviconResolveStaleExactRefreshIgnoresFreshParent(t *testing.T) {
166168 }
167169
168170 func TestFaviconObserveSameHashUpdatesMetadataOnly(t *testing.T) {
169- fx := newFaviconFixture()
171+ fx := newFaviconFixture(t)
170172 fx.seedOriginal([]byte("same"))
171173 if _, err := fx.uc.Observe(context.Background(), "https://example.com", "https://cdn.test/icon.png", []byte("same"), favicon.SourceEngine, "image/png"); err != nil {
172174 t.Fatal(err)
@@ -180,7 +182,7 @@ func TestFaviconObserveSameHashUpdatesMetadataOnly(t *testing.T) {
180182 }
181183
182184 func TestFaviconObserveChangedHashRegeneratesAndInvalidates(t *testing.T) {
183- fx := newFaviconFixture()
185+ fx := newFaviconFixture(t)
184186 fx.seedOriginal([]byte("old"))
185187 if _, err := fx.uc.Observe(context.Background(), "https://example.com", "https://cdn.test/icon.png", []byte("new"), favicon.SourceEngine, "image/png"); err != nil {
186188 t.Fatal(err)
@@ -197,7 +199,7 @@ func TestFaviconObserveChangedHashRegeneratesAndInvalidates(t *testing.T) {
197199 }
198200
199201 func TestFaviconObserveWithoutConverterStoresOriginalOnly(t *testing.T) {
200- fx := newFaviconFixture()
202+ fx := newFaviconFixture(t)
201203 fx.uc.converter = nil
202204 if _, err := fx.uc.Observe(context.Background(), "https://example.com", "https://example.com/icon.png", []byte("raw"), favicon.SourceEngine, "image/png"); err != nil {
203205 t.Fatal(err)
@@ -211,7 +213,7 @@ func TestFaviconObserveWithoutConverterStoresOriginalOnly(t *testing.T) {
211213 }
212214
213215 func TestFaviconResolveMissingFetchesOnlyWhenBlockingAllowed(t *testing.T) {
214- fx := newFaviconFixture()
216+ fx := newFaviconFixture(t)
215217 if _, err := fx.uc.Resolve(context.Background(), "https://example.com", 32, ResolveOptions{}); !errors.Is(err, ErrFaviconMiss) {
216218 t.Fatalf("default resolve err=%v", err)
217219 }
@@ -228,7 +230,7 @@ func TestFaviconResolveMissingFetchesOnlyWhenBlockingAllowed(t *testing.T) {
228230 }
229231
230232 func TestFaviconRefreshIfStaleUsesParentFallbackBeforeFetching(t *testing.T) {
231- fx := newFaviconFixture()
233+ fx := newFaviconFixture(t)
232234 fx.seed("example.com", []byte("parent"), false)
233235 if err := fx.uc.RefreshIfStale(context.Background(), "https://docs.example.com/page"); err != nil {
234236 t.Fatal(err)
@@ -239,7 +241,7 @@ func TestFaviconRefreshIfStaleUsesParentFallbackBeforeFetching(t *testing.T) {
239241 }
240242
241243 func TestFaviconUseCasePropagatesRepositoryErrors(t *testing.T) {
242- fx := newFaviconFixture()
244+ fx := newFaviconFixture(t)
243245 fx.repo.err = errors.New("database unavailable")
244246 if _, err := fx.uc.Resolve(context.Background(), "https://example.com", 32, ResolveOptions{}); !errors.Is(err, fx.repo.err) {
245247 t.Fatalf("Resolve err=%v, want %v", err, fx.repo.err)
@@ -253,7 +255,7 @@ func TestFaviconUseCasePropagatesRepositoryErrors(t *testing.T) {
253255 }
254256
255257 func TestFaviconResolvePropagatesBlobErrors(t *testing.T) {
256- fx := newFaviconFixture()
258+ fx := newFaviconFixture(t)
257259 fx.seed("example.com", []byte("cached"), false)
258260 fx.blobs.err = errors.New("disk unavailable")
259261 if _, err := fx.uc.Resolve(context.Background(), "https://example.com", 32, ResolveOptions{}); !errors.Is(err, fx.blobs.err) {
@@ -262,7 +264,7 @@ func TestFaviconResolvePropagatesBlobErrors(t *testing.T) {
262264 }
263265
264266 func TestFaviconResolveBlockingRefreshesWhenMetadataFreshButBlobMissing(t *testing.T) {
265- fx := newFaviconFixture()
267+ fx := newFaviconFixture(t)
266268 fx.repo.byKey["example.com"] = &favicon.Metadata{Key: "example.com", PageURL: "https://example.com", ContentHash: favicon.Hash([]byte("old")), LastCheckedAt: fx.now}
267269 got, err := fx.uc.Resolve(context.Background(), "https://example.com", 32, ResolveOptions{AllowBlockingRefresh: true})
268270 if err != nil {
@@ -274,7 +276,7 @@ func TestFaviconResolveBlockingRefreshesWhenMetadataFreshButBlobMissing(t *testi
274276 }
275277
276278 func TestFaviconResolveBlockingPropagatesFetchErrors(t *testing.T) {
277- fx := newFaviconFixture()
279+ fx := newFaviconFixture(t)
278280 fx.fetcher.err = errors.New("network unavailable")
279281 if _, err := fx.uc.Resolve(context.Background(), "https://example.com", 32, ResolveOptions{AllowBlockingRefresh: true}); !errors.Is(err, fx.fetcher.err) {
280282 t.Fatalf("Resolve err=%v, want %v", err, fx.fetcher.err)
@@ -282,7 +284,7 @@ func TestFaviconResolveBlockingPropagatesFetchErrors(t *testing.T) {
282284 }
283285
284286 func TestFaviconRefreshFromIconURLsUsesPageURLKey(t *testing.T) {
285- fx := newFaviconFixture()
287+ fx := newFaviconFixture(t)
286288 if err := fx.uc.RefreshFromIconURLs(context.Background(), "https://docs.example.com/page", []string{"https://cdn.example.net/icon.png"}); err != nil {
287289 t.Fatal(err)
288290 }
@@ -295,8 +297,8 @@ func TestFaviconRefreshFromIconURLsUsesPageURLKey(t *testing.T) {
295297 }
296298
297299 func TestFaviconRefreshStoresDuckDuckGoFallbackUnderHostKey(t *testing.T) {
298- fx := newFaviconFixture()
299- fx.fetcher.responses = map[string]fakeFetchedIcon{
300+ fx := newFaviconFixture(t)
301+ fx.fetcher.responses = map[string]faviconFetchResponse{
300302 "https://example.com/favicon.ico": {
301303 bytes: []byte("host-fallback"),
302304 contentType: "image/png",
@@ -316,8 +318,8 @@ func TestFaviconRefreshStoresDuckDuckGoFallbackUnderHostKey(t *testing.T) {
316318 }
317319
318320 func TestFaviconRefreshRejectsResolvedKeyOutsideCandidateHierarchy(t *testing.T) {
319- fx := newFaviconFixture()
320- fx.fetcher.responses = map[string]fakeFetchedIcon{
321+ fx := newFaviconFixture(t)
322+ fx.fetcher.responses = map[string]faviconFetchResponse{
321323 "https://example.com/favicon.ico": {
322324 bytes: []byte("bad-fallback"),
323325 contentType: "image/png",
@@ -335,8 +337,8 @@ func TestFaviconRefreshRejectsResolvedKeyOutsideCandidateHierarchy(t *testing.T)
335337 }
336338
337339 func TestFaviconRefreshRejectsFetcherPageURLOutsideRequestedHierarchy(t *testing.T) {
338- fx := newFaviconFixture()
339- fx.fetcher.responses = map[string]fakeFetchedIcon{
340+ fx := newFaviconFixture(t)
341+ fx.fetcher.responses = map[string]faviconFetchResponse{
340342 "https://example.com/favicon.ico": {
341343 bytes: []byte("bad-page-url"),
342344 contentType: "image/png",
@@ -355,8 +357,8 @@ func TestFaviconRefreshRejectsFetcherPageURLOutsideRequestedHierarchy(t *testing
355357 }
356358
357359 func TestFaviconRefreshFromIconURLsSkipsUnsupportedCandidates(t *testing.T) {
358- fx := newFaviconFixture()
359- fx.fetcher.responses = map[string]fakeFetchedIcon{
360+ fx := newFaviconFixture(t)
361+ fx.fetcher.responses = map[string]faviconFetchResponse{
360362 "https://cdn.example.net/icon.svg": {bytes: []byte("svg"), contentType: "image/svg+xml"},
361363 "https://cdn.example.net/icon.png": {bytes: []byte("png"), contentType: "image/png"},
362364 }
@@ -385,7 +387,7 @@ func TestFaviconRefreshFromIconURLsSkipsUnsupportedCandidates(t *testing.T) {
385387 }
386388
387389 func TestFaviconObserveConversionErrorDoesNotMutateExistingAssets(t *testing.T) {
388- fx := newFaviconFixture()
390+ fx := newFaviconFixture(t)
389391 fx.seedOriginal([]byte("old"))
390392 fx.blobs.png["example.com"] = []byte("old-png")
391393 fx.blobs.sized["example.com"] = map[int][]byte{32: []byte("old-32")}
@@ -403,7 +405,7 @@ func TestFaviconObserveConversionErrorDoesNotMutateExistingAssets(t *testing.T)
403405 }
404406
405407 func TestFaviconEnsureSizedPropagatesReadSizedErrors(t *testing.T) {
406- fx := newFaviconFixture()
408+ fx := newFaviconFixture(t)
407409 fx.seedOriginal([]byte("old"))
408410 fx.blobs.readSizedErr = errors.New("sized store unavailable")
409411 if err := fx.uc.EnsureSized(context.Background(), "example.com", 32); !errors.Is(err, fx.blobs.readSizedErr) {
@@ -415,12 +417,12 @@ func TestFaviconEnsureSizedPropagatesReadSizedErrors(t *testing.T) {
415417 }
416418
417419 type faviconFixture struct {
418- repo *fakeFaviconRepo
419- blobs *fakeBlobStore
420- converter *fakeConverter
421- scheduler *fakeScheduler
422- invalidators *fakeInvalidators
423- fetcher *fakeFetcher
420+ repo *faviconRepoState
421+ blobs *faviconBlobStoreState
422+ converter *faviconConverterState
423+ scheduler *faviconSchedulerState
424+ invalidators *faviconInvalidatorsState
425+ fetcher *faviconFetcherState
424426 uc *FaviconUseCase
425427 now time.Time
426428 }
@@ -429,29 +431,98 @@ type faviconTestContextKey string
429431
430432 const faviconFixtureBackgroundKey faviconTestContextKey = "bg"
431433
432-func newFaviconFixture() *faviconFixture {
434+func newFaviconFixture(t *testing.T) *faviconFixture {
435+ t.Helper()
436+
433437 now := time.Date(2025, 1, 1, 0, 0, 0, 0, time.UTC)
434438 fx := &faviconFixture{
435- repo: newFakeRepo(),
436- blobs: newFakeBlobStore(),
437- converter: &fakeConverter{},
438- scheduler: &fakeScheduler{seen: map[favicon.Key]bool{}},
439- invalidators: &fakeInvalidators{},
440- fetcher: &fakeFetcher{},
439+ repo: newFaviconRepoState(),
440+ blobs: newFaviconBlobStoreState(),
441+ converter: &faviconConverterState{},
442+ scheduler: &faviconSchedulerState{seen: map[favicon.Key]bool{}},
443+ invalidators: &faviconInvalidatorsState{},
444+ fetcher: &faviconFetcherState{},
441445 now: now,
442446 }
447+
448+ repo := mockFaviconRepository(t, fx.repo)
449+ blobs := mockFaviconBlobStore(t, fx.blobs)
450+ converter := mockFaviconConverter(t, fx.converter)
451+ scheduler := mockFaviconScheduler(t, fx.scheduler)
452+ invalidators := mockFaviconInvalidators(t, fx.invalidators)
453+ fetcher := mockFaviconFetcher(t, fx.fetcher)
454+
443455 fx.uc = NewFaviconUseCase(FaviconDeps{
444- Repository: fx.repo,
445- BlobStore: fx.blobs,
446- Converter: fx.converter,
447- Scheduler: fx.scheduler,
448- Invalidators: fx.invalidators,
449- Fetcher: fx.fetcher,
456+ Repository: repo,
457+ BlobStore: blobs,
458+ Converter: converter,
459+ Scheduler: scheduler,
460+ Invalidators: invalidators,
461+ Fetcher: fetcher,
450462 Now: func() time.Time { return fx.now },
451463 Background: context.WithValue(context.Background(), faviconFixtureBackgroundKey, true),
452464 })
453465 return fx
454466 }
467+
468+func mockFaviconRepository(t *testing.T, state *faviconRepoState) *portmocks.MockFaviconRepository {
469+ t.Helper()
470+
471+ repo := portmocks.NewMockFaviconRepository(t)
472+ repo.EXPECT().Get(mock.Anything, mock.Anything).RunAndReturn(state.get).Maybe()
473+ repo.EXPECT().FindFirst(mock.Anything, mock.Anything).RunAndReturn(state.findFirst).Maybe()
474+ repo.EXPECT().Upsert(mock.Anything, mock.Anything).RunAndReturn(state.upsert).Maybe()
475+ repo.EXPECT().UpdateLastChecked(mock.Anything, mock.Anything, mock.Anything, mock.Anything).RunAndReturn(state.updateLastChecked).Maybe()
476+ repo.EXPECT().Delete(mock.Anything, mock.Anything).RunAndReturn(state.delete).Maybe()
477+ return repo
478+}
479+
480+func mockFaviconBlobStore(t *testing.T, state *faviconBlobStoreState) *portmocks.MockFaviconBlobStore {
481+ t.Helper()
482+
483+ blobs := portmocks.NewMockFaviconBlobStore(t)
484+ blobs.EXPECT().ReadOriginal(mock.Anything, mock.Anything).RunAndReturn(state.readOriginal).Maybe()
485+ blobs.EXPECT().WriteOriginal(mock.Anything, mock.Anything, mock.Anything, mock.Anything).RunAndReturn(state.writeOriginal).Maybe()
486+ blobs.EXPECT().ReadPNG(mock.Anything, mock.Anything).RunAndReturn(state.readPNG).Maybe()
487+ blobs.EXPECT().WritePNG(mock.Anything, mock.Anything, mock.Anything).RunAndReturn(state.writePNG).Maybe()
488+ blobs.EXPECT().ReadSizedPNG(mock.Anything, mock.Anything, mock.Anything).RunAndReturn(state.readSizedPNG).Maybe()
489+ blobs.EXPECT().WriteSizedPNG(mock.Anything, mock.Anything, mock.Anything, mock.Anything).RunAndReturn(state.writeSizedPNG).Maybe()
490+ blobs.EXPECT().RemoveDerived(mock.Anything, mock.Anything).RunAndReturn(state.removeDerivedForKey).Maybe()
491+ return blobs
492+}
493+
494+func mockFaviconConverter(t *testing.T, state *faviconConverterState) *portmocks.MockFaviconImageConverter {
495+ t.Helper()
496+
497+ converter := portmocks.NewMockFaviconImageConverter(t)
498+ converter.EXPECT().Convert(mock.Anything, mock.Anything, mock.Anything, mock.Anything).RunAndReturn(state.convert).Maybe()
499+ return converter
500+}
501+
502+func mockFaviconScheduler(t *testing.T, state *faviconSchedulerState) *portmocks.MockFaviconRefreshScheduler {
503+ t.Helper()
504+
505+ scheduler := portmocks.NewMockFaviconRefreshScheduler(t)
506+ scheduler.EXPECT().Schedule(mock.Anything, mock.Anything, mock.Anything).RunAndReturn(state.schedule).Maybe()
507+ return scheduler
508+}
509+
510+func mockFaviconInvalidators(t *testing.T, state *faviconInvalidatorsState) *portmocks.MockFaviconInvalidators {
511+ t.Helper()
512+
513+ invalidators := portmocks.NewMockFaviconInvalidators(t)
514+ invalidators.EXPECT().InvalidateAll(mock.Anything, mock.Anything).RunAndReturn(state.invalidateAll).Maybe()
515+ return invalidators
516+}
517+
518+func mockFaviconFetcher(t *testing.T, state *faviconFetcherState) *portmocks.MockFaviconFetcher {
519+ t.Helper()
520+
521+ fetcher := portmocks.NewMockFaviconFetcher(t)
522+ fetcher.EXPECT().Fetch(mock.Anything, mock.Anything).RunAndReturn(state.fetch).Maybe()
523+ return fetcher
524+}
525+
455526 func (f *faviconFixture) seed(key string, sized []byte, stale bool) {
456527 checked := f.now
457528 if stale {
@@ -460,6 +531,7 @@ func (f *faviconFixture) seed(key string, sized []byte, stale bool) {
460531 f.repo.byKey[favicon.Key(key)] = &favicon.Metadata{Key: favicon.Key(key), PageURL: "https://" + key, ContentHash: favicon.Hash([]byte("orig")), LastCheckedAt: checked}
461532 f.blobs.sized[favicon.Key(key)] = map[int][]byte{32: sized}
462533 }
534+
463535 func (f *faviconFixture) seedOriginal(b []byte) {
464536 const contentType = "image/png"
465537 key := favicon.Key("example.com")
@@ -474,15 +546,16 @@ func (f *faviconFixture) seedOriginal(b []byte) {
474546 f.blobs.contentTypes[key] = contentType
475547 }
476548
477-type fakeFaviconRepo struct {
549+type faviconRepoState struct {
478550 byKey map[favicon.Key]*favicon.Metadata
479551 err error
480552 }
481553
482-func newFakeRepo() *fakeFaviconRepo {
483- return &fakeFaviconRepo{byKey: map[favicon.Key]*favicon.Metadata{}}
554+func newFaviconRepoState() *faviconRepoState {
555+ return &faviconRepoState{byKey: map[favicon.Key]*favicon.Metadata{}}
484556 }
485-func (r *fakeFaviconRepo) Get(_ context.Context, key favicon.Key) (*favicon.Metadata, error) {
557+
558+func (r *faviconRepoState) get(_ context.Context, key favicon.Key) (*favicon.Metadata, error) {
486559 if r.err != nil {
487560 return nil, r.err
488561 }
@@ -492,18 +565,20 @@ func (r *fakeFaviconRepo) Get(_ context.Context, key favicon.Key) (*favicon.Meta
492565 }
493566 return nil, nil
494567 }
495-func (r *fakeFaviconRepo) FindFirst(ctx context.Context, keys []favicon.Key) (*favicon.Metadata, error) {
568+
569+func (r *faviconRepoState) findFirst(ctx context.Context, keys []favicon.Key) (*favicon.Metadata, error) {
496570 if r.err != nil {
497571 return nil, r.err
498572 }
499573 for _, k := range keys {
500- if m, _ := r.Get(ctx, k); m != nil {
574+ if m, _ := r.get(ctx, k); m != nil {
501575 return m, nil
502576 }
503577 }
504578 return nil, nil
505579 }
506-func (r *fakeFaviconRepo) Upsert(_ context.Context, meta favicon.Metadata) error {
580+
581+func (r *faviconRepoState) upsert(_ context.Context, meta favicon.Metadata) error {
507582 if r.err != nil {
508583 return r.err
509584 }
@@ -511,7 +586,8 @@ func (r *fakeFaviconRepo) Upsert(_ context.Context, meta favicon.Metadata) error
511586 r.byKey[meta.Key] = &cp
512587 return nil
513588 }
514-func (r *fakeFaviconRepo) UpdateLastChecked(_ context.Context, key favicon.Key, hash string, checkedAt time.Time) error {
589+
590+func (r *faviconRepoState) updateLastChecked(_ context.Context, key favicon.Key, hash string, checkedAt time.Time) error {
515591 if r.err != nil {
516592 return r.err
517593 }
@@ -519,7 +595,8 @@ func (r *fakeFaviconRepo) UpdateLastChecked(_ context.Context, key favicon.Key,
519595 r.byKey[key].LastCheckedAt = checkedAt
520596 return nil
521597 }
522-func (r *fakeFaviconRepo) Delete(_ context.Context, key favicon.Key) error {
598+
599+func (r *faviconRepoState) delete(_ context.Context, key favicon.Key) error {
523600 if r.err != nil {
524601 return r.err
525602 }
@@ -527,7 +604,7 @@ func (r *fakeFaviconRepo) Delete(_ context.Context, key favicon.Key) error {
527604 return nil
528605 }
529606
530-type fakeBlobStore struct {
607+type faviconBlobStoreState struct {
531608 original, png map[favicon.Key][]byte
532609 sized map[favicon.Key]map[int][]byte
533610 contentTypes map[favicon.Key]string
@@ -536,10 +613,16 @@ type fakeBlobStore struct {
536613 readSizedErr error
537614 }
538615
539-func newFakeBlobStore() *fakeBlobStore {
540- return &fakeBlobStore{original: map[favicon.Key][]byte{}, png: map[favicon.Key][]byte{}, sized: map[favicon.Key]map[int][]byte{}, contentTypes: map[favicon.Key]string{}}
616+func newFaviconBlobStoreState() *faviconBlobStoreState {
617+ return &faviconBlobStoreState{
618+ original: map[favicon.Key][]byte{},
619+ png: map[favicon.Key][]byte{},
620+ sized: map[favicon.Key]map[int][]byte{},
621+ contentTypes: map[favicon.Key]string{},
622+ }
541623 }
542-func (b *fakeBlobStore) ReadOriginal(_ context.Context, key favicon.Key) ([]byte, string, error) {
624+
625+func (b *faviconBlobStoreState) readOriginal(_ context.Context, key favicon.Key) ([]byte, string, error) {
543626 if b.err != nil {
544627 return nil, "", b.err
545628 }
@@ -549,7 +632,8 @@ func (b *fakeBlobStore) ReadOriginal(_ context.Context, key favicon.Key) ([]byte
549632 }
550633 return v, b.contentTypes[key], nil
551634 }
552-func (b *fakeBlobStore) WriteOriginal(_ context.Context, key favicon.Key, data []byte, ct string) error {
635+
636+func (b *faviconBlobStoreState) writeOriginal(_ context.Context, key favicon.Key, data []byte, ct string) error {
553637 if b.err != nil {
554638 return b.err
555639 }
@@ -558,7 +642,8 @@ func (b *fakeBlobStore) WriteOriginal(_ context.Context, key favicon.Key, data [
558642 b.contentTypes[key] = ct
559643 return nil
560644 }
561-func (b *fakeBlobStore) ReadPNG(_ context.Context, key favicon.Key) ([]byte, string, error) {
645+
646+func (b *faviconBlobStoreState) readPNG(_ context.Context, key favicon.Key) ([]byte, string, error) {
562647 if b.err != nil {
563648 return nil, "", b.err
564649 }
@@ -568,14 +653,16 @@ func (b *fakeBlobStore) ReadPNG(_ context.Context, key favicon.Key) ([]byte, str
568653 }
569654 return v, "image/png", nil
570655 }
571-func (b *fakeBlobStore) WritePNG(_ context.Context, key favicon.Key, data []byte) error {
656+
657+func (b *faviconBlobStoreState) writePNG(_ context.Context, key favicon.Key, data []byte) error {
572658 if b.err != nil {
573659 return b.err
574660 }
575661 b.png[key] = data
576662 return nil
577663 }
578-func (b *fakeBlobStore) ReadSizedPNG(_ context.Context, key favicon.Key, size int) ([]byte, string, error) {
664+
665+func (b *faviconBlobStoreState) readSizedPNG(_ context.Context, key favicon.Key, size int) ([]byte, string, error) {
579666 if b.err != nil {
580667 return nil, "", b.err
581668 }
@@ -587,7 +674,8 @@ func (b *fakeBlobStore) ReadSizedPNG(_ context.Context, key favicon.Key, size in
587674 }
588675 return b.sized[key][size], "image/png", nil
589676 }
590-func (b *fakeBlobStore) WriteSizedPNG(_ context.Context, key favicon.Key, size int, data []byte) error {
677+
678+func (b *faviconBlobStoreState) writeSizedPNG(_ context.Context, key favicon.Key, size int, data []byte) error {
591679 if b.err != nil {
592680 return b.err
593681 }
@@ -597,7 +685,8 @@ func (b *fakeBlobStore) WriteSizedPNG(_ context.Context, key favicon.Key, size i
597685 b.sized[key][size] = data
598686 return nil
599687 }
600-func (b *fakeBlobStore) RemoveDerived(_ context.Context, key favicon.Key) error {
688+
689+func (b *faviconBlobStoreState) removeDerivedForKey(_ context.Context, key favicon.Key) error {
601690 if b.err != nil {
602691 return b.err
603692 }
@@ -607,13 +696,13 @@ func (b *fakeBlobStore) RemoveDerived(_ context.Context, key favicon.Key) error
607696 return nil
608697 }
609698
610-type fakeConverter struct {
699+type faviconConverterState struct {
611700 calls int
612701 err error
613702 errByContentType map[string]error
614703 }
615704
616-func (c *fakeConverter) Convert(_ context.Context, original []byte, contentType string, sizes []int) (*appport.ConvertedFavicon, error) {
705+func (c *faviconConverterState) convert(_ context.Context, original []byte, contentType string, sizes []int) (*appport.ConvertedFavicon, error) {
617706 c.calls++
618707 if c.err != nil {
619708 return nil, c.err
@@ -628,14 +717,14 @@ func (c *fakeConverter) Convert(_ context.Context, original []byte, contentType
628717 return out, nil
629718 }
630719
631-type fakeScheduler struct {
720+type faviconSchedulerState struct {
632721 seen map[favicon.Key]bool
633722 works map[favicon.Key]func(context.Context)
634723 schedules int
635724 usedCallerContext bool
636725 }
637726
638-func (s *fakeScheduler) Schedule(ctx context.Context, key favicon.Key, work func(context.Context)) bool {
727+func (s *faviconSchedulerState) schedule(ctx context.Context, key favicon.Key, work func(context.Context)) bool {
639728 if ctx.Value(faviconFixtureBackgroundKey) != true {
640729 s.usedCallerContext = true
641730 }
@@ -651,33 +740,33 @@ func (s *fakeScheduler) Schedule(ctx context.Context, key favicon.Key, work func
651740 return true
652741 }
653742
654-func (s *fakeScheduler) run(key favicon.Key) {
743+func (s *faviconSchedulerState) run(key favicon.Key) {
655744 if work := s.works[key]; work != nil {
656745 work(context.Background())
657746 }
658747 }
659748
660-type fakeInvalidators struct{ calls int }
749+type faviconInvalidatorsState struct{ calls int }
661750
662-func (i *fakeInvalidators) InvalidateAll(_ context.Context, _ favicon.Key) error {
751+func (i *faviconInvalidatorsState) invalidateAll(_ context.Context, _ favicon.Key) error {
663752 i.calls++
664753 return nil
665754 }
666755
667-type fakeFetchedIcon struct {
756+type faviconFetchResponse struct {
668757 bytes []byte
669758 contentType string
670759 pageURL string
671760 resolvedKey favicon.Key
672761 }
673762
674-type fakeFetcher struct {
763+type faviconFetcherState struct {
675764 calls int
676765 err error
677- responses map[string]fakeFetchedIcon
766+ responses map[string]faviconFetchResponse
678767 }
679768
680-func (f *fakeFetcher) Fetch(_ context.Context, req appport.FaviconFetchRequest) (*appport.FaviconFetchedIcon, error) {
769+func (f *faviconFetcherState) fetch(_ context.Context, req appport.FaviconFetchRequest) (*appport.FaviconFetchedIcon, error) {
681770 f.calls++
682771 if f.err != nil {
683772 return nil, f.err
@@ -688,11 +777,18 @@ func (f *fakeFetcher) Fetch(_ context.Context, req appport.FaviconFetchRequest)
688777 }
689778 response := f.responses[iconURL]
690779 if response.bytes == nil {
691- response = fakeFetchedIcon{bytes: []byte("fetched"), contentType: "image/png"}
780+ response = faviconFetchResponse{bytes: []byte("fetched"), contentType: "image/png"}
692781 }
693782 pageURL := req.PageURL
694783 if response.pageURL != "" {
695784 pageURL = response.pageURL
696785 }
697- return &appport.FaviconFetchedIcon{PageURL: pageURL, IconURL: iconURL, ResolvedKey: response.resolvedKey, Bytes: response.bytes, Source: favicon.SourceDuckDuckGo, ContentType: response.contentType}, nil
786+ return &appport.FaviconFetchedIcon{
787+ PageURL: pageURL,
788+ IconURL: iconURL,
789+ ResolvedKey: response.resolvedKey,
790+ Bytes: response.bytes,
791+ Source: favicon.SourceDuckDuckGo,
792+ ContentType: response.contentType,
793+ }, nil
698794 }
M internal/bootstrap/engine.go +1 -0
@@ -71,6 +71,7 @@ func BuildEngine(input EngineInput) (port.Engine, error) {
7171
7272 return webkit.NewEngine(
7373 input.Ctx, cfg, opts, profile, wkCfg,
74+ EngineSettingsPayloadFromConfig(cfg),
7475 currentConfigPayload, defaultConfigPayload,
7576 input.ThemeManager, input.ColorResolver,
7677 contextMenuBuilder, contextMenuExecutorFactory,
A internal/bootstrap/mocks/runtime_config.go +167 -0
@@ -0,0 +1,167 @@
1+// Code generated by mockery; DO NOT EDIT.
2+// github.com/vektra/mockery
3+// template: testify
4+
5+package mocks
6+
7+import (
8+ "github.com/bnema/dumber/internal/infrastructure/config"
9+ mock "github.com/stretchr/testify/mock"
10+)
11+
12+// NewMockConfigChangeManager creates a new instance of MockConfigChangeManager. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
13+// The first argument is typically a *testing.T value.
14+func NewMockConfigChangeManager(t interface {
15+ mock.TestingT
16+ Cleanup(func())
17+}) *MockConfigChangeManager {
18+ mock := &MockConfigChangeManager{}
19+ mock.Mock.Test(t)
20+
21+ t.Cleanup(func() { mock.AssertExpectations(t) })
22+
23+ return mock
24+}
25+
26+// MockConfigChangeManager is an autogenerated mock type for the configChangeManager type
27+type MockConfigChangeManager struct {
28+ mock.Mock
29+}
30+
31+type MockConfigChangeManager_Expecter struct {
32+ mock *mock.Mock
33+}
34+
35+func (_m *MockConfigChangeManager) EXPECT() *MockConfigChangeManager_Expecter {
36+ return &MockConfigChangeManager_Expecter{mock: &_m.Mock}
37+}
38+
39+// Get provides a mock function for the type MockConfigChangeManager
40+func (_mock *MockConfigChangeManager) Get() *config.Config {
41+ ret := _mock.Called()
42+
43+ if len(ret) == 0 {
44+ panic("no return value specified for Get")
45+ }
46+
47+ var r0 *config.Config
48+ if returnFunc, ok := ret.Get(0).(func() *config.Config); ok {
49+ r0 = returnFunc()
50+ } else {
51+ if ret.Get(0) != nil {
52+ r0 = ret.Get(0).(*config.Config)
53+ }
54+ }
55+ return r0
56+}
57+
58+// MockConfigChangeManager_Get_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Get'
59+type MockConfigChangeManager_Get_Call struct {
60+ *mock.Call
61+}
62+
63+// Get is a helper method to define mock.On call
64+func (_e *MockConfigChangeManager_Expecter) Get() *MockConfigChangeManager_Get_Call {
65+ return &MockConfigChangeManager_Get_Call{Call: _e.mock.On("Get")}
66+}
67+
68+func (_c *MockConfigChangeManager_Get_Call) Run(run func()) *MockConfigChangeManager_Get_Call {
69+ _c.Call.Run(func(args mock.Arguments) {
70+ run()
71+ })
72+ return _c
73+}
74+
75+func (_c *MockConfigChangeManager_Get_Call) Return(config1 *config.Config) *MockConfigChangeManager_Get_Call {
76+ _c.Call.Return(config1)
77+ return _c
78+}
79+
80+func (_c *MockConfigChangeManager_Get_Call) RunAndReturn(run func() *config.Config) *MockConfigChangeManager_Get_Call {
81+ _c.Call.Return(run)
82+ return _c
83+}
84+
85+// OnConfigChange provides a mock function for the type MockConfigChangeManager
86+func (_mock *MockConfigChangeManager) OnConfigChange(fn func(*config.Config)) {
87+ _mock.Called(fn)
88+ return
89+}
90+
91+// MockConfigChangeManager_OnConfigChange_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'OnConfigChange'
92+type MockConfigChangeManager_OnConfigChange_Call struct {
93+ *mock.Call
94+}
95+
96+// OnConfigChange is a helper method to define mock.On call
97+// - fn func(*config.Config)
98+func (_e *MockConfigChangeManager_Expecter) OnConfigChange(fn any) *MockConfigChangeManager_OnConfigChange_Call {
99+ return &MockConfigChangeManager_OnConfigChange_Call{Call: _e.mock.On("OnConfigChange", fn)}
100+}
101+
102+func (_c *MockConfigChangeManager_OnConfigChange_Call) Run(run func(fn func(*config.Config))) *MockConfigChangeManager_OnConfigChange_Call {
103+ _c.Call.Run(func(args mock.Arguments) {
104+ var arg0 func(*config.Config)
105+ if args[0] != nil {
106+ arg0 = args[0].(func(*config.Config))
107+ }
108+ run(
109+ arg0,
110+ )
111+ })
112+ return _c
113+}
114+
115+func (_c *MockConfigChangeManager_OnConfigChange_Call) Return() *MockConfigChangeManager_OnConfigChange_Call {
116+ _c.Call.Return()
117+ return _c
118+}
119+
120+func (_c *MockConfigChangeManager_OnConfigChange_Call) RunAndReturn(run func(fn func(*config.Config))) *MockConfigChangeManager_OnConfigChange_Call {
121+ _c.Run(run)
122+ return _c
123+}
124+
125+// Watch provides a mock function for the type MockConfigChangeManager
126+func (_mock *MockConfigChangeManager) Watch() error {
127+ ret := _mock.Called()
128+
129+ if len(ret) == 0 {
130+ panic("no return value specified for Watch")
131+ }
132+
133+ var r0 error
134+ if returnFunc, ok := ret.Get(0).(func() error); ok {
135+ r0 = returnFunc()
136+ } else {
137+ r0 = ret.Error(0)
138+ }
139+ return r0
140+}
141+
142+// MockConfigChangeManager_Watch_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Watch'
143+type MockConfigChangeManager_Watch_Call struct {
144+ *mock.Call
145+}
146+
147+// Watch is a helper method to define mock.On call
148+func (_e *MockConfigChangeManager_Expecter) Watch() *MockConfigChangeManager_Watch_Call {
149+ return &MockConfigChangeManager_Watch_Call{Call: _e.mock.On("Watch")}
150+}
151+
152+func (_c *MockConfigChangeManager_Watch_Call) Run(run func()) *MockConfigChangeManager_Watch_Call {
153+ _c.Call.Run(func(args mock.Arguments) {
154+ run()
155+ })
156+ return _c
157+}
158+
159+func (_c *MockConfigChangeManager_Watch_Call) Return(err error) *MockConfigChangeManager_Watch_Call {
160+ _c.Call.Return(err)
161+ return _c
162+}
163+
164+func (_c *MockConfigChangeManager_Watch_Call) RunAndReturn(run func() error) *MockConfigChangeManager_Watch_Call {
165+ _c.Call.Return(run)
166+ return _c
167+}
A internal/bootstrap/runtime_config.go +196 -0
@@ -0,0 +1,196 @@
1+package bootstrap
2+
3+import (
4+ "github.com/bnema/dumber/internal/application/port"
5+ "github.com/bnema/dumber/internal/domain/entity"
6+ "github.com/bnema/dumber/internal/infrastructure/config"
7+)
8+
9+type configChangeManager interface {
10+ Get() *config.Config
11+ Watch() error
12+ OnConfigChange(func(*config.Config))
13+}
14+
15+type runtimeConfigProvider struct {
16+ fallback entity.RuntimeConfigSnapshot
17+ manager configChangeManager
18+}
19+
20+func NewRuntimeConfigProvider(cfg *config.Config, manager configChangeManager) port.RuntimeConfigProvider {
21+ return &runtimeConfigProvider{
22+ fallback: RuntimeConfigSnapshotFromConfig(cfg),
23+ manager: manager,
24+ }
25+}
26+
27+func (p *runtimeConfigProvider) Current() entity.RuntimeConfigSnapshot {
28+ if p == nil {
29+ return entity.RuntimeConfigSnapshot{}
30+ }
31+ if p.manager == nil {
32+ return cloneRuntimeConfigSnapshot(p.fallback)
33+ }
34+ cfg := p.manager.Get()
35+ if cfg == nil {
36+ return cloneRuntimeConfigSnapshot(p.fallback)
37+ }
38+ return RuntimeConfigSnapshotFromConfig(cfg)
39+}
40+
41+func (p *runtimeConfigProvider) Watch() error {
42+ if p == nil || p.manager == nil {
43+ return nil
44+ }
45+ return p.manager.Watch()
46+}
47+
48+func (p *runtimeConfigProvider) OnChange(callback func(entity.RuntimeConfigSnapshot)) {
49+ if p == nil || p.manager == nil || callback == nil {
50+ return
51+ }
52+ p.manager.OnConfigChange(func(cfg *config.Config) {
53+ if cfg == nil {
54+ callback(cloneRuntimeConfigSnapshot(p.fallback))
55+ return
56+ }
57+ callback(RuntimeConfigSnapshotFromConfig(cfg))
58+ })
59+}
60+
61+func EngineSettingsPayloadFromConfig(cfg *config.Config) entity.EngineSettingsPayload {
62+ if cfg == nil {
63+ return entity.EngineSettingsPayload{}
64+ }
65+ return entity.EngineSettingsPayload{
66+ DefaultUIScale: cfg.DefaultUIScale,
67+ WebContent: entity.EngineWebContentSettingsPayload{
68+ SansFont: cfg.Appearance.SansFont,
69+ SerifFont: cfg.Appearance.SerifFont,
70+ MonospaceFont: cfg.Appearance.MonospaceFont,
71+ DefaultFontSize: cfg.Appearance.DefaultFontSize,
72+ EnableDevTools: cfg.Debug.EnableDevTools,
73+ CaptureConsole: cfg.Logging.CaptureConsole,
74+ DrawCompositingIndicators: cfg.Engine.WebKit.DrawCompositingIndicators,
75+ HardwareDecoding: engineHardwareDecodingModeFromConfig(cfg.Media.HardwareDecodingMode),
76+ AutoCopyOnSelection: cfg.Clipboard.AutoCopyOnSelection,
77+ },
78+ }
79+}
80+
81+func RuntimeConfigSnapshotFromConfig(cfg *config.Config) entity.RuntimeConfigSnapshot {
82+ if cfg == nil {
83+ return entity.RuntimeConfigSnapshot{}
84+ }
85+ return entity.RuntimeConfigSnapshot{
86+ EngineSettings: EngineSettingsPayloadFromConfig(cfg),
87+ UI: entity.RuntimeUIConfig{
88+ DefaultUIScale: cfg.DefaultUIScale,
89+ SidebarWidth: cfg.SidebarWidth,
90+ Appearance: cfg.Appearance,
91+ Workspace: cloneWorkspaceConfig(cfg.Workspace),
92+ Session: cloneSessionConfig(cfg.Session),
93+ Clipboard: entity.RuntimeClipboardConfig{AutoCopyOnSelection: cfg.Clipboard.AutoCopyOnSelection},
94+ SearchShortcuts: runtimeSearchShortcutsFromConfig(cfg.SearchShortcuts),
95+ DefaultSearchEngine: cfg.DefaultSearchEngine,
96+ Omnibox: entity.RuntimeOmniboxConfig{
97+ InitialBehavior: cfg.Omnibox.InitialBehavior,
98+ MostVisitedDays: cfg.Omnibox.MostVisitedDays,
99+ AutoOpenOnNewPane: cfg.Omnibox.AutoOpenOnNewPane,
100+ },
101+ Update: entity.RuntimeUpdateConfig{
102+ EnableOnStartup: cfg.Update.EnableOnStartup,
103+ AutoDownload: cfg.Update.AutoDownload,
104+ NotifyOnNewSettings: cfg.Update.NotifyOnNewSettings,
105+ },
106+ Downloads: entity.RuntimeDownloadsConfig{Path: cfg.Downloads.Path},
107+ },
108+ }
109+}
110+
111+func runtimeSearchShortcutsFromConfig(in map[string]config.SearchShortcut) map[string]entity.RuntimeSearchShortcut {
112+ out := make(map[string]entity.RuntimeSearchShortcut, len(in))
113+ for key, shortcut := range in {
114+ out[key] = entity.RuntimeSearchShortcut{
115+ URL: shortcut.URL,
116+ Description: shortcut.Description,
117+ }
118+ }
119+ return out
120+}
121+
122+func cloneRuntimeConfigSnapshot(snapshot entity.RuntimeConfigSnapshot) entity.RuntimeConfigSnapshot {
123+ snapshot.UI.SearchShortcuts = cloneRuntimeSearchShortcuts(snapshot.UI.SearchShortcuts)
124+ snapshot.UI.Workspace = cloneWorkspaceConfig(snapshot.UI.Workspace)
125+ snapshot.UI.Session = cloneSessionConfig(snapshot.UI.Session)
126+ return snapshot
127+}
128+
129+func cloneRuntimeSearchShortcuts(in map[string]entity.RuntimeSearchShortcut) map[string]entity.RuntimeSearchShortcut {
130+ if in == nil {
131+ return nil
132+ }
133+ out := make(map[string]entity.RuntimeSearchShortcut, len(in))
134+ for key, shortcut := range in {
135+ out[key] = shortcut
136+ }
137+ return out
138+}
139+
140+func cloneWorkspaceConfig(in entity.WorkspaceConfig) entity.WorkspaceConfig {
141+ in.PaneMode.Actions = cloneActionBindings(in.PaneMode.Actions)
142+ in.TabMode.Actions = cloneActionBindings(in.TabMode.Actions)
143+ in.ResizeMode.Actions = cloneActionBindings(in.ResizeMode.Actions)
144+ in.Shortcuts.Actions = cloneActionBindings(in.Shortcuts.Actions)
145+ in.FloatingPane.Profiles = cloneFloatingPaneProfiles(in.FloatingPane.Profiles)
146+ return in
147+}
148+
149+func cloneSessionConfig(in entity.SessionConfig) entity.SessionConfig {
150+ in.SessionMode.Actions = cloneActionBindings(in.SessionMode.Actions)
151+ return in
152+}
153+
154+func cloneActionBindings(in map[string]entity.ActionBinding) map[string]entity.ActionBinding {
155+ if in == nil {
156+ return nil
157+ }
158+ out := make(map[string]entity.ActionBinding, len(in))
159+ for action, binding := range in {
160+ binding.Keys = cloneStringSlice(binding.Keys)
161+ out[action] = binding
162+ }
163+ return out
164+}
165+
166+func cloneFloatingPaneProfiles(in map[string]entity.FloatingPaneProfile) map[string]entity.FloatingPaneProfile {
167+ if in == nil {
168+ return nil
169+ }
170+ out := make(map[string]entity.FloatingPaneProfile, len(in))
171+ for name, profile := range in {
172+ profile.Keys = cloneStringSlice(profile.Keys)
173+ out[name] = profile
174+ }
175+ return out
176+}
177+
178+func cloneStringSlice(in []string) []string {
179+ if in == nil {
180+ return nil
181+ }
182+ out := make([]string, len(in))
183+ copy(out, in)
184+ return out
185+}
186+
187+func engineHardwareDecodingModeFromConfig(mode config.HardwareDecodingMode) entity.EngineHardwareDecodingMode {
188+ switch mode {
189+ case config.HardwareDecodingForce:
190+ return entity.EngineHardwareDecodingForce
191+ case config.HardwareDecodingDisable:
192+ return entity.EngineHardwareDecodingDisable
193+ default:
194+ return entity.EngineHardwareDecodingAuto
195+ }
196+}
A internal/bootstrap/runtime_config_test.go +479 -0
@@ -0,0 +1,479 @@
1+package bootstrap
2+
3+import (
4+ "reflect"
5+ "testing"
6+
7+ bootstrapmocks "github.com/bnema/dumber/internal/bootstrap/mocks"
8+ "github.com/bnema/dumber/internal/domain/entity"
9+ "github.com/bnema/dumber/internal/infrastructure/config"
10+ "github.com/stretchr/testify/mock"
11+)
12+
13+type configManagerState struct {
14+ current *config.Config
15+ watchCalls int
16+ callbacks []func(*config.Config)
17+}
18+
19+func newMockConfigManager(t *testing.T, state *configManagerState) *bootstrapmocks.MockConfigChangeManager {
20+ t.Helper()
21+
22+ manager := bootstrapmocks.NewMockConfigChangeManager(t)
23+ manager.EXPECT().Get().RunAndReturn(state.get).Maybe()
24+ manager.EXPECT().Watch().RunAndReturn(state.watch).Maybe()
25+ manager.EXPECT().OnConfigChange(mock.Anything).RunAndReturn(state.onConfigChange).Maybe()
26+ return manager
27+}
28+
29+func (s *configManagerState) watch() error {
30+ s.watchCalls++
31+ return nil
32+}
33+
34+func (s *configManagerState) onConfigChange(callback func(*config.Config)) {
35+ s.callbacks = append(s.callbacks, callback)
36+}
37+
38+func (s *configManagerState) get() *config.Config {
39+ return s.current
40+}
41+
42+func (s *configManagerState) emit(next *config.Config) {
43+ s.current = next
44+ for _, callback := range s.callbacks {
45+ callback(next)
46+ }
47+}
48+
49+func TestEngineSettingsPayloadFromConfigMapsRuntimeFields(t *testing.T) {
50+ cfg := config.DefaultConfig()
51+ cfg.DefaultUIScale = 1.25
52+ cfg.Appearance.SansFont = "Inter"
53+ cfg.Appearance.SerifFont = "Literata"
54+ cfg.Appearance.MonospaceFont = "Fira Code"
55+ cfg.Appearance.DefaultFontSize = 17
56+ cfg.Debug.EnableDevTools = true
57+ cfg.Logging.CaptureConsole = true
58+ cfg.Engine.WebKit.DrawCompositingIndicators = true
59+ cfg.Media.HardwareDecodingMode = config.HardwareDecodingForce
60+ cfg.Clipboard.AutoCopyOnSelection = true
61+
62+ got := EngineSettingsPayloadFromConfig(cfg)
63+
64+ if got.DefaultUIScale != 1.25 {
65+ t.Fatalf("DefaultUIScale=%v, want 1.25", got.DefaultUIScale)
66+ }
67+ if got.WebContent.SansFont != "Inter" ||
68+ got.WebContent.SerifFont != "Literata" ||
69+ got.WebContent.MonospaceFont != "Fira Code" ||
70+ got.WebContent.DefaultFontSize != 17 {
71+ t.Fatalf("font settings not mapped: %#v", got.WebContent)
72+ }
73+ if !got.WebContent.EnableDevTools ||
74+ !got.WebContent.CaptureConsole ||
75+ !got.WebContent.DrawCompositingIndicators {
76+ t.Fatalf("debug settings not mapped: %#v", got.WebContent)
77+ }
78+ if got.WebContent.HardwareDecoding != entity.EngineHardwareDecodingForce {
79+ t.Fatalf("HardwareDecoding=%q, want %q", got.WebContent.HardwareDecoding, entity.EngineHardwareDecodingForce)
80+ }
81+ autoCopyField := reflect.ValueOf(got.WebContent).FieldByName("AutoCopyOnSelection")
82+ if !autoCopyField.IsValid() || !autoCopyField.Bool() {
83+ t.Fatalf("AutoCopyOnSelection not mapped in web content payload: %#v", got.WebContent)
84+ }
85+}
86+
87+func TestRuntimeConfigProviderUpdatesSnapshotBeforeCallback(t *testing.T) {
88+ initial := config.DefaultConfig()
89+ initial.DefaultUIScale = 1
90+ manager := &configManagerState{}
91+ provider := NewRuntimeConfigProvider(initial, newMockConfigManager(t, manager))
92+
93+ var seen entity.RuntimeConfigSnapshot
94+ provider.OnChange(func(snapshot entity.RuntimeConfigSnapshot) {
95+ seen = snapshot
96+ })
97+
98+ next := config.DefaultConfig()
99+ next.DefaultUIScale = 1.8
100+ manager.emit(next)
101+
102+ if got := provider.Current().UI.DefaultUIScale; got != 1.8 {
103+ t.Fatalf("Current DefaultUIScale=%v, want 1.8", got)
104+ }
105+ if seen.UI.DefaultUIScale != 1.8 {
106+ t.Fatalf("callback DefaultUIScale=%v, want 1.8", seen.UI.DefaultUIScale)
107+ }
108+}
109+
110+func TestRuntimeConfigProviderCurrentReflectsManagerGetWithoutSubscription(t *testing.T) {
111+ initial := config.DefaultConfig()
112+ initial.DefaultUIScale = 1
113+ manager := &configManagerState{current: initial}
114+ provider := NewRuntimeConfigProvider(initial, newMockConfigManager(t, manager))
115+
116+ next := config.DefaultConfig()
117+ next.DefaultUIScale = 1.8
118+ manager.current = next
119+
120+ if got := provider.Current().UI.DefaultUIScale; got != 1.8 {
121+ t.Fatalf("Current DefaultUIScale=%v, want 1.8", got)
122+ }
123+}
124+
125+func TestRuntimeConfigProviderCurrentFallsBackWhenManagerGetReturnsNil(t *testing.T) {
126+ initial := config.DefaultConfig()
127+ initial.DefaultUIScale = 1.35
128+ manager := &configManagerState{}
129+ provider := NewRuntimeConfigProvider(initial, newMockConfigManager(t, manager))
130+
131+ got := provider.Current()
132+ want := RuntimeConfigSnapshotFromConfig(initial)
133+
134+ if !reflect.DeepEqual(got, want) {
135+ t.Fatalf("Current()=%#v, want initial fallback %#v", got, want)
136+ }
137+}
138+
139+func TestRuntimeConfigProviderOnChangeCallbackCanCallCurrent(t *testing.T) {
140+ initial := config.DefaultConfig()
141+ initial.DefaultUIScale = 1
142+ manager := &configManagerState{current: initial}
143+ provider := NewRuntimeConfigProvider(initial, newMockConfigManager(t, manager))
144+
145+ completed := false
146+ var seen entity.RuntimeConfigSnapshot
147+ provider.OnChange(func(entity.RuntimeConfigSnapshot) {
148+ seen = provider.Current()
149+ completed = true
150+ })
151+
152+ next := config.DefaultConfig()
153+ next.DefaultUIScale = 1.8
154+ manager.emit(next)
155+
156+ if !completed {
157+ t.Fatal("callback did not complete")
158+ }
159+ if seen.UI.DefaultUIScale != 1.8 {
160+ t.Fatalf("callback Current DefaultUIScale=%v, want 1.8", seen.UI.DefaultUIScale)
161+ }
162+}
163+
164+func TestRuntimeConfigProviderOnChangeFallsBackWhenPayloadIsNil(t *testing.T) {
165+ initial := config.DefaultConfig()
166+ initial.DefaultUIScale = 1.35
167+ manager := &configManagerState{current: initial}
168+ provider := NewRuntimeConfigProvider(initial, newMockConfigManager(t, manager))
169+
170+ var seen entity.RuntimeConfigSnapshot
171+ provider.OnChange(func(snapshot entity.RuntimeConfigSnapshot) {
172+ seen = snapshot
173+ })
174+
175+ manager.emit(nil)
176+ want := RuntimeConfigSnapshotFromConfig(initial)
177+
178+ if !reflect.DeepEqual(seen, want) {
179+ t.Fatalf("callback snapshot=%#v, want initial fallback %#v", seen, want)
180+ }
181+}
182+
183+func TestRuntimeConfigProviderOnChangeNilCallbackDoesNotRegister(t *testing.T) {
184+ manager := &configManagerState{current: config.DefaultConfig()}
185+ provider := NewRuntimeConfigProvider(config.DefaultConfig(), newMockConfigManager(t, manager))
186+
187+ provider.OnChange(nil)
188+
189+ if len(manager.callbacks) != 0 {
190+ t.Fatalf("callbacks=%d, want 0", len(manager.callbacks))
191+ }
192+}
193+
194+func TestRuntimeConfigProviderWatchDelegatesToManager(t *testing.T) {
195+ manager := &configManagerState{}
196+ provider := NewRuntimeConfigProvider(config.DefaultConfig(), newMockConfigManager(t, manager))
197+
198+ if err := provider.Watch(); err != nil {
199+ t.Fatalf("Watch returned error: %v", err)
200+ }
201+ if manager.watchCalls != 1 {
202+ t.Fatalf("watchCalls=%d, want 1", manager.watchCalls)
203+ }
204+}
205+
206+func TestRuntimeConfigProviderCurrentReturnsMapClone(t *testing.T) {
207+ cfg := config.DefaultConfig()
208+ cfg.SearchShortcuts = map[string]config.SearchShortcut{
209+ "gh": {URL: "https://github.com/search?q=%s", Description: "GitHub"},
210+ }
211+ provider := NewRuntimeConfigProvider(cfg, newMockConfigManager(t, &configManagerState{current: cfg}))
212+
213+ first := provider.Current()
214+ first.UI.SearchShortcuts["gh"] = entity.RuntimeSearchShortcut{URL: "mutated"}
215+ second := provider.Current()
216+
217+ if second.UI.SearchShortcuts["gh"].URL == "mutated" {
218+ t.Fatal("Current must return a snapshot clone so callers cannot mutate provider state")
219+ }
220+}
221+
222+func TestRuntimeConfigProviderCurrentReturnsNestedConfigClone(t *testing.T) {
223+ cfg := runtimeConfigWithNestedMutableFields()
224+ provider := NewRuntimeConfigProvider(cfg, newMockConfigManager(t, &configManagerState{current: cfg}))
225+
226+ first := provider.Current()
227+ mutateNestedRuntimeConfigSnapshot(first)
228+ second := provider.Current()
229+
230+ assertNestedRuntimeConfigSnapshotUnchanged(t, second)
231+}
232+
233+func TestRuntimeConfigProviderOnChangePassesNestedConfigClone(t *testing.T) {
234+ manager := &configManagerState{}
235+ provider := NewRuntimeConfigProvider(config.DefaultConfig(), newMockConfigManager(t, manager))
236+
237+ provider.OnChange(func(snapshot entity.RuntimeConfigSnapshot) {
238+ mutateNestedRuntimeConfigSnapshot(snapshot)
239+ })
240+
241+ manager.emit(runtimeConfigWithNestedMutableFields())
242+
243+ assertNestedRuntimeConfigSnapshotUnchanged(t, provider.Current())
244+}
245+
246+func TestEngineSettingsPayloadFromNilConfigReturnsZeroPayload(t *testing.T) {
247+ got := EngineSettingsPayloadFromConfig(nil)
248+ if got != (entity.EngineSettingsPayload{}) {
249+ t.Fatalf("payload=%#v, want zero value", got)
250+ }
251+}
252+
253+func runtimeConfigWithNestedMutableFields() *config.Config {
254+ cfg := config.DefaultConfig()
255+ cfg.Workspace.PaneMode.Actions = map[string]entity.ActionBinding{
256+ "split-right": {Keys: []string{"r"}, Desc: "Split right"},
257+ }
258+ cfg.Workspace.TabMode.Actions = map[string]entity.ActionBinding{
259+ "next-tab": {Keys: []string{"l"}, Desc: "Next tab"},
260+ }
261+ cfg.Workspace.ResizeMode.Actions = map[string]entity.ActionBinding{
262+ "grow-right": {Keys: []string{"right"}, Desc: "Grow right"},
263+ }
264+ cfg.Workspace.Shortcuts.Actions = map[string]entity.ActionBinding{
265+ "toggle-history-systemview": {Keys: []string{"ctrl+h"}, Desc: "History"},
266+ }
267+ cfg.Workspace.FloatingPane.Profiles = map[string]entity.FloatingPaneProfile{
268+ "docs": {Keys: []string{"alt+d"}, URL: "https://docs.example", Desc: "Docs"},
269+ }
270+ cfg.Session.SessionMode.Actions = map[string]entity.ActionBinding{
271+ "session-manager": {Keys: []string{"s"}, Desc: "Session manager"},
272+ }
273+ return cfg
274+}
275+
276+func mutateNestedRuntimeConfigSnapshot(snapshot entity.RuntimeConfigSnapshot) {
277+ mutateActionBinding(snapshot.UI.Workspace.PaneMode.Actions, "split-right", "mutated-pane")
278+ snapshot.UI.Workspace.PaneMode.Actions["added-pane"] = entity.ActionBinding{Keys: []string{"added"}}
279+
280+ mutateActionBinding(snapshot.UI.Workspace.TabMode.Actions, "next-tab", "mutated-tab")
281+ snapshot.UI.Workspace.TabMode.Actions["added-tab"] = entity.ActionBinding{Keys: []string{"added"}}
282+
283+ mutateActionBinding(snapshot.UI.Workspace.ResizeMode.Actions, "grow-right", "mutated-resize")
284+ snapshot.UI.Workspace.ResizeMode.Actions["added-resize"] = entity.ActionBinding{Keys: []string{"added"}}
285+
286+ mutateActionBinding(snapshot.UI.Workspace.Shortcuts.Actions, "toggle-history-systemview", "mutated-shortcut")
287+ snapshot.UI.Workspace.Shortcuts.Actions["added-shortcut"] = entity.ActionBinding{Keys: []string{"added"}}
288+
289+ profile := snapshot.UI.Workspace.FloatingPane.Profiles["docs"]
290+ profile.Keys[0] = "mutated-floating"
291+ snapshot.UI.Workspace.FloatingPane.Profiles["docs"] = profile
292+ snapshot.UI.Workspace.FloatingPane.Profiles["added-floating"] = entity.FloatingPaneProfile{Keys: []string{"added"}}
293+
294+ mutateActionBinding(snapshot.UI.Session.SessionMode.Actions, "session-manager", "mutated-session")
295+ snapshot.UI.Session.SessionMode.Actions["added-session"] = entity.ActionBinding{Keys: []string{"added"}}
296+}
297+
298+func mutateActionBinding(actions map[string]entity.ActionBinding, action, key string) {
299+ binding := actions[action]
300+ binding.Keys[0] = key
301+ actions[action] = binding
302+}
303+
304+func assertNestedRuntimeConfigSnapshotUnchanged(t *testing.T, snapshot entity.RuntimeConfigSnapshot) {
305+ t.Helper()
306+
307+ assertActionBinding(t, snapshot.UI.Workspace.PaneMode.Actions, "split-right", "r")
308+ assertMapEntryAbsent(t, snapshot.UI.Workspace.PaneMode.Actions, "added-pane")
309+
310+ assertActionBinding(t, snapshot.UI.Workspace.TabMode.Actions, "next-tab", "l")
311+ assertMapEntryAbsent(t, snapshot.UI.Workspace.TabMode.Actions, "added-tab")
312+
313+ assertActionBinding(t, snapshot.UI.Workspace.ResizeMode.Actions, "grow-right", "right")
314+ assertMapEntryAbsent(t, snapshot.UI.Workspace.ResizeMode.Actions, "added-resize")
315+
316+ assertActionBinding(t, snapshot.UI.Workspace.Shortcuts.Actions, "toggle-history-systemview", "ctrl+h")
317+ assertMapEntryAbsent(t, snapshot.UI.Workspace.Shortcuts.Actions, "added-shortcut")
318+
319+ profile := snapshot.UI.Workspace.FloatingPane.Profiles["docs"]
320+ if got := profile.Keys[0]; got != "alt+d" {
321+ t.Fatalf("floating profile key=%q, want %q", got, "alt+d")
322+ }
323+ if _, ok := snapshot.UI.Workspace.FloatingPane.Profiles["added-floating"]; ok {
324+ t.Fatal("floating pane profiles must not include entries added through a returned snapshot")
325+ }
326+
327+ assertActionBinding(t, snapshot.UI.Session.SessionMode.Actions, "session-manager", "s")
328+ assertMapEntryAbsent(t, snapshot.UI.Session.SessionMode.Actions, "added-session")
329+}
330+
331+func assertActionBinding(t *testing.T, actions map[string]entity.ActionBinding, action, wantKey string) {
332+ t.Helper()
333+
334+ binding, ok := actions[action]
335+ if !ok {
336+ t.Fatalf("action %q missing", action)
337+ }
338+ if got := binding.Keys[0]; got != wantKey {
339+ t.Fatalf("%s key=%q, want %q", action, got, wantKey)
340+ }
341+}
342+
343+func assertMapEntryAbsent(t *testing.T, actions map[string]entity.ActionBinding, action string) {
344+ t.Helper()
345+
346+ if _, ok := actions[action]; ok {
347+ t.Fatalf("actions must not include entry %q added through a returned snapshot", action)
348+ }
349+}
350+
351+func assertNestedSourceConfigUnchanged(t *testing.T, cfg *config.Config) {
352+ t.Helper()
353+
354+ assertActionBinding(t, cfg.Workspace.PaneMode.Actions, "split-right", "r")
355+ assertMapEntryAbsent(t, cfg.Workspace.PaneMode.Actions, "added-pane")
356+
357+ assertActionBinding(t, cfg.Workspace.TabMode.Actions, "next-tab", "l")
358+ assertMapEntryAbsent(t, cfg.Workspace.TabMode.Actions, "added-tab")
359+
360+ assertActionBinding(t, cfg.Workspace.ResizeMode.Actions, "grow-right", "right")
361+ assertMapEntryAbsent(t, cfg.Workspace.ResizeMode.Actions, "added-resize")
362+
363+ assertActionBinding(t, cfg.Workspace.Shortcuts.Actions, "toggle-history-systemview", "ctrl+h")
364+ assertMapEntryAbsent(t, cfg.Workspace.Shortcuts.Actions, "added-shortcut")
365+
366+ profile := cfg.Workspace.FloatingPane.Profiles["docs"]
367+ if got := profile.Keys[0]; got != "alt+d" {
368+ t.Fatalf("floating profile key=%q, want %q", got, "alt+d")
369+ }
370+ if _, ok := cfg.Workspace.FloatingPane.Profiles["added-floating"]; ok {
371+ t.Fatal("floating pane profiles must not include entries added through a returned snapshot")
372+ }
373+
374+ assertActionBinding(t, cfg.Session.SessionMode.Actions, "session-manager", "s")
375+ assertMapEntryAbsent(t, cfg.Session.SessionMode.Actions, "added-session")
376+}
377+
378+func TestRuntimeConfigSnapshotFromConfigMapsUIRuntimeFields(t *testing.T) {
379+ cfg := config.DefaultConfig()
380+ cfg.DefaultUIScale = 1.4
381+ cfg.SidebarWidth = 333
382+ cfg.Downloads.Path = "/tmp/downloads"
383+ cfg.DefaultSearchEngine = "https://search.example/?q=%s"
384+ cfg.SearchShortcuts = map[string]config.SearchShortcut{
385+ "gh": {URL: "https://github.com/search?q=%s", Description: "GitHub"},
386+ }
387+ cfg.Workspace.NewPaneURL = "about:blank"
388+ cfg.Session.SnapshotIntervalMs = 7000
389+ cfg.Clipboard.AutoCopyOnSelection = true
390+ cfg.Omnibox.AutoOpenOnNewPane = true
391+ cfg.Update.NotifyOnNewSettings = true
392+
393+ got := RuntimeConfigSnapshotFromConfig(cfg)
394+
395+ if got.EngineSettings != EngineSettingsPayloadFromConfig(cfg) {
396+ t.Fatalf("EngineSettings=%#v, want %#v", got.EngineSettings, EngineSettingsPayloadFromConfig(cfg))
397+ }
398+ if got.UI.DefaultUIScale != 1.4 ||
399+ got.UI.SidebarWidth != 333 ||
400+ got.UI.Downloads.Path != "/tmp/downloads" ||
401+ got.UI.DefaultSearchEngine != "https://search.example/?q=%s" ||
402+ got.UI.Workspace.NewPaneURL != "about:blank" ||
403+ got.UI.Session.SnapshotIntervalMs != 7000 ||
404+ !got.UI.Clipboard.AutoCopyOnSelection ||
405+ !got.UI.Omnibox.AutoOpenOnNewPane ||
406+ !got.UI.Update.NotifyOnNewSettings {
407+ t.Fatalf("snapshot not mapped: %#v", got.UI)
408+ }
409+ if got.UI.SearchShortcuts["gh"].URL != "https://github.com/search?q=%s" {
410+ t.Fatalf("search shortcut not mapped: %#v", got.UI.SearchShortcuts)
411+ }
412+ got.UI.SearchShortcuts["gh"] = entity.RuntimeSearchShortcut{URL: "mutated"}
413+ if cfg.SearchShortcuts["gh"].URL == "mutated" {
414+ t.Fatal("snapshot must deep-copy search shortcut map")
415+ }
416+}
417+
418+func TestRuntimeConfigSnapshotFromConfigDetachesNestedMutableFields(t *testing.T) {
419+ cfg := runtimeConfigWithNestedMutableFields()
420+ snapshot := RuntimeConfigSnapshotFromConfig(cfg)
421+
422+ mutateNestedRuntimeConfigSnapshot(snapshot)
423+
424+ assertNestedSourceConfigUnchanged(t, cfg)
425+}
426+
427+func TestRuntimeConfigSnapshotFromNilConfigReturnsZeroSnapshot(t *testing.T) {
428+ got := RuntimeConfigSnapshotFromConfig(nil)
429+ if !reflect.DeepEqual(got, entity.RuntimeConfigSnapshot{}) {
430+ t.Fatalf("snapshot=%#v, want zero value", got)
431+ }
432+}
433+
434+func TestEngineSettingsPayloadFromConfigMapsHardwareDecodingModes(t *testing.T) {
435+ tests := []struct {
436+ name string
437+ mode config.HardwareDecodingMode
438+ want entity.EngineHardwareDecodingMode
439+ }{
440+ {
441+ name: "auto",
442+ mode: config.HardwareDecodingAuto,
443+ want: entity.EngineHardwareDecodingAuto,
444+ },
445+ {
446+ name: "force",
447+ mode: config.HardwareDecodingForce,
448+ want: entity.EngineHardwareDecodingForce,
449+ },
450+ {
451+ name: "disable",
452+ mode: config.HardwareDecodingDisable,
453+ want: entity.EngineHardwareDecodingDisable,
454+ },
455+ {
456+ name: "unknown",
457+ mode: config.HardwareDecodingMode("surprise"),
458+ want: entity.EngineHardwareDecodingAuto,
459+ },
460+ {
461+ name: "zero value",
462+ mode: "",
463+ want: entity.EngineHardwareDecodingAuto,
464+ },
465+ }
466+
467+ for _, tt := range tests {
468+ t.Run(tt.name, func(t *testing.T) {
469+ cfg := config.DefaultConfig()
470+ cfg.Media.HardwareDecodingMode = tt.mode
471+
472+ got := EngineSettingsPayloadFromConfig(cfg)
473+
474+ if got.WebContent.HardwareDecoding != tt.want {
475+ t.Fatalf("HardwareDecoding=%q, want %q", got.WebContent.HardwareDecoding, tt.want)
476+ }
477+ })
478+ }
479+}
M internal/bootstrap/session_test.go +6 -10
@@ -5,6 +5,7 @@ import (
55 "testing"
66 "time"
77
8+ portmocks "github.com/bnema/dumber/internal/application/port/mocks"
89 "github.com/bnema/dumber/internal/application/usecase"
910 "github.com/bnema/dumber/internal/domain/entity"
1011 repomocks "github.com/bnema/dumber/internal/domain/repository/mocks"
@@ -13,20 +14,13 @@ import (
1314 "github.com/stretchr/testify/require"
1415 )
1516
16-type fakeProcessProbe struct {
17- alive map[int]bool
18-}
19-
20-func (p fakeProcessProbe) IsProcessAlive(_ context.Context, pid int) (bool, error) {
21- return p.alive[pid], nil
22-}
23-
2417 func TestRunSessionCleanup_DoesNotEndOtherActiveBrowserSessionsWithoutLivenessProof(t *testing.T) {
2518 t.Parallel()
2619
2720 ctx := context.Background()
2821 repo := repomocks.NewMockSessionRepository(t)
29- cleanupUC := usecase.NewCleanupSessionsUseCase(repo, fakeProcessProbe{alive: map[int]bool{1234: true}})
22+ probe := portmocks.NewMockSessionProcessProbe(t)
23+ cleanupUC := usecase.NewCleanupSessionsUseCase(repo, probe)
3024 cfg := config.DefaultConfig()
3125 logDir := t.TempDir()
3226
@@ -45,6 +39,7 @@ func TestRunSessionCleanup_DoesNotEndOtherActiveBrowserSessionsWithoutLivenessPr
4539 }
4640
4741 repo.EXPECT().GetRecent(mock.Anything, recentSessionsLimit).Return([]*entity.Session{current, live}, nil).Once()
42+ probe.EXPECT().IsProcessAlive(mock.Anything, livePID).Return(true, nil).Once()
4843 repo.EXPECT().DeleteExitedBefore(mock.Anything, mock.MatchedBy(func(time.Time) bool { return true })).Return(int64(0), nil).Once()
4944 repo.EXPECT().DeleteOldestExited(mock.Anything, cfg.Session.MaxExitedSessions).Return(int64(0), nil).Once()
5045
@@ -56,7 +51,8 @@ func TestRunSessionCleanup_NoPanicOnNilSessions(t *testing.T) {
5651
5752 ctx := context.Background()
5853 repo := repomocks.NewMockSessionRepository(t)
59- cleanupUC := usecase.NewCleanupSessionsUseCase(repo, fakeProcessProbe{})
54+ probe := portmocks.NewMockSessionProcessProbe(t)
55+ cleanupUC := usecase.NewCleanupSessionsUseCase(repo, probe)
6056 cfg := config.DefaultConfig()
6157 logDir := t.TempDir()
6258
M internal/cli/cmd/logs_test.go +17 -15
@@ -8,23 +8,13 @@ import (
88 "testing"
99 "time"
1010
11+ cmdmocks "github.com/bnema/dumber/internal/cli/cmd/mocks"
1112 "github.com/bnema/dumber/internal/domain/entity"
1213 "github.com/bnema/dumber/internal/logging"
14+ "github.com/stretchr/testify/mock"
1315 "github.com/stretchr/testify/require"
1416 )
1517
16-type fakeSessionMgr struct {
17- sessions []*entity.Session
18- err error
19-}
20-
21-func (f *fakeSessionMgr) GetRecentSessions(_ context.Context, _ int) ([]*entity.Session, error) {
22- if f.err != nil {
23- return nil, f.err
24- }
25- return f.sessions, nil
26-}
27-
2818 func TestGetSessionsMerged_DBAndFS(t *testing.T) {
2919 logDir := t.TempDir()
3020
@@ -34,7 +24,11 @@ func TestGetSessionsMerged_DBAndFS(t *testing.T) {
3424 require.NoError(t, os.WriteFile(filepath.Join(logDir, logging.SessionFilename(string(s1.ID))), []byte("hi\n"), 0o600))
3525 require.NoError(t, os.WriteFile(filepath.Join(logDir, logging.SessionFilename("legacy_only")), []byte("legacy\n"), 0o600))
3626
37- mgr := &fakeSessionMgr{sessions: []*entity.Session{s1, s2}}
27+ mgr := cmdmocks.NewMockSessionManager(t)
28+ mgr.EXPECT().
29+ GetRecentSessions(mock.Anything, recentSessionsLimit).
30+ Return([]*entity.Session{s1, s2}, nil).
31+ Once()
3832
3933 merged, err := getSessionsMerged(context.Background(), mgr, logDir)
4034 require.NoError(t, err)
@@ -54,7 +48,11 @@ func TestGetSessionsMerged_MissingTableFallsBack(t *testing.T) {
5448 logDir := t.TempDir()
5549 require.NoError(t, os.WriteFile(filepath.Join(logDir, logging.SessionFilename("legacy_only")), []byte("legacy\n"), 0o600))
5650
57- mgr := &fakeSessionMgr{err: fmt.Errorf("no such table: sessions")}
51+ mgr := cmdmocks.NewMockSessionManager(t)
52+ mgr.EXPECT().
53+ GetRecentSessions(mock.Anything, recentSessionsLimit).
54+ Return(nil, fmt.Errorf("no such table: sessions")).
55+ Once()
5856 merged, err := getSessionsMerged(context.Background(), mgr, logDir)
5957 require.NoError(t, err)
6058 require.Len(t, merged, 1)
@@ -65,7 +63,11 @@ func TestFindSession_DBShortIDMatch(t *testing.T) {
6563 logDir := t.TempDir()
6664
6765 s1 := &entity.Session{ID: entity.SessionID("20251217_205106_a7b3"), Type: entity.SessionTypeBrowser, StartedAt: time.Date(2025, 12, 17, 20, 51, 6, 0, time.UTC)}
68- mgr := &fakeSessionMgr{sessions: []*entity.Session{s1}}
66+ mgr := cmdmocks.NewMockSessionManager(t)
67+ mgr.EXPECT().
68+ GetRecentSessions(mock.Anything, recentSessionsLimit).
69+ Return([]*entity.Session{s1}, nil).
70+ Once()
6971
7072 info, err := findSession(context.Background(), mgr, logDir, "a7b3")
7173 require.NoError(t, err)
A internal/cli/cmd/mocks/logs.go +107 -0
@@ -0,0 +1,107 @@
1+// Code generated by mockery; DO NOT EDIT.
2+// github.com/vektra/mockery
3+// template: testify
4+
5+package mocks
6+
7+import (
8+ "context"
9+
10+ "github.com/bnema/dumber/internal/domain/entity"
11+ mock "github.com/stretchr/testify/mock"
12+)
13+
14+// NewMockSessionManager creates a new instance of MockSessionManager. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
15+// The first argument is typically a *testing.T value.
16+func NewMockSessionManager(t interface {
17+ mock.TestingT
18+ Cleanup(func())
19+}) *MockSessionManager {
20+ mock := &MockSessionManager{}
21+ mock.Mock.Test(t)
22+
23+ t.Cleanup(func() { mock.AssertExpectations(t) })
24+
25+ return mock
26+}
27+
28+// MockSessionManager is an autogenerated mock type for the sessionManager type
29+type MockSessionManager struct {
30+ mock.Mock
31+}
32+
33+type MockSessionManager_Expecter struct {
34+ mock *mock.Mock
35+}
36+
37+func (_m *MockSessionManager) EXPECT() *MockSessionManager_Expecter {
38+ return &MockSessionManager_Expecter{mock: &_m.Mock}
39+}
40+
41+// GetRecentSessions provides a mock function for the type MockSessionManager
42+func (_mock *MockSessionManager) GetRecentSessions(ctx context.Context, limit int) ([]*entity.Session, error) {
43+ ret := _mock.Called(ctx, limit)
44+
45+ if len(ret) == 0 {
46+ panic("no return value specified for GetRecentSessions")
47+ }
48+
49+ var r0 []*entity.Session
50+ var r1 error
51+ if returnFunc, ok := ret.Get(0).(func(context.Context, int) ([]*entity.Session, error)); ok {
52+ return returnFunc(ctx, limit)
53+ }
54+ if returnFunc, ok := ret.Get(0).(func(context.Context, int) []*entity.Session); ok {
55+ r0 = returnFunc(ctx, limit)
56+ } else {
57+ if ret.Get(0) != nil {
58+ r0 = ret.Get(0).([]*entity.Session)
59+ }
60+ }
61+ if returnFunc, ok := ret.Get(1).(func(context.Context, int) error); ok {
62+ r1 = returnFunc(ctx, limit)
63+ } else {
64+ r1 = ret.Error(1)
65+ }
66+ return r0, r1
67+}
68+
69+// MockSessionManager_GetRecentSessions_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetRecentSessions'
70+type MockSessionManager_GetRecentSessions_Call struct {
71+ *mock.Call
72+}
73+
74+// GetRecentSessions is a helper method to define mock.On call
75+// - ctx context.Context
76+// - limit int
77+func (_e *MockSessionManager_Expecter) GetRecentSessions(ctx any, limit any) *MockSessionManager_GetRecentSessions_Call {
78+ return &MockSessionManager_GetRecentSessions_Call{Call: _e.mock.On("GetRecentSessions", ctx, limit)}
79+}
80+
81+func (_c *MockSessionManager_GetRecentSessions_Call) Run(run func(ctx context.Context, limit int)) *MockSessionManager_GetRecentSessions_Call {
82+ _c.Call.Run(func(args mock.Arguments) {
83+ var arg0 context.Context
84+ if args[0] != nil {
85+ arg0 = args[0].(context.Context)
86+ }
87+ var arg1 int
88+ if args[1] != nil {
89+ arg1 = args[1].(int)
90+ }
91+ run(
92+ arg0,
93+ arg1,
94+ )
95+ })
96+ return _c
97+}
98+
99+func (_c *MockSessionManager_GetRecentSessions_Call) Return(sessions []*entity.Session, err error) *MockSessionManager_GetRecentSessions_Call {
100+ _c.Call.Return(sessions, err)
101+ return _c
102+}
103+
104+func (_c *MockSessionManager_GetRecentSessions_Call) RunAndReturn(run func(ctx context.Context, limit int) ([]*entity.Session, error)) *MockSessionManager_GetRecentSessions_Call {
105+ _c.Call.Return(run)
106+ return _c
107+}
A internal/domain/entity/engine_settings_test.go +38 -0
@@ -0,0 +1,38 @@
1+package entity
2+
3+import (
4+ "reflect"
5+ "testing"
6+)
7+
8+func TestEngineSettingsPayloadContainsRuntimeWebContentFields(t *testing.T) {
9+ payloadType := reflect.TypeOf(EngineSettingsPayload{})
10+ for _, field := range []string{"DefaultUIScale", "WebContent"} {
11+ if _, ok := payloadType.FieldByName(field); !ok {
12+ t.Fatalf("EngineSettingsPayload missing %s", field)
13+ }
14+ }
15+ webContentType := reflect.TypeOf(EngineWebContentSettingsPayload{})
16+ for _, field := range []string{
17+ "SansFont",
18+ "SerifFont",
19+ "MonospaceFont",
20+ "DefaultFontSize",
21+ "EnableDevTools",
22+ "CaptureConsole",
23+ "DrawCompositingIndicators",
24+ "HardwareDecoding",
25+ "AutoCopyOnSelection",
26+ } {
27+ if _, ok := webContentType.FieldByName(field); !ok {
28+ t.Fatalf("EngineWebContentSettingsPayload missing %s", field)
29+ }
30+ }
31+}
32+
33+func TestEngineSettingsUpdateHasNoRawBridge(t *testing.T) {
34+ updateType := reflect.TypeOf(EngineSettingsUpdate{})
35+ if _, ok := updateType.FieldByName("Raw"); ok {
36+ t.Fatal("EngineSettingsUpdate must not expose Raw legacy bridge")
37+ }
38+}
A internal/domain/entity/runtime_config.go +80 -0
@@ -0,0 +1,80 @@
1+package entity
2+
3+// EngineHardwareDecodingMode controls engine-facing video hardware acceleration.
4+type EngineHardwareDecodingMode string
5+
6+const (
7+ EngineHardwareDecodingAuto EngineHardwareDecodingMode = "auto"
8+ EngineHardwareDecodingForce EngineHardwareDecodingMode = "force"
9+ EngineHardwareDecodingDisable EngineHardwareDecodingMode = "disable"
10+)
11+
12+// EngineWebContentSettingsPayload is the engine-facing runtime view of web
13+// content settings that can be applied to newly-created or existing webviews.
14+type EngineWebContentSettingsPayload struct {
15+ SansFont string
16+ SerifFont string
17+ MonospaceFont string
18+ DefaultFontSize int
19+ EnableDevTools bool
20+ CaptureConsole bool
21+ DrawCompositingIndicators bool
22+ HardwareDecoding EngineHardwareDecodingMode
23+ AutoCopyOnSelection bool
24+}
25+
26+// EngineSettingsPayload is the engine-facing boundary view of runtime config.
27+// Add fields here only when an engine needs to react to them at runtime.
28+type EngineSettingsPayload struct {
29+ DefaultUIScale float64
30+ WebContent EngineWebContentSettingsPayload
31+}
32+
33+// EngineSettingsUpdate carries a runtime config change to the engine.
34+type EngineSettingsUpdate struct {
35+ Settings EngineSettingsPayload
36+}
37+
38+type RuntimeConfigSnapshot struct {
39+ EngineSettings EngineSettingsPayload
40+ UI RuntimeUIConfig
41+}
42+
43+type RuntimeUIConfig struct {
44+ DefaultUIScale float64
45+ SidebarWidth int
46+ Appearance AppearanceConfig
47+ Workspace WorkspaceConfig
48+ Session SessionConfig
49+ Clipboard RuntimeClipboardConfig
50+ SearchShortcuts map[string]RuntimeSearchShortcut
51+ DefaultSearchEngine string
52+ Omnibox RuntimeOmniboxConfig
53+ Update RuntimeUpdateConfig
54+ Downloads RuntimeDownloadsConfig
55+}
56+
57+type RuntimeClipboardConfig struct {
58+ AutoCopyOnSelection bool
59+}
60+
61+type RuntimeSearchShortcut struct {
62+ URL string
63+ Description string
64+}
65+
66+type RuntimeOmniboxConfig struct {
67+ InitialBehavior OmniboxInitialBehavior
68+ MostVisitedDays int
69+ AutoOpenOnNewPane bool
70+}
71+
72+type RuntimeUpdateConfig struct {
73+ EnableOnStartup bool
74+ AutoDownload bool
75+ NotifyOnNewSettings bool
76+}
77+
78+type RuntimeDownloadsConfig struct {
79+ Path string
80+}
A internal/domain/repository/mocks/favorite.go +1611 -0
@@ -0,0 +1,1611 @@
1+// Code generated by mockery; DO NOT EDIT.
2+// github.com/vektra/mockery
3+// template: testify
4+
5+package mocks
6+
7+import (
8+ "context"
9+
10+ "github.com/bnema/dumber/internal/domain/entity"
11+ mock "github.com/stretchr/testify/mock"
12+)
13+
14+// NewMockFavoriteRepository creates a new instance of MockFavoriteRepository. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
15+// The first argument is typically a *testing.T value.
16+func NewMockFavoriteRepository(t interface {
17+ mock.TestingT
18+ Cleanup(func())
19+}) *MockFavoriteRepository {
20+ mock := &MockFavoriteRepository{}
21+ mock.Mock.Test(t)
22+
23+ t.Cleanup(func() { mock.AssertExpectations(t) })
24+
25+ return mock
26+}
27+
28+// MockFavoriteRepository is an autogenerated mock type for the FavoriteRepository type
29+type MockFavoriteRepository struct {
30+ mock.Mock
31+}
32+
33+type MockFavoriteRepository_Expecter struct {
34+ mock *mock.Mock
35+}
36+
37+func (_m *MockFavoriteRepository) EXPECT() *MockFavoriteRepository_Expecter {
38+ return &MockFavoriteRepository_Expecter{mock: &_m.Mock}
39+}
40+
41+// Delete provides a mock function for the type MockFavoriteRepository
42+func (_mock *MockFavoriteRepository) Delete(ctx context.Context, id entity.FavoriteID) error {
43+ ret := _mock.Called(ctx, id)
44+
45+ if len(ret) == 0 {
46+ panic("no return value specified for Delete")
47+ }
48+
49+ var r0 error
50+ if returnFunc, ok := ret.Get(0).(func(context.Context, entity.FavoriteID) error); ok {
51+ r0 = returnFunc(ctx, id)
52+ } else {
53+ r0 = ret.Error(0)
54+ }
55+ return r0
56+}
57+
58+// MockFavoriteRepository_Delete_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Delete'
59+type MockFavoriteRepository_Delete_Call struct {
60+ *mock.Call
61+}
62+
63+// Delete is a helper method to define mock.On call
64+// - ctx context.Context
65+// - id entity.FavoriteID
66+func (_e *MockFavoriteRepository_Expecter) Delete(ctx any, id any) *MockFavoriteRepository_Delete_Call {
67+ return &MockFavoriteRepository_Delete_Call{Call: _e.mock.On("Delete", ctx, id)}
68+}
69+
70+func (_c *MockFavoriteRepository_Delete_Call) Run(run func(ctx context.Context, id entity.FavoriteID)) *MockFavoriteRepository_Delete_Call {
71+ _c.Call.Run(func(args mock.Arguments) {
72+ var arg0 context.Context
73+ if args[0] != nil {
74+ arg0 = args[0].(context.Context)
75+ }
76+ var arg1 entity.FavoriteID
77+ if args[1] != nil {
78+ arg1 = args[1].(entity.FavoriteID)
79+ }
80+ run(
81+ arg0,
82+ arg1,
83+ )
84+ })
85+ return _c
86+}
87+
88+func (_c *MockFavoriteRepository_Delete_Call) Return(err error) *MockFavoriteRepository_Delete_Call {
89+ _c.Call.Return(err)
90+ return _c
91+}
92+
93+func (_c *MockFavoriteRepository_Delete_Call) RunAndReturn(run func(ctx context.Context, id entity.FavoriteID) error) *MockFavoriteRepository_Delete_Call {
94+ _c.Call.Return(run)
95+ return _c
96+}
97+
98+// FindByID provides a mock function for the type MockFavoriteRepository
99+func (_mock *MockFavoriteRepository) FindByID(ctx context.Context, id entity.FavoriteID) (*entity.Favorite, error) {
100+ ret := _mock.Called(ctx, id)
101+
102+ if len(ret) == 0 {
103+ panic("no return value specified for FindByID")
104+ }
105+
106+ var r0 *entity.Favorite
107+ var r1 error
108+ if returnFunc, ok := ret.Get(0).(func(context.Context, entity.FavoriteID) (*entity.Favorite, error)); ok {
109+ return returnFunc(ctx, id)
110+ }
111+ if returnFunc, ok := ret.Get(0).(func(context.Context, entity.FavoriteID) *entity.Favorite); ok {
112+ r0 = returnFunc(ctx, id)
113+ } else {
114+ if ret.Get(0) != nil {
115+ r0 = ret.Get(0).(*entity.Favorite)
116+ }
117+ }
118+ if returnFunc, ok := ret.Get(1).(func(context.Context, entity.FavoriteID) error); ok {
119+ r1 = returnFunc(ctx, id)
120+ } else {
121+ r1 = ret.Error(1)
122+ }
123+ return r0, r1
124+}
125+
126+// MockFavoriteRepository_FindByID_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'FindByID'
127+type MockFavoriteRepository_FindByID_Call struct {
128+ *mock.Call
129+}
130+
131+// FindByID is a helper method to define mock.On call
132+// - ctx context.Context
133+// - id entity.FavoriteID
134+func (_e *MockFavoriteRepository_Expecter) FindByID(ctx any, id any) *MockFavoriteRepository_FindByID_Call {
135+ return &MockFavoriteRepository_FindByID_Call{Call: _e.mock.On("FindByID", ctx, id)}
136+}
137+
138+func (_c *MockFavoriteRepository_FindByID_Call) Run(run func(ctx context.Context, id entity.FavoriteID)) *MockFavoriteRepository_FindByID_Call {
139+ _c.Call.Run(func(args mock.Arguments) {
140+ var arg0 context.Context
141+ if args[0] != nil {
142+ arg0 = args[0].(context.Context)
143+ }
144+ var arg1 entity.FavoriteID
145+ if args[1] != nil {
146+ arg1 = args[1].(entity.FavoriteID)
147+ }
148+ run(
149+ arg0,
150+ arg1,
151+ )
152+ })
153+ return _c
154+}
155+
156+func (_c *MockFavoriteRepository_FindByID_Call) Return(favorite *entity.Favorite, err error) *MockFavoriteRepository_FindByID_Call {
157+ _c.Call.Return(favorite, err)
158+ return _c
159+}
160+
161+func (_c *MockFavoriteRepository_FindByID_Call) RunAndReturn(run func(ctx context.Context, id entity.FavoriteID) (*entity.Favorite, error)) *MockFavoriteRepository_FindByID_Call {
162+ _c.Call.Return(run)
163+ return _c
164+}
165+
166+// FindByURL provides a mock function for the type MockFavoriteRepository
167+func (_mock *MockFavoriteRepository) FindByURL(ctx context.Context, url string) (*entity.Favorite, error) {
168+ ret := _mock.Called(ctx, url)
169+
170+ if len(ret) == 0 {
171+ panic("no return value specified for FindByURL")
172+ }
173+
174+ var r0 *entity.Favorite
175+ var r1 error
176+ if returnFunc, ok := ret.Get(0).(func(context.Context, string) (*entity.Favorite, error)); ok {
177+ return returnFunc(ctx, url)
178+ }
179+ if returnFunc, ok := ret.Get(0).(func(context.Context, string) *entity.Favorite); ok {
180+ r0 = returnFunc(ctx, url)
181+ } else {
182+ if ret.Get(0) != nil {
183+ r0 = ret.Get(0).(*entity.Favorite)
184+ }
185+ }
186+ if returnFunc, ok := ret.Get(1).(func(context.Context, string) error); ok {
187+ r1 = returnFunc(ctx, url)
188+ } else {
189+ r1 = ret.Error(1)
190+ }
191+ return r0, r1
192+}
193+
194+// MockFavoriteRepository_FindByURL_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'FindByURL'
195+type MockFavoriteRepository_FindByURL_Call struct {
196+ *mock.Call
197+}
198+
199+// FindByURL is a helper method to define mock.On call
200+// - ctx context.Context
201+// - url string
202+func (_e *MockFavoriteRepository_Expecter) FindByURL(ctx any, url any) *MockFavoriteRepository_FindByURL_Call {
203+ return &MockFavoriteRepository_FindByURL_Call{Call: _e.mock.On("FindByURL", ctx, url)}
204+}
205+
206+func (_c *MockFavoriteRepository_FindByURL_Call) Run(run func(ctx context.Context, url string)) *MockFavoriteRepository_FindByURL_Call {
207+ _c.Call.Run(func(args mock.Arguments) {
208+ var arg0 context.Context
209+ if args[0] != nil {
210+ arg0 = args[0].(context.Context)
211+ }
212+ var arg1 string
213+ if args[1] != nil {
214+ arg1 = args[1].(string)
215+ }
216+ run(
217+ arg0,
218+ arg1,
219+ )
220+ })
221+ return _c
222+}
223+
224+func (_c *MockFavoriteRepository_FindByURL_Call) Return(favorite *entity.Favorite, err error) *MockFavoriteRepository_FindByURL_Call {
225+ _c.Call.Return(favorite, err)
226+ return _c
227+}
228+
229+func (_c *MockFavoriteRepository_FindByURL_Call) RunAndReturn(run func(ctx context.Context, url string) (*entity.Favorite, error)) *MockFavoriteRepository_FindByURL_Call {
230+ _c.Call.Return(run)
231+ return _c
232+}
233+
234+// GetAll provides a mock function for the type MockFavoriteRepository
235+func (_mock *MockFavoriteRepository) GetAll(ctx context.Context) ([]*entity.Favorite, error) {
236+ ret := _mock.Called(ctx)
237+
238+ if len(ret) == 0 {
239+ panic("no return value specified for GetAll")
240+ }
241+
242+ var r0 []*entity.Favorite
243+ var r1 error
244+ if returnFunc, ok := ret.Get(0).(func(context.Context) ([]*entity.Favorite, error)); ok {
245+ return returnFunc(ctx)
246+ }
247+ if returnFunc, ok := ret.Get(0).(func(context.Context) []*entity.Favorite); ok {
248+ r0 = returnFunc(ctx)
249+ } else {
250+ if ret.Get(0) != nil {
251+ r0 = ret.Get(0).([]*entity.Favorite)
252+ }
253+ }
254+ if returnFunc, ok := ret.Get(1).(func(context.Context) error); ok {
255+ r1 = returnFunc(ctx)
256+ } else {
257+ r1 = ret.Error(1)
258+ }
259+ return r0, r1
260+}
261+
262+// MockFavoriteRepository_GetAll_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetAll'
263+type MockFavoriteRepository_GetAll_Call struct {
264+ *mock.Call
265+}
266+
267+// GetAll is a helper method to define mock.On call
268+// - ctx context.Context
269+func (_e *MockFavoriteRepository_Expecter) GetAll(ctx any) *MockFavoriteRepository_GetAll_Call {
270+ return &MockFavoriteRepository_GetAll_Call{Call: _e.mock.On("GetAll", ctx)}
271+}
272+
273+func (_c *MockFavoriteRepository_GetAll_Call) Run(run func(ctx context.Context)) *MockFavoriteRepository_GetAll_Call {
274+ _c.Call.Run(func(args mock.Arguments) {
275+ var arg0 context.Context
276+ if args[0] != nil {
277+ arg0 = args[0].(context.Context)
278+ }
279+ run(
280+ arg0,
281+ )
282+ })
283+ return _c
284+}
285+
286+func (_c *MockFavoriteRepository_GetAll_Call) Return(favorites []*entity.Favorite, err error) *MockFavoriteRepository_GetAll_Call {
287+ _c.Call.Return(favorites, err)
288+ return _c
289+}
290+
291+func (_c *MockFavoriteRepository_GetAll_Call) RunAndReturn(run func(ctx context.Context) ([]*entity.Favorite, error)) *MockFavoriteRepository_GetAll_Call {
292+ _c.Call.Return(run)
293+ return _c
294+}
295+
296+// GetByFolder provides a mock function for the type MockFavoriteRepository
297+func (_mock *MockFavoriteRepository) GetByFolder(ctx context.Context, folderID *entity.FolderID) ([]*entity.Favorite, error) {
298+ ret := _mock.Called(ctx, folderID)
299+
300+ if len(ret) == 0 {
301+ panic("no return value specified for GetByFolder")
302+ }
303+
304+ var r0 []*entity.Favorite
305+ var r1 error
306+ if returnFunc, ok := ret.Get(0).(func(context.Context, *entity.FolderID) ([]*entity.Favorite, error)); ok {
307+ return returnFunc(ctx, folderID)
308+ }
309+ if returnFunc, ok := ret.Get(0).(func(context.Context, *entity.FolderID) []*entity.Favorite); ok {
310+ r0 = returnFunc(ctx, folderID)
311+ } else {
312+ if ret.Get(0) != nil {
313+ r0 = ret.Get(0).([]*entity.Favorite)
314+ }
315+ }
316+ if returnFunc, ok := ret.Get(1).(func(context.Context, *entity.FolderID) error); ok {
317+ r1 = returnFunc(ctx, folderID)
318+ } else {
319+ r1 = ret.Error(1)
320+ }
321+ return r0, r1
322+}
323+
324+// MockFavoriteRepository_GetByFolder_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetByFolder'
325+type MockFavoriteRepository_GetByFolder_Call struct {
326+ *mock.Call
327+}
328+
329+// GetByFolder is a helper method to define mock.On call
330+// - ctx context.Context
331+// - folderID *entity.FolderID
332+func (_e *MockFavoriteRepository_Expecter) GetByFolder(ctx any, folderID any) *MockFavoriteRepository_GetByFolder_Call {
333+ return &MockFavoriteRepository_GetByFolder_Call{Call: _e.mock.On("GetByFolder", ctx, folderID)}
334+}
335+
336+func (_c *MockFavoriteRepository_GetByFolder_Call) Run(run func(ctx context.Context, folderID *entity.FolderID)) *MockFavoriteRepository_GetByFolder_Call {
337+ _c.Call.Run(func(args mock.Arguments) {
338+ var arg0 context.Context
339+ if args[0] != nil {
340+ arg0 = args[0].(context.Context)
341+ }
342+ var arg1 *entity.FolderID
343+ if args[1] != nil {
344+ arg1 = args[1].(*entity.FolderID)
345+ }
346+ run(
347+ arg0,
348+ arg1,
349+ )
350+ })
351+ return _c
352+}
353+
354+func (_c *MockFavoriteRepository_GetByFolder_Call) Return(favorites []*entity.Favorite, err error) *MockFavoriteRepository_GetByFolder_Call {
355+ _c.Call.Return(favorites, err)
356+ return _c
357+}
358+
359+func (_c *MockFavoriteRepository_GetByFolder_Call) RunAndReturn(run func(ctx context.Context, folderID *entity.FolderID) ([]*entity.Favorite, error)) *MockFavoriteRepository_GetByFolder_Call {
360+ _c.Call.Return(run)
361+ return _c
362+}
363+
364+// GetByShortcut provides a mock function for the type MockFavoriteRepository
365+func (_mock *MockFavoriteRepository) GetByShortcut(ctx context.Context, key int) (*entity.Favorite, error) {
366+ ret := _mock.Called(ctx, key)
367+
368+ if len(ret) == 0 {
369+ panic("no return value specified for GetByShortcut")
370+ }
371+
372+ var r0 *entity.Favorite
373+ var r1 error
374+ if returnFunc, ok := ret.Get(0).(func(context.Context, int) (*entity.Favorite, error)); ok {
375+ return returnFunc(ctx, key)
376+ }
377+ if returnFunc, ok := ret.Get(0).(func(context.Context, int) *entity.Favorite); ok {
378+ r0 = returnFunc(ctx, key)
379+ } else {
380+ if ret.Get(0) != nil {
381+ r0 = ret.Get(0).(*entity.Favorite)
382+ }
383+ }
384+ if returnFunc, ok := ret.Get(1).(func(context.Context, int) error); ok {
385+ r1 = returnFunc(ctx, key)
386+ } else {
387+ r1 = ret.Error(1)
388+ }
389+ return r0, r1
390+}
391+
392+// MockFavoriteRepository_GetByShortcut_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetByShortcut'
393+type MockFavoriteRepository_GetByShortcut_Call struct {
394+ *mock.Call
395+}
396+
397+// GetByShortcut is a helper method to define mock.On call
398+// - ctx context.Context
399+// - key int
400+func (_e *MockFavoriteRepository_Expecter) GetByShortcut(ctx any, key any) *MockFavoriteRepository_GetByShortcut_Call {
401+ return &MockFavoriteRepository_GetByShortcut_Call{Call: _e.mock.On("GetByShortcut", ctx, key)}
402+}
403+
404+func (_c *MockFavoriteRepository_GetByShortcut_Call) Run(run func(ctx context.Context, key int)) *MockFavoriteRepository_GetByShortcut_Call {
405+ _c.Call.Run(func(args mock.Arguments) {
406+ var arg0 context.Context
407+ if args[0] != nil {
408+ arg0 = args[0].(context.Context)
409+ }
410+ var arg1 int
411+ if args[1] != nil {
412+ arg1 = args[1].(int)
413+ }
414+ run(
415+ arg0,
416+ arg1,
417+ )
418+ })
419+ return _c
420+}
421+
422+func (_c *MockFavoriteRepository_GetByShortcut_Call) Return(favorite *entity.Favorite, err error) *MockFavoriteRepository_GetByShortcut_Call {
423+ _c.Call.Return(favorite, err)
424+ return _c
425+}
426+
427+func (_c *MockFavoriteRepository_GetByShortcut_Call) RunAndReturn(run func(ctx context.Context, key int) (*entity.Favorite, error)) *MockFavoriteRepository_GetByShortcut_Call {
428+ _c.Call.Return(run)
429+ return _c
430+}
431+
432+// Save provides a mock function for the type MockFavoriteRepository
433+func (_mock *MockFavoriteRepository) Save(ctx context.Context, fav *entity.Favorite) error {
434+ ret := _mock.Called(ctx, fav)
435+
436+ if len(ret) == 0 {
437+ panic("no return value specified for Save")
438+ }
439+
440+ var r0 error
441+ if returnFunc, ok := ret.Get(0).(func(context.Context, *entity.Favorite) error); ok {
442+ r0 = returnFunc(ctx, fav)
443+ } else {
444+ r0 = ret.Error(0)
445+ }
446+ return r0
447+}
448+
449+// MockFavoriteRepository_Save_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Save'
450+type MockFavoriteRepository_Save_Call struct {
451+ *mock.Call
452+}
453+
454+// Save is a helper method to define mock.On call
455+// - ctx context.Context
456+// - fav *entity.Favorite
457+func (_e *MockFavoriteRepository_Expecter) Save(ctx any, fav any) *MockFavoriteRepository_Save_Call {
458+ return &MockFavoriteRepository_Save_Call{Call: _e.mock.On("Save", ctx, fav)}
459+}
460+
461+func (_c *MockFavoriteRepository_Save_Call) Run(run func(ctx context.Context, fav *entity.Favorite)) *MockFavoriteRepository_Save_Call {
462+ _c.Call.Run(func(args mock.Arguments) {
463+ var arg0 context.Context
464+ if args[0] != nil {
465+ arg0 = args[0].(context.Context)
466+ }
467+ var arg1 *entity.Favorite
468+ if args[1] != nil {
469+ arg1 = args[1].(*entity.Favorite)
470+ }
471+ run(
472+ arg0,
473+ arg1,
474+ )
475+ })
476+ return _c
477+}
478+
479+func (_c *MockFavoriteRepository_Save_Call) Return(err error) *MockFavoriteRepository_Save_Call {
480+ _c.Call.Return(err)
481+ return _c
482+}
483+
484+func (_c *MockFavoriteRepository_Save_Call) RunAndReturn(run func(ctx context.Context, fav *entity.Favorite) error) *MockFavoriteRepository_Save_Call {
485+ _c.Call.Return(run)
486+ return _c
487+}
488+
489+// SetFolder provides a mock function for the type MockFavoriteRepository
490+func (_mock *MockFavoriteRepository) SetFolder(ctx context.Context, id entity.FavoriteID, folderID *entity.FolderID) error {
491+ ret := _mock.Called(ctx, id, folderID)
492+
493+ if len(ret) == 0 {
494+ panic("no return value specified for SetFolder")
495+ }
496+
497+ var r0 error
498+ if returnFunc, ok := ret.Get(0).(func(context.Context, entity.FavoriteID, *entity.FolderID) error); ok {
499+ r0 = returnFunc(ctx, id, folderID)
500+ } else {
501+ r0 = ret.Error(0)
502+ }
503+ return r0
504+}
505+
506+// MockFavoriteRepository_SetFolder_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'SetFolder'
507+type MockFavoriteRepository_SetFolder_Call struct {
508+ *mock.Call
509+}
510+
511+// SetFolder is a helper method to define mock.On call
512+// - ctx context.Context
513+// - id entity.FavoriteID
514+// - folderID *entity.FolderID
515+func (_e *MockFavoriteRepository_Expecter) SetFolder(ctx any, id any, folderID any) *MockFavoriteRepository_SetFolder_Call {
516+ return &MockFavoriteRepository_SetFolder_Call{Call: _e.mock.On("SetFolder", ctx, id, folderID)}
517+}
518+
519+func (_c *MockFavoriteRepository_SetFolder_Call) Run(run func(ctx context.Context, id entity.FavoriteID, folderID *entity.FolderID)) *MockFavoriteRepository_SetFolder_Call {
520+ _c.Call.Run(func(args mock.Arguments) {
521+ var arg0 context.Context
522+ if args[0] != nil {
523+ arg0 = args[0].(context.Context)
524+ }
525+ var arg1 entity.FavoriteID
526+ if args[1] != nil {
527+ arg1 = args[1].(entity.FavoriteID)
528+ }
529+ var arg2 *entity.FolderID
530+ if args[2] != nil {
531+ arg2 = args[2].(*entity.FolderID)
532+ }
533+ run(
534+ arg0,
535+ arg1,
536+ arg2,
537+ )
538+ })
539+ return _c
540+}
541+
542+func (_c *MockFavoriteRepository_SetFolder_Call) Return(err error) *MockFavoriteRepository_SetFolder_Call {
543+ _c.Call.Return(err)
544+ return _c
545+}
546+
547+func (_c *MockFavoriteRepository_SetFolder_Call) RunAndReturn(run func(ctx context.Context, id entity.FavoriteID, folderID *entity.FolderID) error) *MockFavoriteRepository_SetFolder_Call {
548+ _c.Call.Return(run)
549+ return _c
550+}
551+
552+// SetShortcut provides a mock function for the type MockFavoriteRepository
553+func (_mock *MockFavoriteRepository) SetShortcut(ctx context.Context, id entity.FavoriteID, key *int) error {
554+ ret := _mock.Called(ctx, id, key)
555+
556+ if len(ret) == 0 {
557+ panic("no return value specified for SetShortcut")
558+ }
559+
560+ var r0 error
561+ if returnFunc, ok := ret.Get(0).(func(context.Context, entity.FavoriteID, *int) error); ok {
562+ r0 = returnFunc(ctx, id, key)
563+ } else {
564+ r0 = ret.Error(0)
565+ }
566+ return r0
567+}
568+
569+// MockFavoriteRepository_SetShortcut_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'SetShortcut'
570+type MockFavoriteRepository_SetShortcut_Call struct {
571+ *mock.Call
572+}
573+
574+// SetShortcut is a helper method to define mock.On call
575+// - ctx context.Context
576+// - id entity.FavoriteID
577+// - key *int
578+func (_e *MockFavoriteRepository_Expecter) SetShortcut(ctx any, id any, key any) *MockFavoriteRepository_SetShortcut_Call {
579+ return &MockFavoriteRepository_SetShortcut_Call{Call: _e.mock.On("SetShortcut", ctx, id, key)}
580+}
581+
582+func (_c *MockFavoriteRepository_SetShortcut_Call) Run(run func(ctx context.Context, id entity.FavoriteID, key *int)) *MockFavoriteRepository_SetShortcut_Call {
583+ _c.Call.Run(func(args mock.Arguments) {
584+ var arg0 context.Context
585+ if args[0] != nil {
586+ arg0 = args[0].(context.Context)
587+ }
588+ var arg1 entity.FavoriteID
589+ if args[1] != nil {
590+ arg1 = args[1].(entity.FavoriteID)
591+ }
592+ var arg2 *int
593+ if args[2] != nil {
594+ arg2 = args[2].(*int)
595+ }
596+ run(
597+ arg0,
598+ arg1,
599+ arg2,
600+ )
601+ })
602+ return _c
603+}
604+
605+func (_c *MockFavoriteRepository_SetShortcut_Call) Return(err error) *MockFavoriteRepository_SetShortcut_Call {
606+ _c.Call.Return(err)
607+ return _c
608+}
609+
610+func (_c *MockFavoriteRepository_SetShortcut_Call) RunAndReturn(run func(ctx context.Context, id entity.FavoriteID, key *int) error) *MockFavoriteRepository_SetShortcut_Call {
611+ _c.Call.Return(run)
612+ return _c
613+}
614+
615+// UpdatePosition provides a mock function for the type MockFavoriteRepository
616+func (_mock *MockFavoriteRepository) UpdatePosition(ctx context.Context, id entity.FavoriteID, position int) error {
617+ ret := _mock.Called(ctx, id, position)
618+
619+ if len(ret) == 0 {
620+ panic("no return value specified for UpdatePosition")
621+ }
622+
623+ var r0 error
624+ if returnFunc, ok := ret.Get(0).(func(context.Context, entity.FavoriteID, int) error); ok {
625+ r0 = returnFunc(ctx, id, position)
626+ } else {
627+ r0 = ret.Error(0)
628+ }
629+ return r0
630+}
631+
632+// MockFavoriteRepository_UpdatePosition_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UpdatePosition'
633+type MockFavoriteRepository_UpdatePosition_Call struct {
634+ *mock.Call
635+}
636+
637+// UpdatePosition is a helper method to define mock.On call
638+// - ctx context.Context
639+// - id entity.FavoriteID
640+// - position int
641+func (_e *MockFavoriteRepository_Expecter) UpdatePosition(ctx any, id any, position any) *MockFavoriteRepository_UpdatePosition_Call {
642+ return &MockFavoriteRepository_UpdatePosition_Call{Call: _e.mock.On("UpdatePosition", ctx, id, position)}
643+}
644+
645+func (_c *MockFavoriteRepository_UpdatePosition_Call) Run(run func(ctx context.Context, id entity.FavoriteID, position int)) *MockFavoriteRepository_UpdatePosition_Call {
646+ _c.Call.Run(func(args mock.Arguments) {
647+ var arg0 context.Context
648+ if args[0] != nil {
649+ arg0 = args[0].(context.Context)
650+ }
651+ var arg1 entity.FavoriteID
652+ if args[1] != nil {
653+ arg1 = args[1].(entity.FavoriteID)
654+ }
655+ var arg2 int
656+ if args[2] != nil {
657+ arg2 = args[2].(int)
658+ }
659+ run(
660+ arg0,
661+ arg1,
662+ arg2,
663+ )
664+ })
665+ return _c
666+}
667+
668+func (_c *MockFavoriteRepository_UpdatePosition_Call) Return(err error) *MockFavoriteRepository_UpdatePosition_Call {
669+ _c.Call.Return(err)
670+ return _c
671+}
672+
673+func (_c *MockFavoriteRepository_UpdatePosition_Call) RunAndReturn(run func(ctx context.Context, id entity.FavoriteID, position int) error) *MockFavoriteRepository_UpdatePosition_Call {
674+ _c.Call.Return(run)
675+ return _c
676+}
677+
678+// NewMockFolderRepository creates a new instance of MockFolderRepository. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
679+// The first argument is typically a *testing.T value.
680+func NewMockFolderRepository(t interface {
681+ mock.TestingT
682+ Cleanup(func())
683+}) *MockFolderRepository {
684+ mock := &MockFolderRepository{}
685+ mock.Mock.Test(t)
686+
687+ t.Cleanup(func() { mock.AssertExpectations(t) })
688+
689+ return mock
690+}
691+
692+// MockFolderRepository is an autogenerated mock type for the FolderRepository type
693+type MockFolderRepository struct {
694+ mock.Mock
695+}
696+
697+type MockFolderRepository_Expecter struct {
698+ mock *mock.Mock
699+}
700+
701+func (_m *MockFolderRepository) EXPECT() *MockFolderRepository_Expecter {
702+ return &MockFolderRepository_Expecter{mock: &_m.Mock}
703+}
704+
705+// Delete provides a mock function for the type MockFolderRepository
706+func (_mock *MockFolderRepository) Delete(ctx context.Context, id entity.FolderID) error {
707+ ret := _mock.Called(ctx, id)
708+
709+ if len(ret) == 0 {
710+ panic("no return value specified for Delete")
711+ }
712+
713+ var r0 error
714+ if returnFunc, ok := ret.Get(0).(func(context.Context, entity.FolderID) error); ok {
715+ r0 = returnFunc(ctx, id)
716+ } else {
717+ r0 = ret.Error(0)
718+ }
719+ return r0
720+}
721+
722+// MockFolderRepository_Delete_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Delete'
723+type MockFolderRepository_Delete_Call struct {
724+ *mock.Call
725+}
726+
727+// Delete is a helper method to define mock.On call
728+// - ctx context.Context
729+// - id entity.FolderID
730+func (_e *MockFolderRepository_Expecter) Delete(ctx any, id any) *MockFolderRepository_Delete_Call {
731+ return &MockFolderRepository_Delete_Call{Call: _e.mock.On("Delete", ctx, id)}
732+}
733+
734+func (_c *MockFolderRepository_Delete_Call) Run(run func(ctx context.Context, id entity.FolderID)) *MockFolderRepository_Delete_Call {
735+ _c.Call.Run(func(args mock.Arguments) {
736+ var arg0 context.Context
737+ if args[0] != nil {
738+ arg0 = args[0].(context.Context)
739+ }
740+ var arg1 entity.FolderID
741+ if args[1] != nil {
742+ arg1 = args[1].(entity.FolderID)
743+ }
744+ run(
745+ arg0,
746+ arg1,
747+ )
748+ })
749+ return _c
750+}
751+
752+func (_c *MockFolderRepository_Delete_Call) Return(err error) *MockFolderRepository_Delete_Call {
753+ _c.Call.Return(err)
754+ return _c
755+}
756+
757+func (_c *MockFolderRepository_Delete_Call) RunAndReturn(run func(ctx context.Context, id entity.FolderID) error) *MockFolderRepository_Delete_Call {
758+ _c.Call.Return(run)
759+ return _c
760+}
761+
762+// FindByID provides a mock function for the type MockFolderRepository
763+func (_mock *MockFolderRepository) FindByID(ctx context.Context, id entity.FolderID) (*entity.Folder, error) {
764+ ret := _mock.Called(ctx, id)
765+
766+ if len(ret) == 0 {
767+ panic("no return value specified for FindByID")
768+ }
769+
770+ var r0 *entity.Folder
771+ var r1 error
772+ if returnFunc, ok := ret.Get(0).(func(context.Context, entity.FolderID) (*entity.Folder, error)); ok {
773+ return returnFunc(ctx, id)
774+ }
775+ if returnFunc, ok := ret.Get(0).(func(context.Context, entity.FolderID) *entity.Folder); ok {
776+ r0 = returnFunc(ctx, id)
777+ } else {
778+ if ret.Get(0) != nil {
779+ r0 = ret.Get(0).(*entity.Folder)
780+ }
781+ }
782+ if returnFunc, ok := ret.Get(1).(func(context.Context, entity.FolderID) error); ok {
783+ r1 = returnFunc(ctx, id)
784+ } else {
785+ r1 = ret.Error(1)
786+ }
787+ return r0, r1
788+}
789+
790+// MockFolderRepository_FindByID_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'FindByID'
791+type MockFolderRepository_FindByID_Call struct {
792+ *mock.Call
793+}
794+
795+// FindByID is a helper method to define mock.On call
796+// - ctx context.Context
797+// - id entity.FolderID
798+func (_e *MockFolderRepository_Expecter) FindByID(ctx any, id any) *MockFolderRepository_FindByID_Call {
799+ return &MockFolderRepository_FindByID_Call{Call: _e.mock.On("FindByID", ctx, id)}
800+}
801+
802+func (_c *MockFolderRepository_FindByID_Call) Run(run func(ctx context.Context, id entity.FolderID)) *MockFolderRepository_FindByID_Call {
803+ _c.Call.Run(func(args mock.Arguments) {
804+ var arg0 context.Context
805+ if args[0] != nil {
806+ arg0 = args[0].(context.Context)
807+ }
808+ var arg1 entity.FolderID
809+ if args[1] != nil {
810+ arg1 = args[1].(entity.FolderID)
811+ }
812+ run(
813+ arg0,
814+ arg1,
815+ )
816+ })
817+ return _c
818+}
819+
820+func (_c *MockFolderRepository_FindByID_Call) Return(folder *entity.Folder, err error) *MockFolderRepository_FindByID_Call {
821+ _c.Call.Return(folder, err)
822+ return _c
823+}
824+
825+func (_c *MockFolderRepository_FindByID_Call) RunAndReturn(run func(ctx context.Context, id entity.FolderID) (*entity.Folder, error)) *MockFolderRepository_FindByID_Call {
826+ _c.Call.Return(run)
827+ return _c
828+}
829+
830+// GetAll provides a mock function for the type MockFolderRepository
831+func (_mock *MockFolderRepository) GetAll(ctx context.Context) ([]*entity.Folder, error) {
832+ ret := _mock.Called(ctx)
833+
834+ if len(ret) == 0 {
835+ panic("no return value specified for GetAll")
836+ }
837+
838+ var r0 []*entity.Folder
839+ var r1 error
840+ if returnFunc, ok := ret.Get(0).(func(context.Context) ([]*entity.Folder, error)); ok {
841+ return returnFunc(ctx)
842+ }
843+ if returnFunc, ok := ret.Get(0).(func(context.Context) []*entity.Folder); ok {
844+ r0 = returnFunc(ctx)
845+ } else {
846+ if ret.Get(0) != nil {
847+ r0 = ret.Get(0).([]*entity.Folder)
848+ }
849+ }
850+ if returnFunc, ok := ret.Get(1).(func(context.Context) error); ok {
851+ r1 = returnFunc(ctx)
852+ } else {
853+ r1 = ret.Error(1)
854+ }
855+ return r0, r1
856+}
857+
858+// MockFolderRepository_GetAll_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetAll'
859+type MockFolderRepository_GetAll_Call struct {
860+ *mock.Call
861+}
862+
863+// GetAll is a helper method to define mock.On call
864+// - ctx context.Context
865+func (_e *MockFolderRepository_Expecter) GetAll(ctx any) *MockFolderRepository_GetAll_Call {
866+ return &MockFolderRepository_GetAll_Call{Call: _e.mock.On("GetAll", ctx)}
867+}
868+
869+func (_c *MockFolderRepository_GetAll_Call) Run(run func(ctx context.Context)) *MockFolderRepository_GetAll_Call {
870+ _c.Call.Run(func(args mock.Arguments) {
871+ var arg0 context.Context
872+ if args[0] != nil {
873+ arg0 = args[0].(context.Context)
874+ }
875+ run(
876+ arg0,
877+ )
878+ })
879+ return _c
880+}
881+
882+func (_c *MockFolderRepository_GetAll_Call) Return(folders []*entity.Folder, err error) *MockFolderRepository_GetAll_Call {
883+ _c.Call.Return(folders, err)
884+ return _c
885+}
886+
887+func (_c *MockFolderRepository_GetAll_Call) RunAndReturn(run func(ctx context.Context) ([]*entity.Folder, error)) *MockFolderRepository_GetAll_Call {
888+ _c.Call.Return(run)
889+ return _c
890+}
891+
892+// GetChildren provides a mock function for the type MockFolderRepository
893+func (_mock *MockFolderRepository) GetChildren(ctx context.Context, parentID *entity.FolderID) ([]*entity.Folder, error) {
894+ ret := _mock.Called(ctx, parentID)
895+
896+ if len(ret) == 0 {
897+ panic("no return value specified for GetChildren")
898+ }
899+
900+ var r0 []*entity.Folder
901+ var r1 error
902+ if returnFunc, ok := ret.Get(0).(func(context.Context, *entity.FolderID) ([]*entity.Folder, error)); ok {
903+ return returnFunc(ctx, parentID)
904+ }
905+ if returnFunc, ok := ret.Get(0).(func(context.Context, *entity.FolderID) []*entity.Folder); ok {
906+ r0 = returnFunc(ctx, parentID)
907+ } else {
908+ if ret.Get(0) != nil {
909+ r0 = ret.Get(0).([]*entity.Folder)
910+ }
911+ }
912+ if returnFunc, ok := ret.Get(1).(func(context.Context, *entity.FolderID) error); ok {
913+ r1 = returnFunc(ctx, parentID)
914+ } else {
915+ r1 = ret.Error(1)
916+ }
917+ return r0, r1
918+}
919+
920+// MockFolderRepository_GetChildren_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetChildren'
921+type MockFolderRepository_GetChildren_Call struct {
922+ *mock.Call
923+}
924+
925+// GetChildren is a helper method to define mock.On call
926+// - ctx context.Context
927+// - parentID *entity.FolderID
928+func (_e *MockFolderRepository_Expecter) GetChildren(ctx any, parentID any) *MockFolderRepository_GetChildren_Call {
929+ return &MockFolderRepository_GetChildren_Call{Call: _e.mock.On("GetChildren", ctx, parentID)}
930+}
931+
932+func (_c *MockFolderRepository_GetChildren_Call) Run(run func(ctx context.Context, parentID *entity.FolderID)) *MockFolderRepository_GetChildren_Call {
933+ _c.Call.Run(func(args mock.Arguments) {
934+ var arg0 context.Context
935+ if args[0] != nil {
936+ arg0 = args[0].(context.Context)
937+ }
938+ var arg1 *entity.FolderID
939+ if args[1] != nil {
940+ arg1 = args[1].(*entity.FolderID)
941+ }
942+ run(
943+ arg0,
944+ arg1,
945+ )
946+ })
947+ return _c
948+}
949+
950+func (_c *MockFolderRepository_GetChildren_Call) Return(folders []*entity.Folder, err error) *MockFolderRepository_GetChildren_Call {
951+ _c.Call.Return(folders, err)
952+ return _c
953+}
954+
955+func (_c *MockFolderRepository_GetChildren_Call) RunAndReturn(run func(ctx context.Context, parentID *entity.FolderID) ([]*entity.Folder, error)) *MockFolderRepository_GetChildren_Call {
956+ _c.Call.Return(run)
957+ return _c
958+}
959+
960+// Save provides a mock function for the type MockFolderRepository
961+func (_mock *MockFolderRepository) Save(ctx context.Context, folder *entity.Folder) error {
962+ ret := _mock.Called(ctx, folder)
963+
964+ if len(ret) == 0 {
965+ panic("no return value specified for Save")
966+ }
967+
968+ var r0 error
969+ if returnFunc, ok := ret.Get(0).(func(context.Context, *entity.Folder) error); ok {
970+ r0 = returnFunc(ctx, folder)
971+ } else {
972+ r0 = ret.Error(0)
973+ }
974+ return r0
975+}
976+
977+// MockFolderRepository_Save_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Save'
978+type MockFolderRepository_Save_Call struct {
979+ *mock.Call
980+}
981+
982+// Save is a helper method to define mock.On call
983+// - ctx context.Context
984+// - folder *entity.Folder
985+func (_e *MockFolderRepository_Expecter) Save(ctx any, folder any) *MockFolderRepository_Save_Call {
986+ return &MockFolderRepository_Save_Call{Call: _e.mock.On("Save", ctx, folder)}
987+}
988+
989+func (_c *MockFolderRepository_Save_Call) Run(run func(ctx context.Context, folder *entity.Folder)) *MockFolderRepository_Save_Call {
990+ _c.Call.Run(func(args mock.Arguments) {
991+ var arg0 context.Context
992+ if args[0] != nil {
993+ arg0 = args[0].(context.Context)
994+ }
995+ var arg1 *entity.Folder
996+ if args[1] != nil {
997+ arg1 = args[1].(*entity.Folder)
998+ }
999+ run(
1000+ arg0,
1001+ arg1,
1002+ )
1003+ })
1004+ return _c
1005+}
1006+
1007+func (_c *MockFolderRepository_Save_Call) Return(err error) *MockFolderRepository_Save_Call {
1008+ _c.Call.Return(err)
1009+ return _c
1010+}
1011+
1012+func (_c *MockFolderRepository_Save_Call) RunAndReturn(run func(ctx context.Context, folder *entity.Folder) error) *MockFolderRepository_Save_Call {
1013+ _c.Call.Return(run)
1014+ return _c
1015+}
1016+
1017+// UpdatePosition provides a mock function for the type MockFolderRepository
1018+func (_mock *MockFolderRepository) UpdatePosition(ctx context.Context, id entity.FolderID, position int) error {
1019+ ret := _mock.Called(ctx, id, position)
1020+
1021+ if len(ret) == 0 {
1022+ panic("no return value specified for UpdatePosition")
1023+ }
1024+
1025+ var r0 error
1026+ if returnFunc, ok := ret.Get(0).(func(context.Context, entity.FolderID, int) error); ok {
1027+ r0 = returnFunc(ctx, id, position)
1028+ } else {
1029+ r0 = ret.Error(0)
1030+ }
1031+ return r0
1032+}
1033+
1034+// MockFolderRepository_UpdatePosition_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UpdatePosition'
1035+type MockFolderRepository_UpdatePosition_Call struct {
1036+ *mock.Call
1037+}
1038+
1039+// UpdatePosition is a helper method to define mock.On call
1040+// - ctx context.Context
1041+// - id entity.FolderID
1042+// - position int
1043+func (_e *MockFolderRepository_Expecter) UpdatePosition(ctx any, id any, position any) *MockFolderRepository_UpdatePosition_Call {
1044+ return &MockFolderRepository_UpdatePosition_Call{Call: _e.mock.On("UpdatePosition", ctx, id, position)}
1045+}
1046+
1047+func (_c *MockFolderRepository_UpdatePosition_Call) Run(run func(ctx context.Context, id entity.FolderID, position int)) *MockFolderRepository_UpdatePosition_Call {
1048+ _c.Call.Run(func(args mock.Arguments) {
1049+ var arg0 context.Context
1050+ if args[0] != nil {
1051+ arg0 = args[0].(context.Context)
1052+ }
1053+ var arg1 entity.FolderID
1054+ if args[1] != nil {
1055+ arg1 = args[1].(entity.FolderID)
1056+ }
1057+ var arg2 int
1058+ if args[2] != nil {
1059+ arg2 = args[2].(int)
1060+ }
1061+ run(
1062+ arg0,
1063+ arg1,
1064+ arg2,
1065+ )
1066+ })
1067+ return _c
1068+}
1069+
1070+func (_c *MockFolderRepository_UpdatePosition_Call) Return(err error) *MockFolderRepository_UpdatePosition_Call {
1071+ _c.Call.Return(err)
1072+ return _c
1073+}
1074+
1075+func (_c *MockFolderRepository_UpdatePosition_Call) RunAndReturn(run func(ctx context.Context, id entity.FolderID, position int) error) *MockFolderRepository_UpdatePosition_Call {
1076+ _c.Call.Return(run)
1077+ return _c
1078+}
1079+
1080+// NewMockTagRepository creates a new instance of MockTagRepository. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
1081+// The first argument is typically a *testing.T value.
1082+func NewMockTagRepository(t interface {
1083+ mock.TestingT
1084+ Cleanup(func())
1085+}) *MockTagRepository {
1086+ mock := &MockTagRepository{}
1087+ mock.Mock.Test(t)
1088+
1089+ t.Cleanup(func() { mock.AssertExpectations(t) })
1090+
1091+ return mock
1092+}
1093+
1094+// MockTagRepository is an autogenerated mock type for the TagRepository type
1095+type MockTagRepository struct {
1096+ mock.Mock
1097+}
1098+
1099+type MockTagRepository_Expecter struct {
1100+ mock *mock.Mock
1101+}
1102+
1103+func (_m *MockTagRepository) EXPECT() *MockTagRepository_Expecter {
1104+ return &MockTagRepository_Expecter{mock: &_m.Mock}
1105+}
1106+
1107+// AssignToFavorite provides a mock function for the type MockTagRepository
1108+func (_mock *MockTagRepository) AssignToFavorite(ctx context.Context, tagID entity.TagID, favID entity.FavoriteID) error {
1109+ ret := _mock.Called(ctx, tagID, favID)
1110+
1111+ if len(ret) == 0 {
1112+ panic("no return value specified for AssignToFavorite")
1113+ }
1114+
1115+ var r0 error
1116+ if returnFunc, ok := ret.Get(0).(func(context.Context, entity.TagID, entity.FavoriteID) error); ok {
1117+ r0 = returnFunc(ctx, tagID, favID)
1118+ } else {
1119+ r0 = ret.Error(0)
1120+ }
1121+ return r0
1122+}
1123+
1124+// MockTagRepository_AssignToFavorite_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'AssignToFavorite'
1125+type MockTagRepository_AssignToFavorite_Call struct {
1126+ *mock.Call
1127+}
1128+
1129+// AssignToFavorite is a helper method to define mock.On call
1130+// - ctx context.Context
1131+// - tagID entity.TagID
1132+// - favID entity.FavoriteID
1133+func (_e *MockTagRepository_Expecter) AssignToFavorite(ctx any, tagID any, favID any) *MockTagRepository_AssignToFavorite_Call {
1134+ return &MockTagRepository_AssignToFavorite_Call{Call: _e.mock.On("AssignToFavorite", ctx, tagID, favID)}
1135+}
1136+
1137+func (_c *MockTagRepository_AssignToFavorite_Call) Run(run func(ctx context.Context, tagID entity.TagID, favID entity.FavoriteID)) *MockTagRepository_AssignToFavorite_Call {
1138+ _c.Call.Run(func(args mock.Arguments) {
1139+ var arg0 context.Context
1140+ if args[0] != nil {
1141+ arg0 = args[0].(context.Context)
1142+ }
1143+ var arg1 entity.TagID
1144+ if args[1] != nil {
1145+ arg1 = args[1].(entity.TagID)
1146+ }
1147+ var arg2 entity.FavoriteID
1148+ if args[2] != nil {
1149+ arg2 = args[2].(entity.FavoriteID)
1150+ }
1151+ run(
1152+ arg0,
1153+ arg1,
1154+ arg2,
1155+ )
1156+ })
1157+ return _c
1158+}
1159+
1160+func (_c *MockTagRepository_AssignToFavorite_Call) Return(err error) *MockTagRepository_AssignToFavorite_Call {
1161+ _c.Call.Return(err)
1162+ return _c
1163+}
1164+
1165+func (_c *MockTagRepository_AssignToFavorite_Call) RunAndReturn(run func(ctx context.Context, tagID entity.TagID, favID entity.FavoriteID) error) *MockTagRepository_AssignToFavorite_Call {
1166+ _c.Call.Return(run)
1167+ return _c
1168+}
1169+
1170+// Delete provides a mock function for the type MockTagRepository
1171+func (_mock *MockTagRepository) Delete(ctx context.Context, id entity.TagID) error {
1172+ ret := _mock.Called(ctx, id)
1173+
1174+ if len(ret) == 0 {
1175+ panic("no return value specified for Delete")
1176+ }
1177+
1178+ var r0 error
1179+ if returnFunc, ok := ret.Get(0).(func(context.Context, entity.TagID) error); ok {
1180+ r0 = returnFunc(ctx, id)
1181+ } else {
1182+ r0 = ret.Error(0)
1183+ }
1184+ return r0
1185+}
1186+
1187+// MockTagRepository_Delete_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Delete'
1188+type MockTagRepository_Delete_Call struct {
1189+ *mock.Call
1190+}
1191+
1192+// Delete is a helper method to define mock.On call
1193+// - ctx context.Context
1194+// - id entity.TagID
1195+func (_e *MockTagRepository_Expecter) Delete(ctx any, id any) *MockTagRepository_Delete_Call {
1196+ return &MockTagRepository_Delete_Call{Call: _e.mock.On("Delete", ctx, id)}
1197+}
1198+
1199+func (_c *MockTagRepository_Delete_Call) Run(run func(ctx context.Context, id entity.TagID)) *MockTagRepository_Delete_Call {
1200+ _c.Call.Run(func(args mock.Arguments) {
1201+ var arg0 context.Context
1202+ if args[0] != nil {
1203+ arg0 = args[0].(context.Context)
1204+ }
1205+ var arg1 entity.TagID
1206+ if args[1] != nil {
1207+ arg1 = args[1].(entity.TagID)
1208+ }
1209+ run(
1210+ arg0,
1211+ arg1,
1212+ )
1213+ })
1214+ return _c
1215+}
1216+
1217+func (_c *MockTagRepository_Delete_Call) Return(err error) *MockTagRepository_Delete_Call {
1218+ _c.Call.Return(err)
1219+ return _c
1220+}
1221+
1222+func (_c *MockTagRepository_Delete_Call) RunAndReturn(run func(ctx context.Context, id entity.TagID) error) *MockTagRepository_Delete_Call {
1223+ _c.Call.Return(run)
1224+ return _c
1225+}
1226+
1227+// FindByID provides a mock function for the type MockTagRepository
1228+func (_mock *MockTagRepository) FindByID(ctx context.Context, id entity.TagID) (*entity.Tag, error) {
1229+ ret := _mock.Called(ctx, id)
1230+
1231+ if len(ret) == 0 {
1232+ panic("no return value specified for FindByID")
1233+ }
1234+
1235+ var r0 *entity.Tag
1236+ var r1 error
1237+ if returnFunc, ok := ret.Get(0).(func(context.Context, entity.TagID) (*entity.Tag, error)); ok {
1238+ return returnFunc(ctx, id)
1239+ }
1240+ if returnFunc, ok := ret.Get(0).(func(context.Context, entity.TagID) *entity.Tag); ok {
1241+ r0 = returnFunc(ctx, id)
1242+ } else {
1243+ if ret.Get(0) != nil {
1244+ r0 = ret.Get(0).(*entity.Tag)
1245+ }
1246+ }
1247+ if returnFunc, ok := ret.Get(1).(func(context.Context, entity.TagID) error); ok {
1248+ r1 = returnFunc(ctx, id)
1249+ } else {
1250+ r1 = ret.Error(1)
1251+ }
1252+ return r0, r1
1253+}
1254+
1255+// MockTagRepository_FindByID_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'FindByID'
1256+type MockTagRepository_FindByID_Call struct {
1257+ *mock.Call
1258+}
1259+
1260+// FindByID is a helper method to define mock.On call
1261+// - ctx context.Context
1262+// - id entity.TagID
1263+func (_e *MockTagRepository_Expecter) FindByID(ctx any, id any) *MockTagRepository_FindByID_Call {
1264+ return &MockTagRepository_FindByID_Call{Call: _e.mock.On("FindByID", ctx, id)}
1265+}
1266+
1267+func (_c *MockTagRepository_FindByID_Call) Run(run func(ctx context.Context, id entity.TagID)) *MockTagRepository_FindByID_Call {
1268+ _c.Call.Run(func(args mock.Arguments) {
1269+ var arg0 context.Context
1270+ if args[0] != nil {
1271+ arg0 = args[0].(context.Context)
1272+ }
1273+ var arg1 entity.TagID
1274+ if args[1] != nil {
1275+ arg1 = args[1].(entity.TagID)
1276+ }
1277+ run(
1278+ arg0,
1279+ arg1,
1280+ )
1281+ })
1282+ return _c
1283+}
1284+
1285+func (_c *MockTagRepository_FindByID_Call) Return(tag *entity.Tag, err error) *MockTagRepository_FindByID_Call {
1286+ _c.Call.Return(tag, err)
1287+ return _c
1288+}
1289+
1290+func (_c *MockTagRepository_FindByID_Call) RunAndReturn(run func(ctx context.Context, id entity.TagID) (*entity.Tag, error)) *MockTagRepository_FindByID_Call {
1291+ _c.Call.Return(run)
1292+ return _c
1293+}
1294+
1295+// FindByName provides a mock function for the type MockTagRepository
1296+func (_mock *MockTagRepository) FindByName(ctx context.Context, name string) (*entity.Tag, error) {
1297+ ret := _mock.Called(ctx, name)
1298+
1299+ if len(ret) == 0 {
1300+ panic("no return value specified for FindByName")
1301+ }
1302+
1303+ var r0 *entity.Tag
1304+ var r1 error
1305+ if returnFunc, ok := ret.Get(0).(func(context.Context, string) (*entity.Tag, error)); ok {
1306+ return returnFunc(ctx, name)
1307+ }
1308+ if returnFunc, ok := ret.Get(0).(func(context.Context, string) *entity.Tag); ok {
1309+ r0 = returnFunc(ctx, name)
1310+ } else {
1311+ if ret.Get(0) != nil {
1312+ r0 = ret.Get(0).(*entity.Tag)
1313+ }
1314+ }
1315+ if returnFunc, ok := ret.Get(1).(func(context.Context, string) error); ok {
1316+ r1 = returnFunc(ctx, name)
1317+ } else {
1318+ r1 = ret.Error(1)
1319+ }
1320+ return r0, r1
1321+}
1322+
1323+// MockTagRepository_FindByName_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'FindByName'
1324+type MockTagRepository_FindByName_Call struct {
1325+ *mock.Call
1326+}
1327+
1328+// FindByName is a helper method to define mock.On call
1329+// - ctx context.Context
1330+// - name string
1331+func (_e *MockTagRepository_Expecter) FindByName(ctx any, name any) *MockTagRepository_FindByName_Call {
1332+ return &MockTagRepository_FindByName_Call{Call: _e.mock.On("FindByName", ctx, name)}
1333+}
1334+
1335+func (_c *MockTagRepository_FindByName_Call) Run(run func(ctx context.Context, name string)) *MockTagRepository_FindByName_Call {
1336+ _c.Call.Run(func(args mock.Arguments) {
1337+ var arg0 context.Context
1338+ if args[0] != nil {
1339+ arg0 = args[0].(context.Context)
1340+ }
1341+ var arg1 string
1342+ if args[1] != nil {
1343+ arg1 = args[1].(string)
1344+ }
1345+ run(
1346+ arg0,
1347+ arg1,
1348+ )
1349+ })
1350+ return _c
1351+}
1352+
1353+func (_c *MockTagRepository_FindByName_Call) Return(tag *entity.Tag, err error) *MockTagRepository_FindByName_Call {
1354+ _c.Call.Return(tag, err)
1355+ return _c
1356+}
1357+
1358+func (_c *MockTagRepository_FindByName_Call) RunAndReturn(run func(ctx context.Context, name string) (*entity.Tag, error)) *MockTagRepository_FindByName_Call {
1359+ _c.Call.Return(run)
1360+ return _c
1361+}
1362+
1363+// GetAll provides a mock function for the type MockTagRepository
1364+func (_mock *MockTagRepository) GetAll(ctx context.Context) ([]*entity.Tag, error) {
1365+ ret := _mock.Called(ctx)
1366+
1367+ if len(ret) == 0 {
1368+ panic("no return value specified for GetAll")
1369+ }
1370+
1371+ var r0 []*entity.Tag
1372+ var r1 error
1373+ if returnFunc, ok := ret.Get(0).(func(context.Context) ([]*entity.Tag, error)); ok {
1374+ return returnFunc(ctx)
1375+ }
1376+ if returnFunc, ok := ret.Get(0).(func(context.Context) []*entity.Tag); ok {
1377+ r0 = returnFunc(ctx)
1378+ } else {
1379+ if ret.Get(0) != nil {
1380+ r0 = ret.Get(0).([]*entity.Tag)
1381+ }
1382+ }
1383+ if returnFunc, ok := ret.Get(1).(func(context.Context) error); ok {
1384+ r1 = returnFunc(ctx)
1385+ } else {
1386+ r1 = ret.Error(1)
1387+ }
1388+ return r0, r1
1389+}
1390+
1391+// MockTagRepository_GetAll_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetAll'
1392+type MockTagRepository_GetAll_Call struct {
1393+ *mock.Call
1394+}
1395+
1396+// GetAll is a helper method to define mock.On call
1397+// - ctx context.Context
1398+func (_e *MockTagRepository_Expecter) GetAll(ctx any) *MockTagRepository_GetAll_Call {
1399+ return &MockTagRepository_GetAll_Call{Call: _e.mock.On("GetAll", ctx)}
1400+}
1401+
1402+func (_c *MockTagRepository_GetAll_Call) Run(run func(ctx context.Context)) *MockTagRepository_GetAll_Call {
1403+ _c.Call.Run(func(args mock.Arguments) {
1404+ var arg0 context.Context
1405+ if args[0] != nil {
1406+ arg0 = args[0].(context.Context)
1407+ }
1408+ run(
1409+ arg0,
1410+ )
1411+ })
1412+ return _c
1413+}
1414+
1415+func (_c *MockTagRepository_GetAll_Call) Return(tags []*entity.Tag, err error) *MockTagRepository_GetAll_Call {
1416+ _c.Call.Return(tags, err)
1417+ return _c
1418+}
1419+
1420+func (_c *MockTagRepository_GetAll_Call) RunAndReturn(run func(ctx context.Context) ([]*entity.Tag, error)) *MockTagRepository_GetAll_Call {
1421+ _c.Call.Return(run)
1422+ return _c
1423+}
1424+
1425+// GetForFavorite provides a mock function for the type MockTagRepository
1426+func (_mock *MockTagRepository) GetForFavorite(ctx context.Context, favID entity.FavoriteID) ([]*entity.Tag, error) {
1427+ ret := _mock.Called(ctx, favID)
1428+
1429+ if len(ret) == 0 {
1430+ panic("no return value specified for GetForFavorite")
1431+ }
1432+
1433+ var r0 []*entity.Tag
1434+ var r1 error
1435+ if returnFunc, ok := ret.Get(0).(func(context.Context, entity.FavoriteID) ([]*entity.Tag, error)); ok {
1436+ return returnFunc(ctx, favID)
1437+ }
1438+ if returnFunc, ok := ret.Get(0).(func(context.Context, entity.FavoriteID) []*entity.Tag); ok {
1439+ r0 = returnFunc(ctx, favID)
1440+ } else {
1441+ if ret.Get(0) != nil {
1442+ r0 = ret.Get(0).([]*entity.Tag)
1443+ }
1444+ }
1445+ if returnFunc, ok := ret.Get(1).(func(context.Context, entity.FavoriteID) error); ok {
1446+ r1 = returnFunc(ctx, favID)
1447+ } else {
1448+ r1 = ret.Error(1)
1449+ }
1450+ return r0, r1
1451+}
1452+
1453+// MockTagRepository_GetForFavorite_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetForFavorite'
1454+type MockTagRepository_GetForFavorite_Call struct {
1455+ *mock.Call
1456+}
1457+
1458+// GetForFavorite is a helper method to define mock.On call
1459+// - ctx context.Context
1460+// - favID entity.FavoriteID
1461+func (_e *MockTagRepository_Expecter) GetForFavorite(ctx any, favID any) *MockTagRepository_GetForFavorite_Call {
1462+ return &MockTagRepository_GetForFavorite_Call{Call: _e.mock.On("GetForFavorite", ctx, favID)}
1463+}
1464+
1465+func (_c *MockTagRepository_GetForFavorite_Call) Run(run func(ctx context.Context, favID entity.FavoriteID)) *MockTagRepository_GetForFavorite_Call {
1466+ _c.Call.Run(func(args mock.Arguments) {
1467+ var arg0 context.Context
1468+ if args[0] != nil {
1469+ arg0 = args[0].(context.Context)
1470+ }
1471+ var arg1 entity.FavoriteID
1472+ if args[1] != nil {
1473+ arg1 = args[1].(entity.FavoriteID)
1474+ }
1475+ run(
1476+ arg0,
1477+ arg1,
1478+ )
1479+ })
1480+ return _c
1481+}
1482+
1483+func (_c *MockTagRepository_GetForFavorite_Call) Return(tags []*entity.Tag, err error) *MockTagRepository_GetForFavorite_Call {
1484+ _c.Call.Return(tags, err)
1485+ return _c
1486+}
1487+
1488+func (_c *MockTagRepository_GetForFavorite_Call) RunAndReturn(run func(ctx context.Context, favID entity.FavoriteID) ([]*entity.Tag, error)) *MockTagRepository_GetForFavorite_Call {
1489+ _c.Call.Return(run)
1490+ return _c
1491+}
1492+
1493+// RemoveFromFavorite provides a mock function for the type MockTagRepository
1494+func (_mock *MockTagRepository) RemoveFromFavorite(ctx context.Context, tagID entity.TagID, favID entity.FavoriteID) error {
1495+ ret := _mock.Called(ctx, tagID, favID)
1496+
1497+ if len(ret) == 0 {
1498+ panic("no return value specified for RemoveFromFavorite")
1499+ }
1500+
1501+ var r0 error
1502+ if returnFunc, ok := ret.Get(0).(func(context.Context, entity.TagID, entity.FavoriteID) error); ok {
1503+ r0 = returnFunc(ctx, tagID, favID)
1504+ } else {
1505+ r0 = ret.Error(0)
1506+ }
1507+ return r0
1508+}
1509+
1510+// MockTagRepository_RemoveFromFavorite_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'RemoveFromFavorite'
1511+type MockTagRepository_RemoveFromFavorite_Call struct {
1512+ *mock.Call
1513+}
1514+
1515+// RemoveFromFavorite is a helper method to define mock.On call
1516+// - ctx context.Context
1517+// - tagID entity.TagID
1518+// - favID entity.FavoriteID
1519+func (_e *MockTagRepository_Expecter) RemoveFromFavorite(ctx any, tagID any, favID any) *MockTagRepository_RemoveFromFavorite_Call {
1520+ return &MockTagRepository_RemoveFromFavorite_Call{Call: _e.mock.On("RemoveFromFavorite", ctx, tagID, favID)}
1521+}
1522+
1523+func (_c *MockTagRepository_RemoveFromFavorite_Call) Run(run func(ctx context.Context, tagID entity.TagID, favID entity.FavoriteID)) *MockTagRepository_RemoveFromFavorite_Call {
1524+ _c.Call.Run(func(args mock.Arguments) {
1525+ var arg0 context.Context
1526+ if args[0] != nil {
1527+ arg0 = args[0].(context.Context)
1528+ }
1529+ var arg1 entity.TagID
1530+ if args[1] != nil {
1531+ arg1 = args[1].(entity.TagID)
1532+ }
1533+ var arg2 entity.FavoriteID
1534+ if args[2] != nil {
1535+ arg2 = args[2].(entity.FavoriteID)
1536+ }
1537+ run(
1538+ arg0,
1539+ arg1,
1540+ arg2,
1541+ )
1542+ })
1543+ return _c
1544+}
1545+
1546+func (_c *MockTagRepository_RemoveFromFavorite_Call) Return(err error) *MockTagRepository_RemoveFromFavorite_Call {
1547+ _c.Call.Return(err)
1548+ return _c
1549+}
1550+
1551+func (_c *MockTagRepository_RemoveFromFavorite_Call) RunAndReturn(run func(ctx context.Context, tagID entity.TagID, favID entity.FavoriteID) error) *MockTagRepository_RemoveFromFavorite_Call {
1552+ _c.Call.Return(run)
1553+ return _c
1554+}
1555+
1556+// Save provides a mock function for the type MockTagRepository
1557+func (_mock *MockTagRepository) Save(ctx context.Context, tag *entity.Tag) error {
1558+ ret := _mock.Called(ctx, tag)
1559+
1560+ if len(ret) == 0 {
1561+ panic("no return value specified for Save")
1562+ }
1563+
1564+ var r0 error
1565+ if returnFunc, ok := ret.Get(0).(func(context.Context, *entity.Tag) error); ok {
1566+ r0 = returnFunc(ctx, tag)
1567+ } else {
1568+ r0 = ret.Error(0)
1569+ }
1570+ return r0
1571+}
1572+
1573+// MockTagRepository_Save_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Save'
1574+type MockTagRepository_Save_Call struct {
1575+ *mock.Call
1576+}
1577+
1578+// Save is a helper method to define mock.On call
1579+// - ctx context.Context
1580+// - tag *entity.Tag
1581+func (_e *MockTagRepository_Expecter) Save(ctx any, tag any) *MockTagRepository_Save_Call {
1582+ return &MockTagRepository_Save_Call{Call: _e.mock.On("Save", ctx, tag)}
1583+}
1584+
1585+func (_c *MockTagRepository_Save_Call) Run(run func(ctx context.Context, tag *entity.Tag)) *MockTagRepository_Save_Call {
1586+ _c.Call.Run(func(args mock.Arguments) {
1587+ var arg0 context.Context
1588+ if args[0] != nil {
1589+ arg0 = args[0].(context.Context)
1590+ }
1591+ var arg1 *entity.Tag
1592+ if args[1] != nil {
1593+ arg1 = args[1].(*entity.Tag)
1594+ }
1595+ run(
1596+ arg0,
1597+ arg1,
1598+ )
1599+ })
1600+ return _c
1601+}
1602+
1603+func (_c *MockTagRepository_Save_Call) Return(err error) *MockTagRepository_Save_Call {
1604+ _c.Call.Return(err)
1605+ return _c
1606+}
1607+
1608+func (_c *MockTagRepository_Save_Call) RunAndReturn(run func(ctx context.Context, tag *entity.Tag) error) *MockTagRepository_Save_Call {
1609+ _c.Call.Return(run)
1610+ return _c
1611+}
A internal/domain/repository/mocks/filter.go +280 -0
@@ -0,0 +1,280 @@
1+// Code generated by mockery; DO NOT EDIT.
2+// github.com/vektra/mockery
3+// template: testify
4+
5+package mocks
6+
7+import (
8+ "context"
9+
10+ mock "github.com/stretchr/testify/mock"
11+)
12+
13+// NewMockContentWhitelistRepository creates a new instance of MockContentWhitelistRepository. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
14+// The first argument is typically a *testing.T value.
15+func NewMockContentWhitelistRepository(t interface {
16+ mock.TestingT
17+ Cleanup(func())
18+}) *MockContentWhitelistRepository {
19+ mock := &MockContentWhitelistRepository{}
20+ mock.Mock.Test(t)
21+
22+ t.Cleanup(func() { mock.AssertExpectations(t) })
23+
24+ return mock
25+}
26+
27+// MockContentWhitelistRepository is an autogenerated mock type for the ContentWhitelistRepository type
28+type MockContentWhitelistRepository struct {
29+ mock.Mock
30+}
31+
32+type MockContentWhitelistRepository_Expecter struct {
33+ mock *mock.Mock
34+}
35+
36+func (_m *MockContentWhitelistRepository) EXPECT() *MockContentWhitelistRepository_Expecter {
37+ return &MockContentWhitelistRepository_Expecter{mock: &_m.Mock}
38+}
39+
40+// Add provides a mock function for the type MockContentWhitelistRepository
41+func (_mock *MockContentWhitelistRepository) Add(ctx context.Context, domain string) error {
42+ ret := _mock.Called(ctx, domain)
43+
44+ if len(ret) == 0 {
45+ panic("no return value specified for Add")
46+ }
47+
48+ var r0 error
49+ if returnFunc, ok := ret.Get(0).(func(context.Context, string) error); ok {
50+ r0 = returnFunc(ctx, domain)
51+ } else {
52+ r0 = ret.Error(0)
53+ }
54+ return r0
55+}
56+
57+// MockContentWhitelistRepository_Add_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Add'
58+type MockContentWhitelistRepository_Add_Call struct {
59+ *mock.Call
60+}
61+
62+// Add is a helper method to define mock.On call
63+// - ctx context.Context
64+// - domain string
65+func (_e *MockContentWhitelistRepository_Expecter) Add(ctx any, domain any) *MockContentWhitelistRepository_Add_Call {
66+ return &MockContentWhitelistRepository_Add_Call{Call: _e.mock.On("Add", ctx, domain)}
67+}
68+
69+func (_c *MockContentWhitelistRepository_Add_Call) Run(run func(ctx context.Context, domain string)) *MockContentWhitelistRepository_Add_Call {
70+ _c.Call.Run(func(args mock.Arguments) {
71+ var arg0 context.Context
72+ if args[0] != nil {
73+ arg0 = args[0].(context.Context)
74+ }
75+ var arg1 string
76+ if args[1] != nil {
77+ arg1 = args[1].(string)
78+ }
79+ run(
80+ arg0,
81+ arg1,
82+ )
83+ })
84+ return _c
85+}
86+
87+func (_c *MockContentWhitelistRepository_Add_Call) Return(err error) *MockContentWhitelistRepository_Add_Call {
88+ _c.Call.Return(err)
89+ return _c
90+}
91+
92+func (_c *MockContentWhitelistRepository_Add_Call) RunAndReturn(run func(ctx context.Context, domain string) error) *MockContentWhitelistRepository_Add_Call {
93+ _c.Call.Return(run)
94+ return _c
95+}
96+
97+// Contains provides a mock function for the type MockContentWhitelistRepository
98+func (_mock *MockContentWhitelistRepository) Contains(ctx context.Context, domain string) (bool, error) {
99+ ret := _mock.Called(ctx, domain)
100+
101+ if len(ret) == 0 {
102+ panic("no return value specified for Contains")
103+ }
104+
105+ var r0 bool
106+ var r1 error
107+ if returnFunc, ok := ret.Get(0).(func(context.Context, string) (bool, error)); ok {
108+ return returnFunc(ctx, domain)
109+ }
110+ if returnFunc, ok := ret.Get(0).(func(context.Context, string) bool); ok {
111+ r0 = returnFunc(ctx, domain)
112+ } else {
113+ r0 = ret.Get(0).(bool)
114+ }
115+ if returnFunc, ok := ret.Get(1).(func(context.Context, string) error); ok {
116+ r1 = returnFunc(ctx, domain)
117+ } else {
118+ r1 = ret.Error(1)
119+ }
120+ return r0, r1
121+}
122+
123+// MockContentWhitelistRepository_Contains_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Contains'
124+type MockContentWhitelistRepository_Contains_Call struct {
125+ *mock.Call
126+}
127+
128+// Contains is a helper method to define mock.On call
129+// - ctx context.Context
130+// - domain string
131+func (_e *MockContentWhitelistRepository_Expecter) Contains(ctx any, domain any) *MockContentWhitelistRepository_Contains_Call {
132+ return &MockContentWhitelistRepository_Contains_Call{Call: _e.mock.On("Contains", ctx, domain)}
133+}
134+
135+func (_c *MockContentWhitelistRepository_Contains_Call) Run(run func(ctx context.Context, domain string)) *MockContentWhitelistRepository_Contains_Call {
136+ _c.Call.Run(func(args mock.Arguments) {
137+ var arg0 context.Context
138+ if args[0] != nil {
139+ arg0 = args[0].(context.Context)
140+ }
141+ var arg1 string
142+ if args[1] != nil {
143+ arg1 = args[1].(string)
144+ }
145+ run(
146+ arg0,
147+ arg1,
148+ )
149+ })
150+ return _c
151+}
152+
153+func (_c *MockContentWhitelistRepository_Contains_Call) Return(b bool, err error) *MockContentWhitelistRepository_Contains_Call {
154+ _c.Call.Return(b, err)
155+ return _c
156+}
157+
158+func (_c *MockContentWhitelistRepository_Contains_Call) RunAndReturn(run func(ctx context.Context, domain string) (bool, error)) *MockContentWhitelistRepository_Contains_Call {
159+ _c.Call.Return(run)
160+ return _c
161+}
162+
163+// GetAll provides a mock function for the type MockContentWhitelistRepository
164+func (_mock *MockContentWhitelistRepository) GetAll(ctx context.Context) ([]string, error) {
165+ ret := _mock.Called(ctx)
166+
167+ if len(ret) == 0 {
168+ panic("no return value specified for GetAll")
169+ }
170+
171+ var r0 []string
172+ var r1 error
173+ if returnFunc, ok := ret.Get(0).(func(context.Context) ([]string, error)); ok {
174+ return returnFunc(ctx)
175+ }
176+ if returnFunc, ok := ret.Get(0).(func(context.Context) []string); ok {
177+ r0 = returnFunc(ctx)
178+ } else {
179+ if ret.Get(0) != nil {
180+ r0 = ret.Get(0).([]string)
181+ }
182+ }
183+ if returnFunc, ok := ret.Get(1).(func(context.Context) error); ok {
184+ r1 = returnFunc(ctx)
185+ } else {
186+ r1 = ret.Error(1)
187+ }
188+ return r0, r1
189+}
190+
191+// MockContentWhitelistRepository_GetAll_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetAll'
192+type MockContentWhitelistRepository_GetAll_Call struct {
193+ *mock.Call
194+}
195+
196+// GetAll is a helper method to define mock.On call
197+// - ctx context.Context
198+func (_e *MockContentWhitelistRepository_Expecter) GetAll(ctx any) *MockContentWhitelistRepository_GetAll_Call {
199+ return &MockContentWhitelistRepository_GetAll_Call{Call: _e.mock.On("GetAll", ctx)}
200+}
201+
202+func (_c *MockContentWhitelistRepository_GetAll_Call) Run(run func(ctx context.Context)) *MockContentWhitelistRepository_GetAll_Call {
203+ _c.Call.Run(func(args mock.Arguments) {
204+ var arg0 context.Context
205+ if args[0] != nil {
206+ arg0 = args[0].(context.Context)
207+ }
208+ run(
209+ arg0,
210+ )
211+ })
212+ return _c
213+}
214+
215+func (_c *MockContentWhitelistRepository_GetAll_Call) Return(strings []string, err error) *MockContentWhitelistRepository_GetAll_Call {
216+ _c.Call.Return(strings, err)
217+ return _c
218+}
219+
220+func (_c *MockContentWhitelistRepository_GetAll_Call) RunAndReturn(run func(ctx context.Context) ([]string, error)) *MockContentWhitelistRepository_GetAll_Call {
221+ _c.Call.Return(run)
222+ return _c
223+}
224+
225+// Remove provides a mock function for the type MockContentWhitelistRepository
226+func (_mock *MockContentWhitelistRepository) Remove(ctx context.Context, domain string) error {
227+ ret := _mock.Called(ctx, domain)
228+
229+ if len(ret) == 0 {
230+ panic("no return value specified for Remove")
231+ }
232+
233+ var r0 error
234+ if returnFunc, ok := ret.Get(0).(func(context.Context, string) error); ok {
235+ r0 = returnFunc(ctx, domain)
236+ } else {
237+ r0 = ret.Error(0)
238+ }
239+ return r0
240+}
241+
242+// MockContentWhitelistRepository_Remove_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Remove'
243+type MockContentWhitelistRepository_Remove_Call struct {
244+ *mock.Call
245+}
246+
247+// Remove is a helper method to define mock.On call
248+// - ctx context.Context
249+// - domain string
250+func (_e *MockContentWhitelistRepository_Expecter) Remove(ctx any, domain any) *MockContentWhitelistRepository_Remove_Call {
251+ return &MockContentWhitelistRepository_Remove_Call{Call: _e.mock.On("Remove", ctx, domain)}
252+}
253+
254+func (_c *MockContentWhitelistRepository_Remove_Call) Run(run func(ctx context.Context, domain string)) *MockContentWhitelistRepository_Remove_Call {
255+ _c.Call.Run(func(args mock.Arguments) {
256+ var arg0 context.Context
257+ if args[0] != nil {
258+ arg0 = args[0].(context.Context)
259+ }
260+ var arg1 string
261+ if args[1] != nil {
262+ arg1 = args[1].(string)
263+ }
264+ run(
265+ arg0,
266+ arg1,
267+ )
268+ })
269+ return _c
270+}
271+
272+func (_c *MockContentWhitelistRepository_Remove_Call) Return(err error) *MockContentWhitelistRepository_Remove_Call {
273+ _c.Call.Return(err)
274+ return _c
275+}
276+
277+func (_c *MockContentWhitelistRepository_Remove_Call) RunAndReturn(run func(ctx context.Context, domain string) error) *MockContentWhitelistRepository_Remove_Call {
278+ _c.Call.Return(run)
279+ return _c
280+}
A internal/domain/repository/mocks/history.go +1541 -0 collapsed to keep the page light
D internal/domain/repository/mocks/mocks.go +0 -4545 large diff (4545 lines changed): collapsed
A internal/domain/repository/mocks/session.go +547 -0
@@ -0,0 +1,547 @@
1+// Code generated by mockery; DO NOT EDIT.
2+// github.com/vektra/mockery
3+// template: testify
4+
5+package mocks
6+
7+import (
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.
17+func 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
30+type MockSessionRepository struct {
31+ mock.Mock
32+}
33+
34+type MockSessionRepository_Expecter struct {
35+ mock *mock.Mock
36+}
37+
38+func (_m *MockSessionRepository) EXPECT() *MockSessionRepository_Expecter {
39+ return &MockSessionRepository_Expecter{mock: &_m.Mock}
40+}
41+
42+// Delete provides a mock function for the type MockSessionRepository
43+func (_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'
60+type 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
67+func (_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+
71+func (_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+
89+func (_c *MockSessionRepository_Delete_Call) Return(err error) *MockSessionRepository_Delete_Call {
90+ _c.Call.Return(err)
91+ return _c
92+}
93+
94+func (_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
100+func (_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'
126+type 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
133+func (_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+
137+func (_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+
155+func (_c *MockSessionRepository_DeleteExitedBefore_Call) Return(n int64, err error) *MockSessionRepository_DeleteExitedBefore_Call {
156+ _c.Call.Return(n, err)
157+ return _c
158+}
159+
160+func (_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
166+func (_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'
192+type 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
199+func (_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+
203+func (_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+
221+func (_c *MockSessionRepository_DeleteOldestExited_Call) Return(n int64, err error) *MockSessionRepository_DeleteOldestExited_Call {
222+ _c.Call.Return(n, err)
223+ return _c
224+}
225+
226+func (_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
232+func (_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'
260+type 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
267+func (_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+
271+func (_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+
289+func (_c *MockSessionRepository_FindByID_Call) Return(session *entity.Session, err error) *MockSessionRepository_FindByID_Call {
290+ _c.Call.Return(session, err)
291+ return _c
292+}
293+
294+func (_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
300+func (_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'
328+type MockSessionRepository_GetActive_Call struct {
329+ *mock.Call
330+}
331+
332+// GetActive is a helper method to define mock.On call
333+// - ctx context.Context
334+func (_e *MockSessionRepository_Expecter) GetActive(ctx any) *MockSessionRepository_GetActive_Call {
335+ return &MockSessionRepository_GetActive_Call{Call: _e.mock.On("GetActive", ctx)}
336+}
337+
338+func (_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+
351+func (_c *MockSessionRepository_GetActive_Call) Return(session *entity.Session, err error) *MockSessionRepository_GetActive_Call {
352+ _c.Call.Return(session, err)
353+ return _c
354+}
355+
356+func (_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
362+func (_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'
390+type 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
397+func (_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+
401+func (_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+
419+func (_c *MockSessionRepository_GetRecent_Call) Return(sessions []*entity.Session, err error) *MockSessionRepository_GetRecent_Call {
420+ _c.Call.Return(sessions, err)
421+ return _c
422+}
423+
424+func (_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
430+func (_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'
447+type 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
455+func (_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+
459+func (_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+
482+func (_c *MockSessionRepository_MarkEnded_Call) Return(err error) *MockSessionRepository_MarkEnded_Call {
483+ _c.Call.Return(err)
484+ return _c
485+}
486+
487+func (_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
493+func (_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'
510+type 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
517+func (_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+
521+func (_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+
539+func (_c *MockSessionRepository_Save_Call) Return(err error) *MockSessionRepository_Save_Call {
540+ _c.Call.Return(err)
541+ return _c
542+}
543+
544+func (_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+}
A internal/domain/repository/mocks/session_state.go +343 -0 collapsed to keep the page light
A internal/domain/repository/mocks/zoom.go +283 -0
@@ -0,0 +1,283 @@
1+// Code generated by mockery; DO NOT EDIT.
2+// github.com/vektra/mockery
3+// template: testify
4+
5+package mocks
6+
7+import (
8+ "context"
9+
10+ "github.com/bnema/dumber/internal/domain/entity"
11+ mock "github.com/stretchr/testify/mock"
12+)
13+
14+// NewMockZoomRepository creates a new instance of MockZoomRepository. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
15+// The first argument is typically a *testing.T value.
16+func NewMockZoomRepository(t interface {
17+ mock.TestingT
18+ Cleanup(func())
19+}) *MockZoomRepository {
20+ mock := &MockZoomRepository{}
21+ mock.Mock.Test(t)
22+
23+ t.Cleanup(func() { mock.AssertExpectations(t) })
24+
25+ return mock
26+}
27+
28+// MockZoomRepository is an autogenerated mock type for the ZoomRepository type
29+type MockZoomRepository struct {
30+ mock.Mock
31+}
32+
33+type MockZoomRepository_Expecter struct {
34+ mock *mock.Mock
35+}
36+
37+func (_m *MockZoomRepository) EXPECT() *MockZoomRepository_Expecter {
38+ return &MockZoomRepository_Expecter{mock: &_m.Mock}
39+}
40+
41+// Delete provides a mock function for the type MockZoomRepository
42+func (_mock *MockZoomRepository) Delete(ctx context.Context, domain string) error {
43+ ret := _mock.Called(ctx, domain)
44+
45+ if len(ret) == 0 {
46+ panic("no return value specified for Delete")
47+ }
48+
49+ var r0 error
50+ if returnFunc, ok := ret.Get(0).(func(context.Context, string) error); ok {
51+ r0 = returnFunc(ctx, domain)
52+ } else {
53+ r0 = ret.Error(0)
54+ }
55+ return r0
56+}
57+
58+// MockZoomRepository_Delete_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Delete'
59+type MockZoomRepository_Delete_Call struct {
60+ *mock.Call
61+}
62+
63+// Delete is a helper method to define mock.On call
64+// - ctx context.Context
65+// - domain string
66+func (_e *MockZoomRepository_Expecter) Delete(ctx any, domain any) *MockZoomRepository_Delete_Call {
67+ return &MockZoomRepository_Delete_Call{Call: _e.mock.On("Delete", ctx, domain)}
68+}
69+
70+func (_c *MockZoomRepository_Delete_Call) Run(run func(ctx context.Context, domain string)) *MockZoomRepository_Delete_Call {
71+ _c.Call.Run(func(args mock.Arguments) {
72+ var arg0 context.Context
73+ if args[0] != nil {
74+ arg0 = args[0].(context.Context)
75+ }
76+ var arg1 string
77+ if args[1] != nil {
78+ arg1 = args[1].(string)
79+ }
80+ run(
81+ arg0,
82+ arg1,
83+ )
84+ })
85+ return _c
86+}
87+
88+func (_c *MockZoomRepository_Delete_Call) Return(err error) *MockZoomRepository_Delete_Call {
89+ _c.Call.Return(err)
90+ return _c
91+}
92+
93+func (_c *MockZoomRepository_Delete_Call) RunAndReturn(run func(ctx context.Context, domain string) error) *MockZoomRepository_Delete_Call {
94+ _c.Call.Return(run)
95+ return _c
96+}
97+
98+// Get provides a mock function for the type MockZoomRepository
99+func (_mock *MockZoomRepository) Get(ctx context.Context, domain string) (*entity.ZoomLevel, error) {
100+ ret := _mock.Called(ctx, domain)
101+
102+ if len(ret) == 0 {
103+ panic("no return value specified for Get")
104+ }
105+
106+ var r0 *entity.ZoomLevel
107+ var r1 error
108+ if returnFunc, ok := ret.Get(0).(func(context.Context, string) (*entity.ZoomLevel, error)); ok {
109+ return returnFunc(ctx, domain)
110+ }
111+ if returnFunc, ok := ret.Get(0).(func(context.Context, string) *entity.ZoomLevel); ok {
112+ r0 = returnFunc(ctx, domain)
113+ } else {
114+ if ret.Get(0) != nil {
115+ r0 = ret.Get(0).(*entity.ZoomLevel)
116+ }
117+ }
118+ if returnFunc, ok := ret.Get(1).(func(context.Context, string) error); ok {
119+ r1 = returnFunc(ctx, domain)
120+ } else {
121+ r1 = ret.Error(1)
122+ }
123+ return r0, r1
124+}
125+
126+// MockZoomRepository_Get_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Get'
127+type MockZoomRepository_Get_Call struct {
128+ *mock.Call
129+}
130+
131+// Get is a helper method to define mock.On call
132+// - ctx context.Context
133+// - domain string
134+func (_e *MockZoomRepository_Expecter) Get(ctx any, domain any) *MockZoomRepository_Get_Call {
135+ return &MockZoomRepository_Get_Call{Call: _e.mock.On("Get", ctx, domain)}
136+}
137+
138+func (_c *MockZoomRepository_Get_Call) Run(run func(ctx context.Context, domain string)) *MockZoomRepository_Get_Call {
139+ _c.Call.Run(func(args mock.Arguments) {
140+ var arg0 context.Context
141+ if args[0] != nil {
142+ arg0 = args[0].(context.Context)
143+ }
144+ var arg1 string
145+ if args[1] != nil {
146+ arg1 = args[1].(string)
147+ }
148+ run(
149+ arg0,
150+ arg1,
151+ )
152+ })
153+ return _c
154+}
155+
156+func (_c *MockZoomRepository_Get_Call) Return(zoomLevel *entity.ZoomLevel, err error) *MockZoomRepository_Get_Call {
157+ _c.Call.Return(zoomLevel, err)
158+ return _c
159+}
160+
161+func (_c *MockZoomRepository_Get_Call) RunAndReturn(run func(ctx context.Context, domain string) (*entity.ZoomLevel, error)) *MockZoomRepository_Get_Call {
162+ _c.Call.Return(run)
163+ return _c
164+}
165+
166+// GetAll provides a mock function for the type MockZoomRepository
167+func (_mock *MockZoomRepository) GetAll(ctx context.Context) ([]*entity.ZoomLevel, error) {
168+ ret := _mock.Called(ctx)
169+
170+ if len(ret) == 0 {
171+ panic("no return value specified for GetAll")
172+ }
173+
174+ var r0 []*entity.ZoomLevel
175+ var r1 error
176+ if returnFunc, ok := ret.Get(0).(func(context.Context) ([]*entity.ZoomLevel, error)); ok {
177+ return returnFunc(ctx)
178+ }
179+ if returnFunc, ok := ret.Get(0).(func(context.Context) []*entity.ZoomLevel); ok {
180+ r0 = returnFunc(ctx)
181+ } else {
182+ if ret.Get(0) != nil {
183+ r0 = ret.Get(0).([]*entity.ZoomLevel)
184+ }
185+ }
186+ if returnFunc, ok := ret.Get(1).(func(context.Context) error); ok {
187+ r1 = returnFunc(ctx)
188+ } else {
189+ r1 = ret.Error(1)
190+ }
191+ return r0, r1
192+}
193+
194+// MockZoomRepository_GetAll_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetAll'
195+type MockZoomRepository_GetAll_Call struct {
196+ *mock.Call
197+}
198+
199+// GetAll is a helper method to define mock.On call
200+// - ctx context.Context
201+func (_e *MockZoomRepository_Expecter) GetAll(ctx any) *MockZoomRepository_GetAll_Call {
202+ return &MockZoomRepository_GetAll_Call{Call: _e.mock.On("GetAll", ctx)}
203+}
204+
205+func (_c *MockZoomRepository_GetAll_Call) Run(run func(ctx context.Context)) *MockZoomRepository_GetAll_Call {
206+ _c.Call.Run(func(args mock.Arguments) {
207+ var arg0 context.Context
208+ if args[0] != nil {
209+ arg0 = args[0].(context.Context)
210+ }
211+ run(
212+ arg0,
213+ )
214+ })
215+ return _c
216+}
217+
218+func (_c *MockZoomRepository_GetAll_Call) Return(zoomLevels []*entity.ZoomLevel, err error) *MockZoomRepository_GetAll_Call {
219+ _c.Call.Return(zoomLevels, err)
220+ return _c
221+}
222+
223+func (_c *MockZoomRepository_GetAll_Call) RunAndReturn(run func(ctx context.Context) ([]*entity.ZoomLevel, error)) *MockZoomRepository_GetAll_Call {
224+ _c.Call.Return(run)
225+ return _c
226+}
227+
228+// Set provides a mock function for the type MockZoomRepository
229+func (_mock *MockZoomRepository) Set(ctx context.Context, level *entity.ZoomLevel) error {
230+ ret := _mock.Called(ctx, level)
231+
232+ if len(ret) == 0 {
233+ panic("no return value specified for Set")
234+ }
235+
236+ var r0 error
237+ if returnFunc, ok := ret.Get(0).(func(context.Context, *entity.ZoomLevel) error); ok {
238+ r0 = returnFunc(ctx, level)
239+ } else {
240+ r0 = ret.Error(0)
241+ }
242+ return r0
243+}
244+
245+// MockZoomRepository_Set_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Set'
246+type MockZoomRepository_Set_Call struct {
247+ *mock.Call
248+}
249+
250+// Set is a helper method to define mock.On call
251+// - ctx context.Context
252+// - level *entity.ZoomLevel
253+func (_e *MockZoomRepository_Expecter) Set(ctx any, level any) *MockZoomRepository_Set_Call {
254+ return &MockZoomRepository_Set_Call{Call: _e.mock.On("Set", ctx, level)}
255+}
256+
257+func (_c *MockZoomRepository_Set_Call) Run(run func(ctx context.Context, level *entity.ZoomLevel)) *MockZoomRepository_Set_Call {
258+ _c.Call.Run(func(args mock.Arguments) {
259+ var arg0 context.Context
260+ if args[0] != nil {
261+ arg0 = args[0].(context.Context)
262+ }
263+ var arg1 *entity.ZoomLevel
264+ if args[1] != nil {
265+ arg1 = args[1].(*entity.ZoomLevel)
266+ }
267+ run(
268+ arg0,
269+ arg1,
270+ )
271+ })
272+ return _c
273+}
274+
275+func (_c *MockZoomRepository_Set_Call) Return(err error) *MockZoomRepository_Set_Call {
276+ _c.Call.Return(err)
277+ return _c
278+}
279+
280+func (_c *MockZoomRepository_Set_Call) RunAndReturn(run func(ctx context.Context, level *entity.ZoomLevel) error) *MockZoomRepository_Set_Call {
281+ _c.Call.Return(run)
282+ return _c
283+}
A internal/infrastructure/audio/pipewire/mocks/player.go +257 -0
@@ -0,0 +1,257 @@
1+// Code generated by mockery; DO NOT EDIT.
2+// github.com/vektra/mockery
3+// template: testify
4+
5+package mocks
6+
7+import (
8+ "github.com/bnema/purego-pipewire/pipewire"
9+ mock "github.com/stretchr/testify/mock"
10+)
11+
12+// NewMockPlayer creates a new instance of MockPlayer. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
13+// The first argument is typically a *testing.T value.
14+func NewMockPlayer(t interface {
15+ mock.TestingT
16+ Cleanup(func())
17+}) *MockPlayer {
18+ mock := &MockPlayer{}
19+ mock.Mock.Test(t)
20+
21+ t.Cleanup(func() { mock.AssertExpectations(t) })
22+
23+ return mock
24+}
25+
26+// MockPlayer is an autogenerated mock type for the Player type
27+type MockPlayer struct {
28+ mock.Mock
29+}
30+
31+type MockPlayer_Expecter struct {
32+ mock *mock.Mock
33+}
34+
35+func (_m *MockPlayer) EXPECT() *MockPlayer_Expecter {
36+ return &MockPlayer_Expecter{mock: &_m.Mock}
37+}
38+
39+// Close provides a mock function for the type MockPlayer
40+func (_mock *MockPlayer) Close() error {
41+ ret := _mock.Called()
42+
43+ if len(ret) == 0 {
44+ panic("no return value specified for Close")
45+ }
46+
47+ var r0 error
48+ if returnFunc, ok := ret.Get(0).(func() error); ok {
49+ r0 = returnFunc()
50+ } else {
51+ r0 = ret.Error(0)
52+ }
53+ return r0
54+}
55+
56+// MockPlayer_Close_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Close'
57+type MockPlayer_Close_Call struct {
58+ *mock.Call
59+}
60+
61+// Close is a helper method to define mock.On call
62+func (_e *MockPlayer_Expecter) Close() *MockPlayer_Close_Call {
63+ return &MockPlayer_Close_Call{Call: _e.mock.On("Close")}
64+}
65+
66+func (_c *MockPlayer_Close_Call) Run(run func()) *MockPlayer_Close_Call {
67+ _c.Call.Run(func(args mock.Arguments) {
68+ run()
69+ })
70+ return _c
71+}
72+
73+func (_c *MockPlayer_Close_Call) Return(err error) *MockPlayer_Close_Call {
74+ _c.Call.Return(err)
75+ return _c
76+}
77+
78+func (_c *MockPlayer_Close_Call) RunAndReturn(run func() error) *MockPlayer_Close_Call {
79+ _c.Call.Return(run)
80+ return _c
81+}
82+
83+// Pause provides a mock function for the type MockPlayer
84+func (_mock *MockPlayer) Pause() error {
85+ ret := _mock.Called()
86+
87+ if len(ret) == 0 {
88+ panic("no return value specified for Pause")
89+ }
90+
91+ var r0 error
92+ if returnFunc, ok := ret.Get(0).(func() error); ok {
93+ r0 = returnFunc()
94+ } else {
95+ r0 = ret.Error(0)
96+ }
97+ return r0
98+}
99+
100+// MockPlayer_Pause_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Pause'
101+type MockPlayer_Pause_Call struct {
102+ *mock.Call
103+}
104+
105+// Pause is a helper method to define mock.On call
106+func (_e *MockPlayer_Expecter) Pause() *MockPlayer_Pause_Call {
107+ return &MockPlayer_Pause_Call{Call: _e.mock.On("Pause")}
108+}
109+
110+func (_c *MockPlayer_Pause_Call) Run(run func()) *MockPlayer_Pause_Call {
111+ _c.Call.Run(func(args mock.Arguments) {
112+ run()
113+ })
114+ return _c
115+}
116+
117+func (_c *MockPlayer_Pause_Call) Return(err error) *MockPlayer_Pause_Call {
118+ _c.Call.Return(err)
119+ return _c
120+}
121+
122+func (_c *MockPlayer_Pause_Call) RunAndReturn(run func() error) *MockPlayer_Pause_Call {
123+ _c.Call.Return(run)
124+ return _c
125+}
126+
127+// Start provides a mock function for the type MockPlayer
128+func (_mock *MockPlayer) Start() error {
129+ ret := _mock.Called()
130+
131+ if len(ret) == 0 {
132+ panic("no return value specified for Start")
133+ }
134+
135+ var r0 error
136+ if returnFunc, ok := ret.Get(0).(func() error); ok {
137+ r0 = returnFunc()
138+ } else {
139+ r0 = ret.Error(0)
140+ }
141+ return r0
142+}
143+
144+// MockPlayer_Start_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Start'
145+type MockPlayer_Start_Call struct {
146+ *mock.Call
147+}
148+
149+// Start is a helper method to define mock.On call
150+func (_e *MockPlayer_Expecter) Start() *MockPlayer_Start_Call {
151+ return &MockPlayer_Start_Call{Call: _e.mock.On("Start")}
152+}
153+
154+func (_c *MockPlayer_Start_Call) Run(run func()) *MockPlayer_Start_Call {
155+ _c.Call.Run(func(args mock.Arguments) {
156+ run()
157+ })
158+ return _c
159+}
160+
161+func (_c *MockPlayer_Start_Call) Return(err error) *MockPlayer_Start_Call {
162+ _c.Call.Return(err)
163+ return _c
164+}
165+
166+func (_c *MockPlayer_Start_Call) RunAndReturn(run func() error) *MockPlayer_Start_Call {
167+ _c.Call.Return(run)
168+ return _c
169+}
170+
171+// State provides a mock function for the type MockPlayer
172+func (_mock *MockPlayer) State() pipewire.PlayerState {
173+ ret := _mock.Called()
174+
175+ if len(ret) == 0 {
176+ panic("no return value specified for State")
177+ }
178+
179+ var r0 pipewire.PlayerState
180+ if returnFunc, ok := ret.Get(0).(func() pipewire.PlayerState); ok {
181+ r0 = returnFunc()
182+ } else {
183+ r0 = ret.Get(0).(pipewire.PlayerState)
184+ }
185+ return r0
186+}
187+
188+// MockPlayer_State_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'State'
189+type MockPlayer_State_Call struct {
190+ *mock.Call
191+}
192+
193+// State is a helper method to define mock.On call
194+func (_e *MockPlayer_Expecter) State() *MockPlayer_State_Call {
195+ return &MockPlayer_State_Call{Call: _e.mock.On("State")}
196+}
197+
198+func (_c *MockPlayer_State_Call) Run(run func()) *MockPlayer_State_Call {
199+ _c.Call.Run(func(args mock.Arguments) {
200+ run()
201+ })
202+ return _c
203+}
204+
205+func (_c *MockPlayer_State_Call) Return(playerState pipewire.PlayerState) *MockPlayer_State_Call {
206+ _c.Call.Return(playerState)
207+ return _c
208+}
209+
210+func (_c *MockPlayer_State_Call) RunAndReturn(run func() pipewire.PlayerState) *MockPlayer_State_Call {
211+ _c.Call.Return(run)
212+ return _c
213+}
214+
215+// Stop provides a mock function for the type MockPlayer
216+func (_mock *MockPlayer) Stop() error {
217+ ret := _mock.Called()
218+
219+ if len(ret) == 0 {
220+ panic("no return value specified for Stop")
221+ }
222+
223+ var r0 error
224+ if returnFunc, ok := ret.Get(0).(func() error); ok {
225+ r0 = returnFunc()
226+ } else {
227+ r0 = ret.Error(0)
228+ }
229+ return r0
230+}
231+
232+// MockPlayer_Stop_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Stop'
233+type MockPlayer_Stop_Call struct {
234+ *mock.Call
235+}
236+
237+// Stop is a helper method to define mock.On call
238+func (_e *MockPlayer_Expecter) Stop() *MockPlayer_Stop_Call {
239+ return &MockPlayer_Stop_Call{Call: _e.mock.On("Stop")}
240+}
241+
242+func (_c *MockPlayer_Stop_Call) Run(run func()) *MockPlayer_Stop_Call {
243+ _c.Call.Run(func(args mock.Arguments) {
244+ run()
245+ })
246+ return _c
247+}
248+
249+func (_c *MockPlayer_Stop_Call) Return(err error) *MockPlayer_Stop_Call {
250+ _c.Call.Return(err)
251+ return _c
252+}
253+
254+func (_c *MockPlayer_Stop_Call) RunAndReturn(run func() error) *MockPlayer_Stop_Call {
255+ _c.Call.Return(run)
256+ return _c
257+}
M internal/infrastructure/audio/pipewire/output_test.go +36 -21 collapsed to keep the page light
M internal/infrastructure/cef/engine.go +2 -1
@@ -15,6 +15,7 @@ import (
1515
1616 "github.com/bnema/dumber/internal/application/dto"
1717 "github.com/bnema/dumber/internal/application/port"
18+ "github.com/bnema/dumber/internal/domain/entity"
1819 "github.com/bnema/dumber/internal/logging"
1920 )
2021
@@ -355,7 +356,7 @@ func (e *Engine) UpdateAppearance(_ context.Context, r, g, b, alpha float64) err
355356 // existing views continue using their construction-time scale until reload under
356357 // a new engine lifetime. Browser zoom remains independently adjustable at
357358 // runtime through SetZoomLevel.
358-func (e *Engine) UpdateSettings(ctx context.Context, update port.EngineSettingsUpdate) error {
359+func (e *Engine) UpdateSettings(ctx context.Context, update entity.EngineSettingsUpdate) error {
359360 newScale := normalizedApplicationScale(update.Settings.DefaultUIScale)
360361 e.applicationScaleMu.Lock()
361362 oldScale := e.applicationScale
M internal/infrastructure/cef/engine_settings_test.go +8 -8
@@ -5,14 +5,14 @@ import (
55 "sync"
66 "testing"
77
8- "github.com/bnema/dumber/internal/application/port"
8+ "github.com/bnema/dumber/internal/domain/entity"
99 )
1010
1111 func TestEngineUpdateSettingsUpdatesApplicationScaleFromBoundaryPayload(t *testing.T) {
1212 e := &Engine{applicationScale: 1}
1313
14- if err := e.UpdateSettings(context.Background(), port.EngineSettingsUpdate{
15- Settings: port.EngineSettingsPayload{DefaultUIScale: 1.25},
14+ if err := e.UpdateSettings(context.Background(), entity.EngineSettingsUpdate{
15+ Settings: entity.EngineSettingsPayload{DefaultUIScale: 1.25},
1616 }); err != nil {
1717 t.Fatalf("UpdateSettings returned error: %v", err)
1818 }
@@ -21,10 +21,10 @@ func TestEngineUpdateSettingsUpdatesApplicationScaleFromBoundaryPayload(t *testi
2121 }
2222 }
2323
24-func TestEngineUpdateSettingsIgnoresLegacyRawForApplicationScale(t *testing.T) {
25- e := &Engine{applicationScale: 1}
24+func TestEngineUpdateSettingsUsesZeroScaleWhenPayloadIsEmpty(t *testing.T) {
25+ e := &Engine{applicationScale: 1.25}
2626
27- if err := e.UpdateSettings(context.Background(), port.EngineSettingsUpdate{Raw: "wrong"}); err != nil {
27+ if err := e.UpdateSettings(context.Background(), entity.EngineSettingsUpdate{}); err != nil {
2828 t.Fatalf("UpdateSettings returned error: %v", err)
2929 }
3030 if got := e.currentApplicationScale(); got != 1 {
@@ -43,8 +43,8 @@ func TestEngineApplicationScaleConcurrentAccess(_ *testing.T) {
4343 }()
4444 go func(scale float64) {
4545 defer wg.Done()
46- _ = e.UpdateSettings(context.Background(), port.EngineSettingsUpdate{
47- Settings: port.EngineSettingsPayload{DefaultUIScale: scale},
46+ _ = e.UpdateSettings(context.Background(), entity.EngineSettingsUpdate{
47+ Settings: entity.EngineSettingsPayload{DefaultUIScale: scale},
4848 })
4949 }(1 + float64(i)/10)
5050 }
M internal/infrastructure/cef/popup_opener_bridge_test.go +1 -1
@@ -66,6 +66,6 @@ func TestHandlePopupOpenerPostMessage_UsesPopupCommittedURIForSourceMetadata(t *
6666 DataKind: "json",
6767 TargetOrigin: "https://app.example",
6868 SourceOrigin: "https://evil.example",
69- SourceHref: "https://evil.example/fake",
69+ SourceHref: "https://evil.example/decoy",
7070 })
7171 }
M internal/infrastructure/cef/webview.go +17 -0
@@ -1055,6 +1055,23 @@ func (wv *WebView) RunJavaScript(_ context.Context, script string) {
10551055 if wv.destroyed.Load() {
10561056 return
10571057 }
1058+ if wv.engine == nil {
1059+ wv.executeJavaScriptNow(script)
1060+ return
1061+ }
1062+ task := cefNewTask(cefTaskFunc(func() {
1063+ wv.executeJavaScriptNow(script)
1064+ }))
1065+ if task == nil {
1066+ return
1067+ }
1068+ cefPostTask(purecef.ThreadIDTidUi, task)
1069+}
1070+
1071+func (wv *WebView) executeJavaScriptNow(script string) {
1072+ if wv == nil || wv.destroyed.Load() {
1073+ return
1074+ }
10581075 wv.mu.RLock()
10591076 browser := wv.browser
10601077 wv.mu.RUnlock()
A internal/infrastructure/cef/webview_javascript_test.go +40 -0 collapsed to keep the page light
M internal/infrastructure/clipboard/clipboard_test.go +55 -37 collapsed to keep the page light
A internal/infrastructure/clipboard/mocks/clipboard.go +213 -0 collapsed to keep the page light
R internal/infrastructure/filtering/mocks/mocks.go → internal/infrastructure/filtering/mocks/interfaces.go +9 -9 collapsed to keep the page light · renamed, 95% similar
M internal/infrastructure/systemviewsbridge/client_test.go +46 -29 collapsed to keep the page light
A internal/infrastructure/systemviewsbridge/mocks/client.go +150 -0 collapsed to keep the page light
M internal/infrastructure/updater/applier_test.go +1 -1
@@ -122,7 +122,7 @@ func TestApplier_StageUpdate(t *testing.T) {
122122 applier := NewApplier(tmpDir)
123123 ctx := context.Background()
124124
125- // Create a fake binary to stage
125+ // Create a dummy binary to stage
126126 srcBinary := filepath.Join(tmpDir, "new-binary")
127127 binaryContent := []byte("#!/bin/sh\necho 'new version'\n")
128128 require.NoError(t, os.WriteFile(srcBinary, binaryContent, 0o755))
M internal/infrastructure/webkit/engine.go +3 -7
@@ -5,7 +5,7 @@ import (
55 "fmt"
66
77 "github.com/bnema/dumber/internal/application/port"
8- "github.com/bnema/dumber/internal/infrastructure/config"
8+ "github.com/bnema/dumber/internal/domain/entity"
99 "github.com/bnema/dumber/internal/infrastructure/filtering"
1010 "github.com/bnema/dumber/internal/infrastructure/handlers"
1111 "github.com/rs/zerolog"
@@ -156,13 +156,9 @@ func (e *Engine) UpdateAppearance(_ context.Context, r, g, b, alpha float64) err
156156 }
157157
158158 // UpdateSettings applies runtime config changes to engine settings.
159-func (e *Engine) UpdateSettings(ctx context.Context, update port.EngineSettingsUpdate) error {
160- cfg, ok := update.Raw.(*config.Config)
161- if !ok {
162- return fmt.Errorf("UpdateSettings: expected *config.Config, got %T", update.Raw)
163- }
159+func (e *Engine) UpdateSettings(ctx context.Context, update entity.EngineSettingsUpdate) error {
164160 if e.settings != nil {
165- e.settings.UpdateFromConfig(ctx, cfg)
161+ e.settings.UpdateFromPayload(ctx, update.Settings)
166162 }
167163 return nil
168164 }
M internal/infrastructure/webkit/engine_init.go +16 -4 collapsed to keep the page light
M internal/infrastructure/webkit/engine_runtime_test.go +41 -9 collapsed to keep the page light
M internal/infrastructure/webkit/pool.go +7 -0 collapsed to keep the page light
M internal/infrastructure/webkit/pool_context_menu_test.go +48 -1 collapsed to keep the page light
M internal/infrastructure/webkit/resolved_image_saver_test.go +17 -19 collapsed to keep the page light
M internal/infrastructure/webkit/scheme_handler.go +13 -2 collapsed to keep the page light
M internal/infrastructure/webkit/scheme_handler_test.go +54 -0 collapsed to keep the page light
M internal/infrastructure/webkit/settings.go +68 -50 collapsed to keep the page light
A internal/infrastructure/webkit/settings_runtime_test.go +124 -0 collapsed to keep the page light
M internal/ui/app.go +157 -116 collapsed to keep the page light
M internal/ui/app_browser_launch_test.go +175 -158 collapsed to keep the page light
M internal/ui/app_clipboard_test.go +16 -7 collapsed to keep the page light
M internal/ui/app_omnibox_config_test.go +27 -7 collapsed to keep the page light
M internal/ui/browser_window.go +6 -4 collapsed to keep the page light
M internal/ui/browser_window_history_sidebar.go +2 -2
@@ -127,10 +127,10 @@ func historySidebarWidthConfig(widthPx int) window.SidebarWidthConfig {
127127 // applySidebarWidthConfig applies the config-backed sidebar width to the
128128 // main window's sidebar.
129129 func (bw *browserWindow) applySidebarWidthConfig(a *App) {
130- if bw == nil || bw.mainWindow == nil || a == nil || a.deps == nil || a.deps.Config == nil {
130+ if bw == nil || bw.mainWindow == nil || a == nil {
131131 return
132132 }
133- bw.mainWindow.SetSidebarWidth(historySidebarWidthConfig(a.deps.Config.SidebarWidth))
133+ bw.mainWindow.SetSidebarWidth(historySidebarWidthConfig(a.runtimeConfigSnapshot().UI.SidebarWidth))
134134 }
135135
136136 // toggleHistorySidebarAction is the keyboard-action handler for toggling the
M internal/ui/browser_window_history_sidebar_test.go +39 -39 collapsed to keep the page light
M internal/ui/browser_window_test.go +13 -10 collapsed to keep the page light
M internal/ui/component/history_sidebar_search_test.go +26 -48 collapsed to keep the page light
M internal/ui/config_migration.go +3 -3 collapsed to keep the page light
M internal/ui/coordinator/content/popup.go +4 -0 collapsed to keep the page light
M internal/ui/coordinator/content/popup_manager.go +46 -12 collapsed to keep the page light
M internal/ui/coordinator/content/popup_test.go +22 -2 collapsed to keep the page light
A internal/ui/coordinator/mocks/navigation.go +118 -0 collapsed to keep the page light
M internal/ui/coordinator/navigation_test.go +8 -17 collapsed to keep the page light
M internal/ui/deps.go +6 -12 collapsed to keep the page light
A internal/ui/dialog/mocks/permission.go +96 -0 collapsed to keep the page light
M internal/ui/dialog/permission_test.go +31 -34 collapsed to keep the page light
M internal/ui/external_theme_reload_test.go +52 -4 collapsed to keep the page light
A internal/ui/layout/mocks/tree.go +91 -0 collapsed to keep the page light
R internal/ui/layout/mocks/mocks.go → internal/ui/layout/mocks/widgets.go +190 -271 collapsed to keep the page light · renamed, 94% similar
A internal/ui/runtime_config_state.go +41 -0 collapsed to keep the page light
A internal/ui/runtime_config_test.go +126 -0 collapsed to keep the page light
A internal/ui/runtime_config_test_helpers_test.go +35 -0 collapsed to keep the page light
M internal/ui/systemviews/app_test.go +98 -98 collapsed to keep the page light

Keyboard shortcuts

Single-key shortcuts are on. ctrl k and esc work whatever this says.

ctrl k :
go to a section, branch, tag, file or repository
?
this list
j k
move the row cursor down / up
enter
open the row under the cursor; on Files, a directory opens or closes in place
↑ ↓ ← → home end
in the file tree (focus on a row): previous / next row, close / open a directory or go to its parent / first entry, first / last row. They never open a file
l h
on Files: open a directory or a file / close a directory or go up to its parent, then to the parent page. Elsewhere: into the side panel (on a merge request, its files) / back to the content; there j k move between its controls
g g G
first / last row
/
filter the list; on Files, find a file anywhere in the repository (esc clears, enter opens the best match)
b
switch branch or tag
g s g f g c g b g m g i g r g a
tabs: summary, files, commits, branches & tags, merge requests, issues, releases, actions (when available)
g h
home
w
wide mode: use the whole width of the screen, or not (remembered)
y
copy a permalink pinned to the commit
d u x
diff: split / unified / collapse or expand all
e E
diff: the whole file in view / every file, with the lines the hunks hide
n
merge request: next note in the diff
esc
close a dialog, leave a field

Branches 8

Tags 42

↑↓ moveenter openesc close