From 2dbe03274a8283ec8757d8062420c0f55f57035d Mon Sep 17 00:00:00 2001 From: "Alexander A. Klimov" Date: Mon, 8 Jul 2024 12:23:32 +0200 Subject: [PATCH] Test redis.Streams#Option() --- redis/streams_test.go | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 redis/streams_test.go diff --git a/redis/streams_test.go b/redis/streams_test.go new file mode 100644 index 00000000..025f5b88 --- /dev/null +++ b/redis/streams_test.go @@ -0,0 +1,25 @@ +package redis + +import ( + "github.com/stretchr/testify/require" + "testing" +) + +func TestStreams_Option(t *testing.T) { + subtests := []struct { + name string + input Streams + output []string + }{ + {"nil", nil, []string{}}, + {"empty", Streams{}, []string{}}, + {"one", Streams{"key": "id"}, []string{"key", "id"}}, + {"two", Streams{"key1": "id1", "key2": "id2"}, []string{"key1", "key2", "id1", "id2"}}, + } + + for _, st := range subtests { + t.Run(st.name, func(t *testing.T) { + require.Equal(t, st.output, st.input.Option()) + }) + } +}