Lint
This commit is contained in:
parent
672666d96b
commit
559f52d904
|
@ -22,6 +22,10 @@ jest.mock(
|
||||||
}))
|
}))
|
||||||
)
|
)
|
||||||
|
|
||||||
|
const mockedOpenAIApi = openai.OpenAIApi as jest.MockedClass<
|
||||||
|
typeof openai.OpenAIApi
|
||||||
|
>
|
||||||
|
|
||||||
const OPENAI_PROMPT = "What is the meaning of life?"
|
const OPENAI_PROMPT = "What is the meaning of life?"
|
||||||
|
|
||||||
describe("test the openai action", () => {
|
describe("test the openai action", () => {
|
||||||
|
@ -68,11 +72,16 @@ describe("test the openai action", () => {
|
||||||
})
|
})
|
||||||
|
|
||||||
it("should present the correct error message when an error is thrown from the createChatCompletion call", async () => {
|
it("should present the correct error message when an error is thrown from the createChatCompletion call", async () => {
|
||||||
;(openai.OpenAIApi as any).mockImplementation(() => ({
|
mockedOpenAIApi.mockImplementation(
|
||||||
createChatCompletion: jest.fn(() => {
|
() =>
|
||||||
throw new Error("An error occurred while calling createChatCompletion")
|
({
|
||||||
}),
|
createChatCompletion: jest.fn(() => {
|
||||||
}))
|
throw new Error(
|
||||||
|
"An error occurred while calling createChatCompletion"
|
||||||
|
)
|
||||||
|
}),
|
||||||
|
} as any)
|
||||||
|
)
|
||||||
|
|
||||||
const res = await setup.runStep("OPENAI", {
|
const res = await setup.runStep("OPENAI", {
|
||||||
prompt: OPENAI_PROMPT,
|
prompt: OPENAI_PROMPT,
|
||||||
|
|
Loading…
Reference in New Issue