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

Function TestServiceTierFromChat

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

Source from the content-addressed store, hash-verified

316}
317
318func TestServiceTierFromChat(t *testing.T) {
319 t.Parallel()
320
321 tests := []struct {
322 name string
323 value *string
324 want *fantasyopenai.ServiceTier
325 }{
326 {name: "Nil"},
327 {name: "Empty", value: ptr(" ")},
328 {name: "Auto", value: ptr(" auto "), want: ptr(fantasyopenai.ServiceTierAuto)},
329 {name: "FlexCase", value: ptr(" FLEX "), want: ptr(fantasyopenai.ServiceTierFlex)},
330 {name: "Priority", value: ptr("priority"), want: ptr(fantasyopenai.ServiceTierPriority)},
331 {name: "DefaultUnsupported", value: ptr("default")},
332 {name: "Invalid", value: ptr("fast")},
333 }
334
335 for _, tt := range tests {
336 t.Run(tt.name, func(t *testing.T) {
337 t.Parallel()
338
339 got := chatopenai.ServiceTierFromChat(tt.value)
340 if tt.want == nil {
341 require.Nil(t, got)
342 return
343 }
344 require.NotNil(t, got)
345 require.Equal(t, *tt.want, *got)
346 })
347 }
348}
349
350func TestResponsesLogProbsFromChatConfig(t *testing.T) {
351 t.Parallel()

Callers

nothing calls this directly

Calls 4

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

Tested by

no test coverage detected