Repository: redis/rueidis

Issue:
Need to improve the test coverage on rueidiscompat
Currently, we have poor test coverage on rueidiscompat:

<img width="1469" alt="image" src="https://github.com/user-attachments/assets/87b1d93f-7a30-443b-9572-0ed1b91a3409">


Details of which lines are not covered can be found here: https://app.codecov.io/gh/redis/rueidis/tree/main/rueidiscompat

We hope that we can improve the coverage to be close to 100%.

Discussion:
@mingdaoy: Hi @rueian, I'd be happy to work on this!@rueian: Hi @mingdaoy, thank you! You can just send PRs whenever you make any small improvements to the coverage.@guibes: @rueian maybe I can take this one?@rueian: > [@rueian](https://github.com/rueian) maybe I can take this one?

Sure, feel free to open as many PRs as you’d like, as long as they improve the coverage, even just a little bit.@kendriyavid: @rueian taking this one 

Solution patch:
diff --git a/README.md b/README.md
index 7cb9924..af5913c 100644
--- a/README.md
+++ b/README.md
@@ -66,7 +66,6 @@ Once a command is built, use either `client.Do()` or `client.DoMulti()` to send
 
 To reuse a command, use `Pin()` after `Build()` and it will prevent the command from being recycled.
 
-
 ## [Pipelining](https://redis.io/docs/manual/pipelining/)
 
 ### Auto Pipelining
@@ -167,6 +166,7 @@ client.DoCache(ctx, client.B().Get().Key("k1").Cache(), time.Minute).IsCacheHit(
 ```
 
 If the OpenTelemetry is enabled by the `rueidisotel.NewClient(option)`, then there are also two metrics instrumented:
+
 * rueidis_do_cache_miss
 * rueidis_do_cache_hits
 
@@ -260,6 +260,7 @@ err = client.Receive(context.Background(), client.B().Subscribe().Channel("ch1",
 The provided handler will be called with the received message.
 
 It is important to note that `client.Receive()` will keep blocking until returning a value in the following cases:
+
 1. return `nil` when receiving any unsubscribe/punsubscribe message related to the provided `subscribe` command, including `sunsubscribe` messages caused by slot migrations.
 2. return `rueidis.ErrClosing` when the client is closed manually.
 3. return `ctx.Err()` when the `ctx` is done.



Test patch:
diff --git a/rueidiscompat/pubsub_test.go b/rueidiscompat/pubsub_test.go
index c0e4060..73fd2ad 100644
--- a/rueidiscompat/pubsub_test.go
+++ b/rueidiscompat/pubsub_test.go
@@ -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>"))
+	})
+})