建立 applications 的应用模型和查询出口,保留基础及详情投影差异。 下沉 DataLink,将工作流模型、API、编排及执行上下文归回 workflow。 同步 CLI、SDK、生成脚本、测试和活跃文档引用,公开命令与 SDK 名称保持兼容。 验证:943 项测试、类型和版本检查通过;三份生成规范字节一致,README 审计通过。
41 lines
1.4 KiB
TypeScript
41 lines
1.4 KiB
TypeScript
import { describe, expect, it } from "bun:test";
|
|
import { getWorkflowSnapshot, updateWorkflowChooses } from "./api.js";
|
|
|
|
describe("workflow snapshot API", () => {
|
|
it("uses the piper pipelines/snapshot endpoint first", async () => {
|
|
const calls: string[] = [];
|
|
const client = {
|
|
get: async (path: string) => {
|
|
calls.push(path);
|
|
if (path === "api/easo/pipelines/snapshot/snap-1") {
|
|
return new Response(JSON.stringify({
|
|
code: 200,
|
|
data: { id: "snap-1", pipelineId: "pipe-1", version: "26.10.7" },
|
|
}), { status: 200, headers: { "content-type": "application/json" } });
|
|
}
|
|
throw new Error("unexpected path");
|
|
},
|
|
} as any;
|
|
|
|
const snapshot = await getWorkflowSnapshot(client, "snap-1", "pipe-1");
|
|
|
|
expect(calls).toEqual(["api/easo/pipelines/snapshot/snap-1"]);
|
|
expect(snapshot.id).toBe("snap-1");
|
|
expect(snapshot.version).toBe("26.10.7");
|
|
});
|
|
|
|
it("refreshes chooses after the pipeline save", async () => {
|
|
const calls: string[] = [];
|
|
const client = {
|
|
put: async (path: string) => {
|
|
calls.push(path);
|
|
return new Response(JSON.stringify({ code: 200, data: [] }), { status: 200, headers: { "content-type": "application/json" } });
|
|
},
|
|
} as any;
|
|
|
|
await updateWorkflowChooses(client, "pipe-1");
|
|
|
|
expect(calls).toEqual(["api/easo/pipelines/pipe-1/chooses"]);
|
|
});
|
|
});
|