generation-aware playback statuses

This commit is contained in:
Dmitry Sergeev
2026-09-01 18:03:18 +03:00
parent 7a19fe0dad
commit 9bc08109fc
12 changed files with 210 additions and 41 deletions
+25
View File
@@ -116,6 +116,31 @@ func TestAudioWorkerRejectsInactiveFeed(t *testing.T) {
}
}
func TestAudioWorkerStatusesInheritGeneration(t *testing.T) {
openErr := errors.New("unavailable")
var statuses []Status
worker := newAudioWorkerForTest(
t,
&queuedAudioFactory{errs: []error{openErr}},
&fakeAudioSink{},
1,
func(error) bool { return true },
func(status Status) { statuses = append(statuses, status) },
)
_ = worker.Run(
withGeneration(context.Background(), 8),
FeedConfig{Domain: "/audio", UUID: "audio", Active: true},
)
if len(statuses) == 0 {
t.Fatal("no statuses emitted")
}
for _, status := range statuses {
if status.Generation != 8 {
t.Fatalf("status generation = %d, want 8: %+v", status.Generation, status)
}
}
}
func TestAudioWorkerPublishesPlayingThenFailed(t *testing.T) {
readErr := errors.New("audio disappeared")
reader := &fakeAudioReader{