Add event management features to API, including event cancellation, deletion, registration closure, and workflow balance generation. Introduce new roster management endpoints and enhance participant handling with avoided player preferences. Update database schema and service logic to support these changes.
This commit is contained in:
27
backend/internal/realtime/hub_test.go
Normal file
27
backend/internal/realtime/hub_test.go
Normal file
@@ -0,0 +1,27 @@
|
||||
package realtime
|
||||
|
||||
import (
|
||||
"testing"
|
||||
"time"
|
||||
)
|
||||
|
||||
func TestHubPublishesToTopicAndWildcardSubscribers(t *testing.T) {
|
||||
hub := New()
|
||||
topic, cancelTopic := hub.Subscribe("series:s1")
|
||||
defer cancelTopic()
|
||||
all, cancelAll := hub.Subscribe("*")
|
||||
defer cancelAll()
|
||||
|
||||
hub.Publish("series:s1", map[string]int{"version": 2})
|
||||
|
||||
for name, channel := range map[string]<-chan Event{"topic": topic, "wildcard": all} {
|
||||
select {
|
||||
case event := <-channel:
|
||||
if event.Topic != "series:s1" || string(event.Data) != `{"version":2}` {
|
||||
t.Fatalf("%s subscriber received %#v", name, event)
|
||||
}
|
||||
case <-time.After(time.Second):
|
||||
t.Fatalf("%s subscriber did not receive update", name)
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user