diff --git a/hub_test.go b/hub_test.go index cc90a84..457ddb2 100644 --- a/hub_test.go +++ b/hub_test.go @@ -11,19 +11,14 @@ func msg(s string) format.LogParts { } func hubCount(h Hub) int { - cl := Client{Options: ClientOptions{Nofollow: true, BacklogLength: -1}} - cl.Messages = make(chan format.LogParts) - h.Register <- cl - cnt := 0 - for range cl.Messages { - cnt++ - } - return cnt + return len(hubToArray(h)) } -func hubToArray(h Hub) []string { +var DefaultClient ClientOptions = ClientOptions{Nofollow: true, BacklogLength: -1} + +func hubToArrayOpt(h Hub, opt ClientOptions) []string { r := make([]string, 0) - cl := Client{Options: ClientOptions{Nofollow: true, BacklogLength: -1}} + cl := Client{Options: opt} cl.Messages = make(chan format.LogParts) h.Register <- cl for m := range cl.Messages { @@ -31,6 +26,9 @@ func hubToArray(h Hub) []string { } return r } +func hubToArray(h Hub) []string { + return hubToArrayOpt(h, DefaultClient) +} func TestSingle(t *testing.T) { h := NewHub(5)