(t *testing.T)
| 19 | ) |
| 20 | |
| 21 | func 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 | |
| 78 | func TestIsResponsesStoreEnabledIgnoresMalformedNonOpenAIKey(t *testing.T) { |
nothing calls this directly
no test coverage detected