MCPcopy Create free account
hub / github.com/coder/coder / TestTextVerbosityFromChat

Function TestTextVerbosityFromChat

coderd/x/chatd/chatopenai/options_test.go:128–157  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

126}
127
128func TestTextVerbosityFromChat(t *testing.T) {
129 t.Parallel()
130
131 tests := []struct {
132 name string
133 value *string
134 want *fantasyopenai.TextVerbosity
135 }{
136 {name: "Nil"},
137 {name: "Empty", value: ptr(" ")},
138 {name: "Low", value: ptr(" low "), want: ptr(fantasyopenai.TextVerbosityLow)},
139 {name: "MediumCase", value: ptr(" MEDIUM "), want: ptr(fantasyopenai.TextVerbosityMedium)},
140 {name: "High", value: ptr("high"), want: ptr(fantasyopenai.TextVerbosityHigh)},
141 {name: "Invalid", value: ptr("verbose")},
142 }
143
144 for _, tt := range tests {
145 t.Run(tt.name, func(t *testing.T) {
146 t.Parallel()
147
148 got := chatopenai.TextVerbosityFromChat(tt.value)
149 if tt.want == nil {
150 require.Nil(t, got)
151 return
152 }
153 require.NotNil(t, got)
154 require.Equal(t, *tt.want, *got)
155 })
156 }
157}
158
159func TestIncludeFromChat(t *testing.T) {
160 t.Parallel()

Callers

nothing calls this directly

Calls 4

TextVerbosityFromChatFunction · 0.92
ptrFunction · 0.70
RunMethod · 0.65
EqualMethod · 0.45

Tested by

no test coverage detected