From 2fb247bc0a36c06be93ce07a3985d22947803bd6 Mon Sep 17 00:00:00 2001 From: Andreas Coroiu Date: Mon, 3 Nov 2025 08:35:28 +0100 Subject: [PATCH] feat: add some more tests --- .../services/sdk/rpc/batch-executor.spec.ts | 29 +++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/libs/common/src/platform/services/sdk/rpc/batch-executor.spec.ts b/libs/common/src/platform/services/sdk/rpc/batch-executor.spec.ts index 543746f6809..c051b409ab9 100644 --- a/libs/common/src/platform/services/sdk/rpc/batch-executor.spec.ts +++ b/libs/common/src/platform/services/sdk/rpc/batch-executor.spec.ts @@ -140,6 +140,35 @@ describe("Batch executor", () => { }); expect(target.dispose).toHaveBeenCalled(); }); + + it("is compatible with complex command sequences", async () => { + const commands: BatchCommand[] = [ + { method: "get", propertyName: "child" }, + { method: "get", propertyName: "getTestObject" }, + { method: "apply", args: ["complex"] }, + { method: "get", propertyName: "name" }, + ]; + + const response = await executeBatchCommands(target, commands, referenceStore); + expect(response).toEqual({ + status: "success", + result: { + type: "value", + value: "complex", + }, + }); + }); + + it("returns error when a command fails", async () => { + const commands: BatchCommand[] = [ + { method: "get", propertyName: "nonExistentProperty" }, // This returns undefined + { method: "get", propertyName: "nonExistentProperty" }, // Trying to get property of undefined + ]; + + const response = await executeBatchCommands(target, commands, referenceStore); + expect(response.status).toBe("error"); + expect((response as any).error).toBeInstanceOf(Error); + }); }); class TestTarget {