mirror of
https://github.com/openclaw/openclaw.git
synced 2026-07-24 00:01:12 +00:00
* refactor(plugins): trim activation and contract exports * test(plugins): restore fixture cleanup * refactor(plugins): trim install and loader exports * test(plugins): fully reset loader caches * refactor(plugins): trim metadata and catalog exports * test(plugins): preserve catalog trust coverage * refactor(plugins): trim provider and plugin exports * refactor(plugins): trim runtime and tool exports * test(plugins): update dead-export consumers * test(plugins): remove empty dead-export suites * refactor(plugins): align exports with split registry * refactor(plugins): trim drifted loader exports * style(plugins): format test fixtures * refactor(scripts): use supported plugin APIs * refactor(plugins): finish dead export cleanup * chore(deadcode): refresh export baseline * test(cli): mock production memory state * chore(deadcode): sync latest export baseline * fix(tests): keep plugin fixtures inside core * chore(deadcode): refresh rebased export baseline * chore(deadcode): sync current ratchets * fix(plugins): retain reserved slot invariant * fix(plugins): preserve dead-export invariants * test(plugins): use neutral catalog query fixture * test(plugins): satisfy catalog lint * test(plugins): preserve integrity drift coverage * fix(ci): register skill experience live proof
55 lines
1.7 KiB
TypeScript
55 lines
1.7 KiB
TypeScript
// Plugin list format tests cover installed plugin table and JSON formatting.
|
|
import { describe, expect, it } from "vitest";
|
|
import { createPluginRecord } from "../plugins/status.test-fixtures.js";
|
|
import { formatPluginLine } from "./plugins-list-format.js";
|
|
|
|
describe("formatPluginLine", () => {
|
|
it("labels active registry entries as enabled rather than loaded", () => {
|
|
const output = formatPluginLine(createPluginRecord({ id: "demo", enabled: true }));
|
|
|
|
expect(output).toContain("enabled");
|
|
expect(output).not.toContain("loaded");
|
|
});
|
|
|
|
it("shows imported state in verbose output", () => {
|
|
const output = formatPluginLine(
|
|
createPluginRecord({
|
|
id: "demo",
|
|
name: "Demo Plugin",
|
|
imported: false,
|
|
activated: true,
|
|
explicitlyEnabled: false,
|
|
}),
|
|
true,
|
|
);
|
|
|
|
expect(output).toContain("activated: yes");
|
|
expect(output).toContain("imported: no");
|
|
expect(output).toContain("explicitly enabled: no");
|
|
});
|
|
|
|
it("sanitizes activation reasons in verbose output", () => {
|
|
const output = formatPluginLine(
|
|
createPluginRecord({
|
|
id: "demo",
|
|
name: "Demo Plugin",
|
|
activated: true,
|
|
activationSource: "auto",
|
|
activationReason: "\u001B[31mconfigured\nnext\tstep",
|
|
}),
|
|
true,
|
|
);
|
|
|
|
expect(output).toContain("activation reason: configured\\nnext\\tstep");
|
|
expect(output).not.toContain("\u001B[31m");
|
|
expect(output.match(/activation reason:/g)).toHaveLength(1);
|
|
});
|
|
|
|
it("keeps truncated descriptions free of lone surrogates", () => {
|
|
const output = formatPluginLine(
|
|
createPluginRecord({ id: "demo", description: `${"a".repeat(56)}😀tail` }),
|
|
);
|
|
expect(Buffer.from(output).toString()).toBe(output);
|
|
});
|
|
});
|