generation-aware playback statuses
This commit is contained in:
@@ -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{
|
||||
|
||||
Reference in New Issue
Block a user