MCPcopy
hub / github.com/netdata/netdata / TestFieldVisual_StringAndJSON

Function TestFieldVisual_StringAndJSON

src/go/pkg/funcapi/enums_test.go:45–67  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

43}
44
45func TestFieldVisual_StringAndJSON(t *testing.T) {
46 cases := []struct {
47 value FieldVisual
48 expected string
49 }{
50 {FieldVisualValue, "value"},
51 {FieldVisualBar, "bar"},
52 {FieldVisualPill, "pill"},
53 {FieldVisualRichValue, "richValue"},
54 {FieldVisualFeedTemplate, "feedTemplate"},
55 {FieldVisualRowOptions, "rowOptions"},
56 {FieldVisual(250), "value"},
57 }
58
59 for _, tc := range cases {
60 t.Run(tc.expected, func(t *testing.T) {
61 assert.Equal(t, tc.expected, tc.value.String())
62 data, err := json.Marshal(tc.value)
63 require.NoError(t, err)
64 assert.Equal(t, `"`+tc.expected+`"`, string(data))
65 })
66 }
67}
68
69func TestFieldTransform_StringAndJSON(t *testing.T) {
70 cases := []struct {

Callers

nothing calls this directly

Calls 4

FieldVisualTypeAlias · 0.85
EqualMethod · 0.80
RunMethod · 0.65
StringMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…