From 7321c6334ccc8b080de39e73e3e88bcdc027fda6 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 | 27 +++++++++++++++++++++++++++ 1 file changed, 27 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..aa1bd82f --- /dev/null +++ b/redis/streams_test.go @@ -0,0 +1,27 @@ +package redis + +import ( + "github.com/stretchr/testify/require" + "testing" +) + +func TestStreams_Option(t *testing.T) { + subtests := []struct { + name string + input Streams + outputs [][]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"}, {"key2", "key1", "id2", "id1"}, + }}, + } + + for _, st := range subtests { + t.Run(st.name, func(t *testing.T) { + require.Contains(t, st.outputs, st.input.Option()) + }) + } +}