Files
openclaw/src/daemon/launchd-label.test.ts
T
Harjoth Khara 895b691c55 fix(daemon): refuse duplicate launchd gateway managers (#97285)
* fix(daemon): block duplicate launchd owners

Co-authored-by: Harjoth Khara <harjoth.khara@gmail.com>

* fix(ci): satisfy launchd docs and lint gates

* fix(ci): remove unused launchd exports

* docs: refresh gateway map

---------

Co-authored-by: Peter Steinberger <steipete@gmail.com>
2026-07-29 13:31:22 -04:00

23 lines
880 B
TypeScript

// Launchd label tests keep lifecycle, handoff, update, and discovery resolution aligned.
import { describe, expect, it } from "vitest";
import { resolveLaunchAgentLabel } from "./launchd-label.js";
describe("resolveLaunchAgentLabel", () => {
it("resolves default, profile, and explicit labels", () => {
expect(resolveLaunchAgentLabel()).toBe("ai.openclaw.gateway");
expect(resolveLaunchAgentLabel({ OPENCLAW_PROFILE: "work" })).toBe("ai.openclaw.work");
expect(
resolveLaunchAgentLabel({
OPENCLAW_PROFILE: "work",
OPENCLAW_LAUNCHD_LABEL: "com.example.gateway",
}),
).toBe("com.example.gateway");
});
it("rejects labels that cannot be passed safely to launchd", () => {
expect(() =>
resolveLaunchAgentLabel({ OPENCLAW_LAUNCHD_LABEL: "ai.openclaw.$(echo injected)" }),
).toThrow("Invalid launchd label");
});
});