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

Function TestIsResponsesStoreEnabled

coderd/x/chatd/chatopenai/responses_test.go:21–76  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

19)
20
21func TestIsResponsesStoreEnabled(t *testing.T) {
22 t.Parallel()
23
24 storeTrue := true
25 storeFalse := false
26
27 tests := []struct {
28 name string
29 opts fantasy.ProviderOptions
30 want bool
31 }{
32 {
33 name: "NilOptions",
34 },
35 {
36 name: "NonOpenAIKeysOnly",
37 opts: fantasy.ProviderOptions{
38 "other": &fantasyopenai.ProviderOptions{},
39 },
40 },
41 {
42 name: "OpenAIKeyWithNonResponsesOptions",
43 opts: fantasy.ProviderOptions{
44 fantasyopenai.Name: &fantasyopenai.ProviderOptions{},
45 },
46 },
47 {
48 name: "OpenAIKeyWithNilStore",
49 opts: fantasy.ProviderOptions{
50 fantasyopenai.Name: &fantasyopenai.ResponsesProviderOptions{},
51 },
52 },
53 {
54 name: "OpenAIKeyWithFalseStore",
55 opts: fantasy.ProviderOptions{
56 fantasyopenai.Name: &fantasyopenai.ResponsesProviderOptions{Store: &storeFalse},
57 },
58 },
59 {
60 name: "OpenAIKeyWithTrueStore",
61 opts: fantasy.ProviderOptions{
62 fantasyopenai.Name: &fantasyopenai.ResponsesProviderOptions{Store: &storeTrue},
63 },
64 want: true,
65 },
66 }
67
68 for _, tt := range tests {
69 t.Run(tt.name, func(t *testing.T) {
70 t.Parallel()
71
72 got := chatopenai.IsResponsesStoreEnabled(tt.opts)
73 require.Equal(t, tt.want, got)
74 })
75 }
76}
77
78func TestIsResponsesStoreEnabledIgnoresMalformedNonOpenAIKey(t *testing.T) {

Callers

nothing calls this directly

Calls 3

IsResponsesStoreEnabledFunction · 0.92
RunMethod · 0.65
EqualMethod · 0.45

Tested by

no test coverage detected