mirror of
https://github.com/getpaseo/paseo.git
synced 2026-11-06 08:24:46 +00:00
Restart reconstructed launch inputs and address fallback could redirect a home-selected shutdown to another daemon. Let supervisors publish bound endpoints, retain their worker restart contract, and share captured local lifecycle ownership between CLI and Desktop.
33 lines
1.3 KiB
TypeScript
33 lines
1.3 KiB
TypeScript
import { test, expect } from "vitest";
|
|
import { selectDaemonTarget, describeDaemonTarget } from "./daemon-target.js";
|
|
|
|
test("explicit selectors win over both environment selectors", () => {
|
|
const env = { PASEO_HOME: "/tmp/a", PASEO_HOST: "unused:12345" };
|
|
expect(selectDaemonTarget({ home: "/tmp/b" }, env)).toEqual({ kind: "instance", home: "/tmp/b" });
|
|
expect(selectDaemonTarget({ host: "chosen:23456" }, env)).toEqual({
|
|
kind: "endpoint",
|
|
host: "chosen:23456",
|
|
});
|
|
expect(() => selectDaemonTarget({}, env)).toThrow();
|
|
expect(() => selectDaemonTarget({ home: "/tmp/b", host: "chosen:23456" }, {})).toThrow();
|
|
});
|
|
|
|
test("local operations ignore routing environment but reject an explicit endpoint", () => {
|
|
expect(
|
|
selectDaemonTarget({}, { PASEO_HOME: "/tmp/b", PASEO_HOST: "unused:12345" }, true),
|
|
).toEqual({ kind: "instance", home: "/tmp/b" });
|
|
expect(() => selectDaemonTarget({ host: "chosen:23456" }, {}, true)).toThrow();
|
|
});
|
|
|
|
test("endpoint descriptions redact pairing material and credentials", () => {
|
|
expect(
|
|
describeDaemonTarget({
|
|
kind: "endpoint",
|
|
host: "tcp://user:private@example.test:23456?password=secret",
|
|
}),
|
|
).not.toMatch(/private|secret/);
|
|
expect(
|
|
describeDaemonTarget({ kind: "endpoint", host: "https://app.paseo.sh/#offer=private" }),
|
|
).not.toContain("private");
|
|
});
|