mirror of
https://github.com/samiyev/puaros.git
synced 2025-12-27 23:06:54 +05:00
feat(ipuaro): add commands configuration
- Add CommandsConfigSchema with timeout option - Integrate timeout configuration in RunCommandTool - Add 22 new unit tests (19 schema + 3 integration) - Complete v0.22.0 Extended Configuration milestone
This commit is contained in:
@@ -354,6 +354,36 @@ describe("RunCommandTool", () => {
|
||||
expect(execFn).toHaveBeenCalledWith("ls", expect.objectContaining({ timeout: 5000 }))
|
||||
})
|
||||
|
||||
it("should use config timeout", async () => {
|
||||
const execFn = createMockExec({})
|
||||
const toolWithMock = new RunCommandTool(undefined, execFn, { timeout: 45000 })
|
||||
const ctx = createMockContext()
|
||||
|
||||
await toolWithMock.execute({ command: "ls" }, ctx)
|
||||
|
||||
expect(execFn).toHaveBeenCalledWith("ls", expect.objectContaining({ timeout: 45000 }))
|
||||
})
|
||||
|
||||
it("should use null config timeout as default", async () => {
|
||||
const execFn = createMockExec({})
|
||||
const toolWithMock = new RunCommandTool(undefined, execFn, { timeout: null })
|
||||
const ctx = createMockContext()
|
||||
|
||||
await toolWithMock.execute({ command: "ls" }, ctx)
|
||||
|
||||
expect(execFn).toHaveBeenCalledWith("ls", expect.objectContaining({ timeout: 30000 }))
|
||||
})
|
||||
|
||||
it("should prefer param timeout over config timeout", async () => {
|
||||
const execFn = createMockExec({})
|
||||
const toolWithMock = new RunCommandTool(undefined, execFn, { timeout: 45000 })
|
||||
const ctx = createMockContext()
|
||||
|
||||
await toolWithMock.execute({ command: "ls", timeout: 5000 }, ctx)
|
||||
|
||||
expect(execFn).toHaveBeenCalledWith("ls", expect.objectContaining({ timeout: 5000 }))
|
||||
})
|
||||
|
||||
it("should execute in project root", async () => {
|
||||
const execFn = createMockExec({})
|
||||
const toolWithMock = new RunCommandTool(undefined, execFn)
|
||||
|
||||
Reference in New Issue
Block a user