Skip to content

Commit

Permalink
Improve rueidiscompat test coverage (#784)
Browse files Browse the repository at this point in the history
* Improve rueidiscompat test coverage

* Update tests to maintain the current style
  • Loading branch information
Beadko authored Feb 28, 2025
1 parent a4ede68 commit 83000d5
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions rueidiscompat/pubsub_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -472,3 +472,27 @@ var _ = Describe("PubSub", func() {
func bigVal() []byte {
return bytes.Repeat([]byte{'*'}, 1<<17) // 128kb
}

var _ = Describe("WithChannelSize", func() {
It("should set the channel size correctly", func() {
customSize := 500
cfg := &chopt{}
WithChannelSize(customSize)(cfg)

Expect(cfg.chanSize).To(Equal(customSize))
})
})

var _ = Describe("Subscription", func() {
It("should return the correct string representation", func() {
sub := &Subscription{Kind: "subscribe", Channel: "channel"}
Expect(sub.String()).To(Equal("subscribe: channel"))
})
})

var _ = Describe("Message", func() {
It("should return the correct string representation", func() {
m := &Message{Channel: "channel", Payload: "new"}
Expect(m.String()).To(Equal("Message<channel: new>"))
})
})

0 comments on commit 83000d5

Please sign in to comment.