mirror of
https://github.com/alkimake/paperclip.git
synced 2026-06-18 19:50:38 +09:00
fix: harden heartbeat and adapter runtime workflows
This commit is contained in:
parent
548721248e
commit
c566a9236c
48 changed files with 14922 additions and 600 deletions
|
|
@ -2,6 +2,7 @@ import { describe, expect, it } from "vitest";
|
|||
import {
|
||||
summarizeHeartbeatRunResultJson,
|
||||
buildHeartbeatRunIssueComment,
|
||||
mergeHeartbeatRunResultJson,
|
||||
} from "../services/heartbeat-run-summary.js";
|
||||
|
||||
describe("summarizeHeartbeatRunResultJson", () => {
|
||||
|
|
@ -55,3 +56,35 @@ describe("buildHeartbeatRunIssueComment", () => {
|
|||
expect(buildHeartbeatRunIssueComment({ costUsd: 1.2 })).toBeNull();
|
||||
});
|
||||
});
|
||||
|
||||
describe("mergeHeartbeatRunResultJson", () => {
|
||||
it("adds adapter summaries into stored result json for comment posting", () => {
|
||||
const merged = mergeHeartbeatRunResultJson(
|
||||
{ stdout: "raw stdout", stderr: "" },
|
||||
"## Summary\n\n1. first thing\n2. second thing",
|
||||
);
|
||||
|
||||
expect(merged).toEqual({
|
||||
stdout: "raw stdout",
|
||||
stderr: "",
|
||||
summary: "## Summary\n\n1. first thing\n2. second thing",
|
||||
});
|
||||
expect(buildHeartbeatRunIssueComment(merged)).toBe("## Summary\n\n1. first thing\n2. second thing");
|
||||
});
|
||||
|
||||
it("creates a result payload when only a summary exists", () => {
|
||||
expect(mergeHeartbeatRunResultJson(null, "done")).toEqual({ summary: "done" });
|
||||
});
|
||||
|
||||
it("does not overwrite an explicit summary already returned by the adapter", () => {
|
||||
expect(
|
||||
mergeHeartbeatRunResultJson(
|
||||
{ summary: "adapter result", stdout: "raw stdout" },
|
||||
"fallback summary",
|
||||
),
|
||||
).toEqual({
|
||||
summary: "adapter result",
|
||||
stdout: "raw stdout",
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue