Fix tests.
This commit is contained in:
parent
5fc5524693
commit
3a74df0a4a
|
@ -43,9 +43,7 @@ describe("test the openai action", () => {
|
|||
|
||||
it("should present the correct error message when the OPENAI_API_KEY variable isn't set", async () => {
|
||||
await config.withCoreEnv({ OPENAI_API_KEY: "" }, async () => {
|
||||
let res = await runStep("OPENAI", {
|
||||
prompt: OPENAI_PROMPT,
|
||||
})
|
||||
let res = await runStep("OPENAI", { prompt: OPENAI_PROMPT })
|
||||
expect(res.response).toEqual(
|
||||
"OpenAI API Key not configured - please add the OPENAI_API_KEY environment variable."
|
||||
)
|
||||
|
@ -54,17 +52,13 @@ describe("test the openai action", () => {
|
|||
})
|
||||
|
||||
it("should be able to receive a response from ChatGPT given a prompt", async () => {
|
||||
const res = await runStep("OPENAI", {
|
||||
prompt: OPENAI_PROMPT,
|
||||
})
|
||||
const res = await runStep("OPENAI", { prompt: OPENAI_PROMPT })
|
||||
expect(res.response).toEqual("This is a test")
|
||||
expect(res.success).toBeTruthy()
|
||||
})
|
||||
|
||||
it("should present the correct error message when a prompt is not provided", async () => {
|
||||
const res = await runStep("OPENAI", {
|
||||
prompt: null,
|
||||
})
|
||||
const res = await runStep("OPENAI", { prompt: null })
|
||||
expect(res.response).toEqual(
|
||||
"Budibase OpenAI Automation Failed: No prompt supplied"
|
||||
)
|
||||
|
|
|
@ -290,7 +290,7 @@ export default class TestConfiguration {
|
|||
* that can be called to reset the environment variables to their original values.
|
||||
*/
|
||||
setCoreEnv(newEnvVars: Partial<typeof coreEnv>): () => void {
|
||||
const oldEnv = cloneDeep(env)
|
||||
const oldEnv = cloneDeep(coreEnv)
|
||||
|
||||
let key: keyof typeof newEnvVars
|
||||
for (key in newEnvVars) {
|
||||
|
|
Loading…
Reference in New Issue