Skip to content

Commit 7321c63

Browse files
committed
Test redis.Streams#Option()
1 parent 296f480 commit 7321c63

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

redis/streams_test.go

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
package redis
2+
3+
import (
4+
"github.com/stretchr/testify/require"
5+
"testing"
6+
)
7+
8+
func TestStreams_Option(t *testing.T) {
9+
subtests := []struct {
10+
name string
11+
input Streams
12+
outputs [][]string
13+
}{
14+
{"nil", nil, [][]string{{}}},
15+
{"empty", Streams{}, [][]string{{}}},
16+
{"one", Streams{"key": "id"}, [][]string{{"key", "id"}}},
17+
{"two", Streams{"key1": "id1", "key2": "id2"}, [][]string{
18+
{"key1", "key2", "id1", "id2"}, {"key2", "key1", "id2", "id1"},
19+
}},
20+
}
21+
22+
for _, st := range subtests {
23+
t.Run(st.name, func(t *testing.T) {
24+
require.Contains(t, st.outputs, st.input.Option())
25+
})
26+
}
27+
}

0 commit comments

Comments
 (0)