feat: add public landing and live updates
This commit is contained in:
22
server/internal/httpapi/events_test.go
Normal file
22
server/internal/httpapi/events_test.go
Normal file
@@ -0,0 +1,22 @@
|
||||
package httpapi
|
||||
|
||||
import (
|
||||
"testing"
|
||||
"time"
|
||||
)
|
||||
|
||||
func TestEventHubPublishesToSubscribers(t *testing.T) {
|
||||
hub := newEventHub()
|
||||
updates, unsubscribe := hub.subscribe()
|
||||
defer unsubscribe()
|
||||
|
||||
hub.publish("devices")
|
||||
select {
|
||||
case event := <-updates:
|
||||
if event != "devices" {
|
||||
t.Fatalf("unexpected event %q", event)
|
||||
}
|
||||
case <-time.After(time.Second):
|
||||
t.Fatal("event was not published")
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user