mirror of
https://gitlab.crans.org/nounous/ghostream.git
synced 2024-12-22 15:02:19 +00:00
Test client count
This commit is contained in:
parent
5b8c73057b
commit
70798ce1df
@ -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)
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user