diff --git a/src/cli/program/routes.test.ts b/src/cli/program/routes.test.ts index 9442785b083..843c0257da4 100644 --- a/src/cli/program/routes.test.ts +++ b/src/cli/program/routes.test.ts @@ -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 () => {