test: fix
This commit is contained in:
@@ -63,43 +63,44 @@ describe("tool.question", () => {
|
|||||||
expect(result.output).toContain(`"What is your favorite animal?"="Dog"`)
|
expect(result.output).toContain(`"What is your favorite animal?"="Dog"`)
|
||||||
})
|
})
|
||||||
|
|
||||||
test("should throw an Error for header exceeding 30 characters", async () => {
|
// intentionally removed the zod validation due to tool call errors, hoping prompting is gonna be good enough
|
||||||
const tool = await QuestionTool.init()
|
// test("should throw an Error for header exceeding 30 characters", async () => {
|
||||||
const questions = [
|
// const tool = await QuestionTool.init()
|
||||||
{
|
// const questions = [
|
||||||
question: "What is your favorite animal?",
|
// {
|
||||||
header: "This Header is Definitely More Than Thirty Characters Long",
|
// question: "What is your favorite animal?",
|
||||||
options: [{ label: "Dog", description: "Man's best friend" }],
|
// header: "This Header is Definitely More Than Thirty Characters Long",
|
||||||
},
|
// options: [{ label: "Dog", description: "Man's best friend" }],
|
||||||
]
|
// },
|
||||||
try {
|
// ]
|
||||||
await tool.execute({ questions }, ctx)
|
// try {
|
||||||
// If it reaches here, the test should fail
|
// await tool.execute({ questions }, ctx)
|
||||||
expect(true).toBe(false)
|
// // If it reaches here, the test should fail
|
||||||
} catch (e: any) {
|
// expect(true).toBe(false)
|
||||||
expect(e).toBeInstanceOf(Error)
|
// } catch (e: any) {
|
||||||
expect(e.cause).toBeInstanceOf(z.ZodError)
|
// expect(e).toBeInstanceOf(Error)
|
||||||
}
|
// expect(e.cause).toBeInstanceOf(z.ZodError)
|
||||||
})
|
// }
|
||||||
|
// })
|
||||||
|
|
||||||
test("should throw an Error for label exceeding 30 characters", async () => {
|
// test("should throw an Error for label exceeding 30 characters", async () => {
|
||||||
const tool = await QuestionTool.init()
|
// const tool = await QuestionTool.init()
|
||||||
const questions = [
|
// const questions = [
|
||||||
{
|
// {
|
||||||
question: "A question with a very long label",
|
// question: "A question with a very long label",
|
||||||
header: "Long Label",
|
// header: "Long Label",
|
||||||
options: [
|
// options: [
|
||||||
{ label: "This is a very, very, very long label that will exceed the limit", description: "A description" },
|
// { label: "This is a very, very, very long label that will exceed the limit", description: "A description" },
|
||||||
],
|
// ],
|
||||||
},
|
// },
|
||||||
]
|
// ]
|
||||||
try {
|
// try {
|
||||||
await tool.execute({ questions }, ctx)
|
// await tool.execute({ questions }, ctx)
|
||||||
// If it reaches here, the test should fail
|
// // If it reaches here, the test should fail
|
||||||
expect(true).toBe(false)
|
// expect(true).toBe(false)
|
||||||
} catch (e: any) {
|
// } catch (e: any) {
|
||||||
expect(e).toBeInstanceOf(Error)
|
// expect(e).toBeInstanceOf(Error)
|
||||||
expect(e.cause).toBeInstanceOf(z.ZodError)
|
// expect(e.cause).toBeInstanceOf(z.ZodError)
|
||||||
}
|
// }
|
||||||
})
|
// })
|
||||||
})
|
// })
|
||||||
|
|||||||
Reference in New Issue
Block a user