From 05f54cc0cb8cf3535698ab5027d200842bdb28e3 Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Mon, 6 Apr 2026 11:06:19 +0300 Subject: refactor: consolidate provider factory test seams into shared named types Define audio.ProviderFactory, image.PromptAwareClient, image.OpenAIClientFactory, image.NanoBananaClientFactory, and image.ClientFactories as the single source of truth for the three injectable factory signatures that were previously duplicated across processor.Processor, gui.Application, and gui.GenerationOrchestrator. Replace all three separate function-type fields with imageFactories image.ClientFactories + newAudioProvider audio.ProviderFactory, eliminating the parallel field declarations and the local promptAwareImageClient interface in gui/generator.go. Co-Authored-By: Claude Sonnet 4.6 --- internal/processor/processor_test.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'internal/processor/processor_test.go') diff --git a/internal/processor/processor_test.go b/internal/processor/processor_test.go index 17b56e9..947f9d3 100644 --- a/internal/processor/processor_test.go +++ b/internal/processor/processor_test.go @@ -1058,7 +1058,7 @@ func TestDownloadImagesWithTranslationUsesNanoBananaConfigAndSavesPrompt(t *test ImageNanoBananaTextModelSet: true, } p := NewProcessor(flags, cfg) - p.newNanoBananaImageClient = func(config *image.NanoBananaConfig) image.ImageClient { + p.imageFactories.NewNanoBananaClient = func(config *image.NanoBananaConfig) image.PromptAwareClient { *capturedConfig = *config return stubSearcher } @@ -1102,7 +1102,7 @@ func TestDownloadImagesWithTranslationPersistsPromptWhenDownloadFails(t *testing flags.ImageAPISpecified = true p := NewProcessor(flags, &Config{ImageProvider: "nanobanana"}) - p.newNanoBananaImageClient = func(config *image.NanoBananaConfig) image.ImageClient { + p.imageFactories.NewNanoBananaClient = func(config *image.NanoBananaConfig) image.PromptAwareClient { return stubSearcher } err := p.downloadImagesWithTranslation(context.Background(), "ябълка", "apple") @@ -1144,7 +1144,7 @@ func TestDownloadImagesWithTranslationUsesConfiguredNanoBananaWhenImageAPINotSpe ImageNanoBananaTextModelSet: true, } p := NewProcessor(flags, cfg) - p.newNanoBananaImageClient = func(config *image.NanoBananaConfig) image.ImageClient { + p.imageFactories.NewNanoBananaClient = func(config *image.NanoBananaConfig) image.PromptAwareClient { *capturedConfig = *config return stubSearcher } @@ -1231,7 +1231,7 @@ func TestNewNanoBananaImageSearcherExplicitDefaultWinsOverConfig(t *testing.T) { ImageNanoBananaTextModelSet: true, } p := NewProcessor(flags, cfg) - p.newNanoBananaImageClient = func(config *image.NanoBananaConfig) image.ImageClient { + p.imageFactories.NewNanoBananaClient = func(config *image.NanoBananaConfig) image.PromptAwareClient { *capturedConfig = *config return &stubImageSearcher{} } -- cgit v1.2.3