Skip to content

Commit

Permalink
Test redis.Streams#Option()
Browse files Browse the repository at this point in the history
  • Loading branch information
Al2Klimov committed Oct 14, 2024
1 parent 296f480 commit 7321c63
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions redis/streams_test.go
Original file line number Diff line number Diff line change
@@ -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())
})
}
}

0 comments on commit 7321c63

Please sign in to comment.