Skip to content

Commit

Permalink
Update publisher_test.go
Browse files Browse the repository at this point in the history
  • Loading branch information
z4kn4fein committed Oct 30, 2024
1 parent 6ca7ffa commit fcdf106
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions pubsub/publisher_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,10 @@ func TestPubSub_Sub_Unsub(t *testing.T) {

sub := make(chan struct{})
pubSub.Subscribe(sub)
assert.NotEmpty(t, pubSub.subscriptions)
assert.NotNil(t, pubSub.subscriptions[sub])
utils.WaitUntil(2*time.Second, func() bool {
_, ok := pubSub.subscriptions[sub]
return ok
})

msg := struct{}{}
pubSub.Publish(msg)
Expand All @@ -28,5 +30,6 @@ func TestPubSub_Sub_Unsub(t *testing.T) {
pubSub.Close()
sub2 := make(chan struct{})
pubSub.Subscribe(sub2)
assert.Empty(t, pubSub.subscriptions)
_, ok := pubSub.subscriptions[sub2]
assert.False(t, ok)
}

0 comments on commit fcdf106

Please sign in to comment.