mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-01 08:06:14 +00:00
fix(config): persist built-in channel enable state in channels
Co-authored-by: HirokiKobayashi-R <HirokiKobayashi-R@users.noreply.github.com>
This commit is contained in:
@@ -2,7 +2,7 @@ import { describe, expect, it } from "vitest";
|
||||
import { applyPluginAutoEnable } from "./plugin-auto-enable.js";
|
||||
|
||||
describe("applyPluginAutoEnable", () => {
|
||||
it("auto-enables channel plugins and updates allowlist", () => {
|
||||
it("auto-enables built-in channels without touching plugins allowlist", () => {
|
||||
const result = applyPluginAutoEnable({
|
||||
config: {
|
||||
channels: { slack: { botToken: "x" } },
|
||||
@@ -11,8 +11,9 @@ describe("applyPluginAutoEnable", () => {
|
||||
env: {},
|
||||
});
|
||||
|
||||
expect(result.config.plugins?.entries?.slack?.enabled).toBe(true);
|
||||
expect(result.config.plugins?.allow).toEqual(["telegram", "slack"]);
|
||||
expect(result.config.channels?.slack?.enabled).toBe(true);
|
||||
expect(result.config.plugins?.entries?.slack).toBeUndefined();
|
||||
expect(result.config.plugins?.allow).toEqual(["telegram"]);
|
||||
expect(result.changes.join("\n")).toContain("Slack configured, enabled automatically.");
|
||||
});
|
||||
|
||||
@@ -48,6 +49,19 @@ describe("applyPluginAutoEnable", () => {
|
||||
expect(result.changes).toEqual([]);
|
||||
});
|
||||
|
||||
it("respects built-in channel explicit disable via channels.<id>.enabled", () => {
|
||||
const result = applyPluginAutoEnable({
|
||||
config: {
|
||||
channels: { slack: { botToken: "x", enabled: false } },
|
||||
},
|
||||
env: {},
|
||||
});
|
||||
|
||||
expect(result.config.channels?.slack?.enabled).toBe(false);
|
||||
expect(result.config.plugins?.entries?.slack).toBeUndefined();
|
||||
expect(result.changes).toEqual([]);
|
||||
});
|
||||
|
||||
it("auto-enables irc when configured via env", () => {
|
||||
const result = applyPluginAutoEnable({
|
||||
config: {},
|
||||
@@ -57,7 +71,7 @@ describe("applyPluginAutoEnable", () => {
|
||||
},
|
||||
});
|
||||
|
||||
expect(result.config.plugins?.entries?.irc?.enabled).toBe(true);
|
||||
expect(result.config.channels?.irc?.enabled).toBe(true);
|
||||
expect(result.changes.join("\n")).toContain("IRC configured, enabled automatically.");
|
||||
});
|
||||
|
||||
@@ -141,7 +155,7 @@ describe("applyPluginAutoEnable", () => {
|
||||
});
|
||||
|
||||
expect(result.config.plugins?.entries?.bluebubbles?.enabled).toBe(false);
|
||||
expect(result.config.plugins?.entries?.imessage?.enabled).toBe(true);
|
||||
expect(result.config.channels?.imessage?.enabled).toBe(true);
|
||||
expect(result.changes.join("\n")).toContain("iMessage configured, enabled automatically.");
|
||||
});
|
||||
|
||||
@@ -158,7 +172,7 @@ describe("applyPluginAutoEnable", () => {
|
||||
});
|
||||
|
||||
expect(result.config.plugins?.entries?.bluebubbles?.enabled).toBeUndefined();
|
||||
expect(result.config.plugins?.entries?.imessage?.enabled).toBe(true);
|
||||
expect(result.config.channels?.imessage?.enabled).toBe(true);
|
||||
});
|
||||
|
||||
it("auto-enables imessage when only imessage is configured", () => {
|
||||
@@ -169,7 +183,7 @@ describe("applyPluginAutoEnable", () => {
|
||||
env: {},
|
||||
});
|
||||
|
||||
expect(result.config.plugins?.entries?.imessage?.enabled).toBe(true);
|
||||
expect(result.config.channels?.imessage?.enabled).toBe(true);
|
||||
expect(result.changes.join("\n")).toContain("iMessage configured, enabled automatically.");
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user