-
Notifications
You must be signed in to change notification settings - Fork 1
/
values_test.go
51 lines (46 loc) · 1.02 KB
/
values_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
package goulash
import (
"testing"
"github.com/stretchr/testify/assert"
)
func TestValuessMapString(t *testing.T) {
t.Parallel()
testCases := []struct {
name string
input map[string]string
expect []string
}{
{
name: "Empty map",
input: map[string]string{},
expect: []string{},
},
{
name: "Map with 1 element",
input: map[string]string{"key": "value"},
expect: []string{"value"},
},
{
name: "Map with distinct keys/values",
input: map[string]string{
"key1": "value1",
"key2": "value2",
"key3": "value3",
"key4": "value4",
},
expect: []string{"value1", "value2", "value3", "value4"},
},
{
name: "Map with identical values",
input: map[string]string{"key1": "value", "key2": "value", "key3": "value"},
expect: []string{"value", "value", "value"},
},
}
for _, testCase := range testCases {
testCase := testCase
t.Run(testCase.name, func(t *testing.T) {
t.Parallel()
assert.ElementsMatch(t, testCase.expect, Values(testCase.input))
})
}
}