diff options
| author | Paul Buetow <paul@buetow.org> | 2026-05-19 19:23:50 +0300 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2026-05-19 19:23:50 +0300 |
| commit | 3779053951f338076fcc448daf9bee9ada18cf54 (patch) | |
| tree | 50bbb2ccb68d9eab90b0ffdd5897560daec0bd17 /player-server/internal/api/integration_test.go | |
| parent | 3ce06a482fafd884013c9a7a827d9ccb183a05da (diff) | |
Remove nil streamer fallback in api.serveFileResult (DIP)
The serveFileResult handler used to fabricate a default MediaStreamer at
request time when s.streamer was nil. That silently masked wiring
mistakes and violated the Dependency Inversion Principle — the handler
was inventing its own dependency instead of demanding one from the
caller. Removed the fallback so the handler now uses s.streamer directly.
Construction-time validation of deps.MediaStreamer was added to
api.NewServerWithLogger in commit 4215db6, which makes the runtime nil
case unreachable. Mirrors the explicit-deps pattern set in commits
622827c (http.Client in podcast service) and 92edb83 (TokenManager in
auth service).
Test helpers updated to inject a service.NewMediaStreamer(nil) when one
isn't otherwise supplied so the existing suite still constructs Servers
through the validating constructor.
Refs agent task 6a.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Diffstat (limited to 'player-server/internal/api/integration_test.go')
| -rw-r--r-- | player-server/internal/api/integration_test.go | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/player-server/internal/api/integration_test.go b/player-server/internal/api/integration_test.go index 2f51bd2..9344552 100644 --- a/player-server/internal/api/integration_test.go +++ b/player-server/internal/api/integration_test.go @@ -82,7 +82,8 @@ func newIntegrationServer(t *testing.T) *integrationEnv { Auth: authSvc, Podcast: &integrationPodcastService{}, }, - StaticFS: http.FS(staticFS), + StaticFS: http.FS(staticFS), + MediaStreamer: service.NewMediaStreamer(nil), }) if err != nil { t.Fatalf("NewServer: %v", err) |
