mirror of
https://github.com/openclaw/openclaw.git
synced 2026-04-29 18:12:52 +00:00
Tests: move cron structured failure to seam
This commit is contained in:
@@ -231,15 +231,6 @@ describe("runCronIsolatedAgentTurn", () => {
|
||||
setupIsolatedAgentTurnMocks({ fast: true });
|
||||
});
|
||||
|
||||
it("fails when structured direct delivery fails and best-effort is disabled", async () => {
|
||||
await expectStructuredTelegramFailure({
|
||||
payload: { text: "hello from cron", mediaUrl: "https://example.com/img.png" },
|
||||
bestEffort: false,
|
||||
expectedStatus: "error",
|
||||
expectedErrorFragment: "boom",
|
||||
});
|
||||
});
|
||||
|
||||
it("reports not-delivered when text direct delivery fails and best-effort is enabled", async () => {
|
||||
await expectTelegramTextDeliveryFailure({
|
||||
bestEffort: true,
|
||||
|
||||
@@ -555,6 +555,25 @@ describe("dispatchCronDelivery — double-announce guard", () => {
|
||||
);
|
||||
});
|
||||
|
||||
it("surfaces structured direct delivery failures without retry when best-effort is disabled", async () => {
|
||||
vi.mocked(countActiveDescendantRuns).mockReturnValue(0);
|
||||
vi.mocked(isLikelyInterimCronMessage).mockReturnValue(false);
|
||||
vi.mocked(deliverOutboundPayloads).mockRejectedValue(new Error("boom"));
|
||||
|
||||
const params = makeBaseParams({ synthesizedText: "Report attached." });
|
||||
(params as Record<string, unknown>).deliveryPayloadHasStructuredContent = true;
|
||||
const state = await dispatchCronDelivery(params);
|
||||
|
||||
expect(deliverOutboundPayloads).toHaveBeenCalledTimes(1);
|
||||
expect(state.result).toEqual(
|
||||
expect.objectContaining({
|
||||
status: "error",
|
||||
error: "Error: boom",
|
||||
deliveryAttempted: true,
|
||||
}),
|
||||
);
|
||||
});
|
||||
|
||||
it("no delivery requested means deliveryAttempted stays false and no delivery is sent", async () => {
|
||||
const params = makeBaseParams({
|
||||
synthesizedText: "Task done.",
|
||||
|
||||
Reference in New Issue
Block a user