diff --git a/stream/messaging_test.go b/stream/messaging_test.go index b2845e2..f7141b2 100644 --- a/stream/messaging_test.go +++ b/stream/messaging_test.go @@ -16,7 +16,7 @@ func TestWithOneOutput(t *testing.T) { // Register one output output := make(chan []byte, 64) - stream.Register(output) + stream.Register(output, false) // Try to pass one message stream.Broadcast <- []byte("hello world") @@ -25,6 +25,16 @@ func TestWithOneOutput(t *testing.T) { t.Errorf("Message has wrong content: %s != hello world", msg) } + // Check client count + if count := stream.Count(); count != 1 { + t.Errorf("Client counter returned %d, expected 1", count) + } + // Unregister - stream.Unregister(output) + stream.Unregister(output, false) + + // Check client count + if count := stream.Count(); count != 0 { + t.Errorf("Client counter returned %d, expected 0", count) + } }