fix: stabilize auth identity, record operations, and workflow diagnostics
This commit is contained in:
1 parent
c74fdda7da
commit
7ec369f77e
36 files changed
+1021
-337
No files matched your search
@@ -487,7 +487,6 @@ describe("CLI - platform 命令与 record 动作", () => {
|
||||
|
||||
const streamedLines: string[] = [];
|
||||
const writeSpy = spyOn(process.stdout, "write").mockImplementation((str: any) => {
|
||||
streamedLines.push(String(str));
|
||||
return true;
|
||||
});
|
||||
spies.push(writeSpy);
|
||||
@@ -500,11 +499,12 @@ describe("CLI - platform 命令与 record 动作", () => {
|
||||
options: { ndjson: true },
|
||||
raw: ["platform", "records", "platform-1", "entity-1", "--ndjson"],
|
||||
},
|
||||
dummyRuntime
|
||||
{ ...dummyRuntime, writeStdout: async (chunk) => { streamedLines.push(chunk); } }
|
||||
);
|
||||
|
||||
expect(streamRes.exitCode).toBe(0);
|
||||
expect(streamedLines.length).toBe(2);
|
||||
expect(writeSpy).not.toHaveBeenCalled();
|
||||
|
||||
const row1 = JSON.parse(streamedLines[0].trim());
|
||||
expect(row1.id).toBe("r-1");
|
||||
@@ -513,5 +513,17 @@ describe("CLI - platform 命令与 record 动作", () => {
|
||||
expect(row1.active).toBe(true);
|
||||
expect(row1.fields["自定义字段"]).toBe("测试值");
|
||||
});
|
||||
|
||||
it("rejects malformed batch predicates before fetching all records or calling the writer", async () => {
|
||||
spies.push(spyOn(helpers, "createClientsForCorp").mockResolvedValue({ ekbClient: {} } as any));
|
||||
spies.push(spyOn(services, "resolvePlatform").mockResolvedValue(mockPlatform as any));
|
||||
spies.push(spyOn(services, "resolveEntity").mockResolvedValue(mockEntity as any));
|
||||
const fetch = spyOn(services, "fetchAllEntityRecords").mockResolvedValue({ data: [], total: 0 } as any);
|
||||
const write = spyOn(services, "batchSafeEditRecords").mockResolvedValue([]);
|
||||
spies.push(fetch, write);
|
||||
await expect(handlePlatformCommand({ area: "platform", action: "batch-edit", args: ["platform-1", "entity-1"], options: { where: "序号 in [1]", set: "active=true", yes: true }, raw: [] }, dummyRuntime)).rejects.toThrow("不支持的筛选条件");
|
||||
expect(fetch).not.toHaveBeenCalled();
|
||||
expect(write).not.toHaveBeenCalled();
|
||||
});
|
||||
});
|
||||
|
||||
Reference in new issue
Block a user