@@ -39,8 +39,8 @@ describe("cron tool", () => {
|
39 | 39 | opts?: Parameters<typeof createCronTool>[0], |
40 | 40 | ): ReturnType<typeof createCronTool> { |
41 | 41 | return createCronTool(opts, { |
42 | | -callGatewayTool: async (method, _gatewayOpts, params) => |
43 | | -await callGatewayMock({ method, params }), |
| 42 | +callGatewayTool: async (method, gatewayOpts, params) => |
| 43 | +await callGatewayMock({ method, params }, gatewayOpts), |
44 | 44 | }); |
45 | 45 | } |
46 | 46 | |
@@ -52,6 +52,10 @@ describe("cron tool", () => {
|
52 | 52 | ); |
53 | 53 | } |
54 | 54 | |
| 55 | +function readGatewayOpts(index = 0): Record<string, unknown> | undefined { |
| 56 | +return callGatewayMock.mock.calls[index]?.[1] as Record<string, unknown> | undefined; |
| 57 | +} |
| 58 | + |
55 | 59 | function readCronPayloadText(index = 0): string { |
56 | 60 | const params = readGatewayCall(index).params as { payload?: { text?: string } } | undefined; |
57 | 61 | return params?.payload?.text ?? ""; |
@@ -256,6 +260,19 @@ describe("cron tool", () => {
|
256 | 260 | expect(result.details).toEqual({ enabled: true }); |
257 | 261 | }); |
258 | 262 | |
| 263 | +it("passes parsed string timeoutMs values through to gateway calls", async () => { |
| 264 | +callGatewayMock.mockResolvedValueOnce({ enabled: true }); |
| 265 | +const tool = createTestCronTool(); |
| 266 | + |
| 267 | +await tool.execute("call-status-timeout", { |
| 268 | +action: "status", |
| 269 | +timeoutMs: "5000", |
| 270 | +}); |
| 271 | + |
| 272 | +expectSingleGatewayCallMethod("cron.status"); |
| 273 | +expect(readGatewayOpts(0)?.timeoutMs).toBe(5000); |
| 274 | +}); |
| 275 | + |
259 | 276 | it("allows scoped isolated cron runs to get the current job", async () => { |
260 | 277 | callGatewayMock.mockResolvedValueOnce({ id: "job-current", name: "current" }); |
261 | 278 | const tool = createTestCronTool({ selfRemoveOnlyJobId: "job-current" }); |
|