MCPcopy
hub / github.com/netdata/netdata / TestFieldSort_StringAndJSON

Function TestFieldSort_StringAndJSON

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

Source from the content-addressed store, hash-verified

92}
93
94func TestFieldSort_StringAndJSON(t *testing.T) {
95 cases := []struct {
96 value FieldSort
97 expected string
98 }{
99 {FieldSortAscending, "ascending"},
100 {FieldSortDescending, "descending"},
101 {FieldSort(250), "ascending"},
102 }
103
104 for _, tc := range cases {
105 t.Run(tc.expected, func(t *testing.T) {
106 assert.Equal(t, tc.expected, tc.value.String())
107 data, err := json.Marshal(tc.value)
108 require.NoError(t, err)
109 assert.Equal(t, `"`+tc.expected+`"`, string(data))
110 })
111 }
112}
113
114func TestFieldSummary_StringAndJSON(t *testing.T) {
115 cases := []struct {

Callers

nothing calls this directly

Calls 4

FieldSortTypeAlias · 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…