CLI routes: test conditional plugin preload behavior

This commit is contained in:
Vincent Koc
2026-03-01 11:59:31 -08:00
parent 22653c0e27
commit 3c4cdf72c9

View File

@@ -13,9 +13,20 @@ describe("program routes", () => {
await expect(route?.run(argv)).resolves.toBe(false);
}
it("matches status route and preserves plugin loading", () => {
it("matches status route and loads plugins for human-readable output", () => {
const route = expectRoute(["status"]);
expect(route?.loadPlugins).toBe(true);
expect(typeof route?.loadPlugins).toBe("function");
const loadPlugins = route?.loadPlugins;
if (typeof loadPlugins !== "function") {
throw new Error("expected status route loadPlugins predicate");
}
expect(loadPlugins(["node", "openclaw", "status"])).toBe(true);
expect(loadPlugins(["node", "openclaw", "status", "--json"])).toBe(false);
});
it("matches health route without eager plugin loading", () => {
const route = expectRoute(["health"]);
expect(route?.loadPlugins).toBeUndefined();
});
it("returns false when status timeout flag value is missing", async () => {