open-design/tools/dev/tests/cli-hints.test.ts
wuyangfan b80de1414b fix(tools-dev): print source-install od CLI hints after start
After tools-dev starts the daemon on an ephemeral port, print how to run
`pnpm exec od` and export OD_DAEMON_URL so source installs do not hit the
system BSD `od` binary or the packaged Docker default port.

Related to #2801
2026-05-27 00:34:28 +08:00

27 lines
870 B
TypeScript

import assert from "node:assert/strict";
import { describe, it } from "node:test";
import { formatSourceInstallCliHints } from "../src/cli-hints.js";
describe("formatSourceInstallCliHints", () => {
it("returns empty output when the daemon URL is unavailable", () => {
assert.deepEqual(
formatSourceInstallCliHints({
daemonUrl: null,
odBinPath: "/repo/node_modules/.bin/od",
}),
[],
);
});
it("prints pnpm exec od guidance and OD_DAEMON_URL export (#2801)", () => {
const text = formatSourceInstallCliHints({
daemonUrl: "http://127.0.0.1:49980",
odBinPath: "/repo/node_modules/.bin/od",
}).join("\n");
assert.match(text, /pnpm exec od skills list/);
assert.match(text, /export OD_DAEMON_URL=http:\/\/127\.0\.0\.1:49980/);
assert.match(text, /\/repo\/node_modules\/\.bin\/od/);
});
});