fix tests

This commit is contained in:
Martin McKeaveney 2024-09-10 22:25:47 +01:00
parent 2990291657
commit 38fc65c541
2 changed files with 6 additions and 5 deletions

View File

@ -49,6 +49,7 @@ describe("Global configs controller", () => {
active: true, active: true,
isDefault: true, isDefault: true,
name: "Budibase AI", name: "Budibase AI",
defaultModel: "",
}, },
ai: { ai: {
active: true, active: true,
@ -86,20 +87,20 @@ describe("Global configs controller", () => {
it("Should not update existing secrets when updating an existing AI Config", async () => { it("Should not update existing secrets when updating an existing AI Config", async () => {
const data = structures.configs.ai() const data = structures.configs.ai()
await config.api.configs.saveConfig(data) await config.api.configs.saveConfig(data)
const existingConfig = await config.api.configs.getAIConfig()
const newConfig: AIInnerConfig = { const newConfig: AIInnerConfig = {
aiconfig: { ai: {
provider: "OpenAI", provider: "OpenAI",
isDefault: true, isDefault: true,
apiKey: "--secret-value--",
name: "MyConfig", name: "MyConfig",
active: true, active: true,
defaultModel: "gpt4", defaultModel: "gpt4",
}, },
} }
await verifyAIConfig(newConfig, existingConfig.body) await verifyAIConfig(newConfig, data)
// should be unchanged // should be unchanged
expect(newConfig.aiconfig.apiKey).toEqual("myapikey") expect(newConfig.ai.apiKey).toEqual("myapikey")
}) })
}) })

View File

@ -93,7 +93,7 @@ export function ai(): AIConfig {
name: "Test", name: "Test",
active: true, active: true,
defaultModel: "gpt4", defaultModel: "gpt4",
apiKey: "abc123APIKey", apiKey: "myapikey",
baseUrl: "https://api.example.com", baseUrl: "https://api.example.com",
}, },
}, },