feat(workflow): support webhook sample records, params preview and expand trigger catalog

This commit is contained in:
gitea committed 2026-10-15 15:01:20 +08:00
1 parent 8531530ccd
commit c56460716f
6 files changed
+175 -15

No files matched your search

+40 -4
View File
@@ -880,7 +880,26 @@ describe("CLI - workflow job 执行详情与异常精准透视", () => {
}),
};
},
post: () => ({ json: async () => ({ code: 200, data: "job_webhook_202" }) }),
post: (url: string) => {
if (url && url.includes("sampleData")) {
return {
json: async () => ({
code: 200,
data: {
records: [
{
id: "sample_001",
pipelineId: "wf_webhook_1",
dataJson: JSON.stringify({ code: "SAMPLE-PAYLOAD-001" }),
createTime: 1792047100000,
},
],
},
}),
};
}
return { json: async () => ({ code: 200, data: "job_webhook_202" }) };
},
};
spies.push(
@@ -894,7 +913,7 @@ describe("CLI - workflow job 执行详情与异常精准透视", () => {
spyOn(helpers, "createPiperClientForCorp").mockResolvedValue(mockClient as any)
);
// 1. 未传 body 时提示参数说明
// 1. 未传 body 时提示参数说明与服务器历史样本
const noBodyRes = await handleWorkflowCommand(
{
area: "workflow",
@@ -907,9 +926,26 @@ describe("CLI - workflow job 执行详情与异常精准透视", () => {
);
expect(noBodyRes.exitCode).toBe(1);
expect(noBodyRes.stdout).toContain("外部事件触发器");
expect(noBodyRes.stdout).toContain("--body");
expect(noBodyRes.stdout).toContain("服务器最近接收的数据样本");
expect(noBodyRes.stdout).toContain("sample_001");
expect(noBodyRes.stdout).toContain("--sample");
// 2. 传入 --body 成功派发
// 2. 传入 --sample=1 成功提取样本发起测试
const withSampleRes = await handleWorkflowCommand(
{
area: "workflow",
action: "test",
args: ["wf_webhook_1"],
options: { sample: "1", platformId: "p1", yes: true },
raw: ["workflow", "test", "wf_webhook_1", "--sample=1", "--platform-id=p1", "--yes"],
},
mockRuntime
);
expect(withSampleRes.exitCode).toBe(0);
expect(withSampleRes.stdout).toContain("[WEBHOOK]");
expect(withSampleRes.stdout).toContain("Webhook Payload: code");
// 3. 传入 --body 成功派发
const withBodyRes = await handleWorkflowCommand(
{
area: "workflow",