Fix workspace runtime control requests

This commit is contained in:
Dotta committed 2026-04-14 11:51:38 -05:00
1 parent e25a58d1a0
commit 99ed100981
7 files changed
+183 -12

No files matched your search

@@ -0,0 +1,28 @@
import { describe, expect, it } from "vitest";
import { sanitizeWorkspaceRuntimeControlTarget } from "./workspace-runtime-control";
describe("sanitizeWorkspaceRuntimeControlTarget", () => {
it("drops unexpected keys while preserving the selected runtime target", () => {
const sanitized = sanitizeWorkspaceRuntimeControlTarget({
workspaceCommandId: "web",
runtimeServiceId: "service-1",
serviceIndex: 2,
...( { action: "start" } as Record<string, unknown> ),
});
expect(sanitized).toEqual({
workspaceCommandId: "web",
runtimeServiceId: "service-1",
serviceIndex: 2,
});
expect("action" in sanitized).toBe(false);
});
it("normalizes an omitted target to nullable fields", () => {
expect(sanitizeWorkspaceRuntimeControlTarget()).toEqual({
workspaceCommandId: null,
runtimeServiceId: null,
serviceIndex: null,
});
});
});