Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
aos
GitHub Repository: aos/grafana-agent
Path: blob/main/pkg/river/encoding/map_test.go
4095 views
1
package encoding
2
3
import (
4
"testing"
5
6
"github.com/grafana/agent/pkg/river/internal/value"
7
"github.com/stretchr/testify/require"
8
)
9
10
func TestMap(t *testing.T) {
11
tt := []struct {
12
name string
13
testMap map[string]interface{}
14
}{
15
{
16
name: "Test Map Value",
17
testMap: map[string]any{"testValue": "value"},
18
},
19
{
20
name: "Test Map Blank",
21
testMap: map[string]any{"testBlank": ""},
22
},
23
{
24
name: "Test Map Null",
25
testMap: map[string]any{"testNull": value.Null},
26
},
27
}
28
29
for _, tc := range tt {
30
t.Run(tc.name, func(t *testing.T) {
31
mf, err := newRiverMap(value.Encode(tc.testMap))
32
require.NoError(t, err)
33
require.True(t, mf.hasValue())
34
})
35
}
36
}
37
38