mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-18 03:40:46 +00:00
feat: add plugin text transforms
This commit is contained in:
@@ -719,6 +719,37 @@ describe("loadOpenClawPlugins", () => {
|
||||
expect(bundled?.status).toBe("disabled");
|
||||
});
|
||||
|
||||
it("registers standalone text transforms", () => {
|
||||
useNoBundledPlugins();
|
||||
const plugin = writePlugin({
|
||||
id: "text-shim",
|
||||
filename: "text-shim.cjs",
|
||||
body: `module.exports = {
|
||||
id: "text-shim",
|
||||
register(api) {
|
||||
api.registerTextTransforms({
|
||||
input: [{ from: /red basket/g, to: "blue basket" }],
|
||||
output: [{ from: /blue basket/g, to: "red basket" }],
|
||||
});
|
||||
},
|
||||
};`,
|
||||
});
|
||||
|
||||
const registry = loadRegistryFromSinglePlugin({
|
||||
plugin,
|
||||
pluginConfig: { allow: ["text-shim"] },
|
||||
});
|
||||
|
||||
expect(registry.textTransforms).toHaveLength(1);
|
||||
expect(registry.textTransforms[0]).toMatchObject({
|
||||
pluginId: "text-shim",
|
||||
transforms: {
|
||||
input: expect.any(Array),
|
||||
output: expect.any(Array),
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
it.each([
|
||||
{
|
||||
name: "loads bundled telegram plugin when enabled",
|
||||
|
||||
Reference in New Issue
Block a user