mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-08 20:58:26 +00:00
fix: sync built-in channel enablement across config paths
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { normalizePluginsConfig } from "./config-state.js";
|
||||
import { normalizePluginsConfig, resolveEffectiveEnableState } from "./config-state.js";
|
||||
|
||||
describe("normalizePluginsConfig", () => {
|
||||
it("uses default memory slot when not specified", () => {
|
||||
@@ -48,3 +48,48 @@ describe("normalizePluginsConfig", () => {
|
||||
expect(result.slots.memory).toBe("memory-core");
|
||||
});
|
||||
});
|
||||
|
||||
describe("resolveEffectiveEnableState", () => {
|
||||
it("enables bundled channels when channels.<id>.enabled=true", () => {
|
||||
const normalized = normalizePluginsConfig({
|
||||
enabled: true,
|
||||
});
|
||||
const state = resolveEffectiveEnableState({
|
||||
id: "telegram",
|
||||
origin: "bundled",
|
||||
config: normalized,
|
||||
rootConfig: {
|
||||
channels: {
|
||||
telegram: {
|
||||
enabled: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
expect(state).toEqual({ enabled: true });
|
||||
});
|
||||
|
||||
it("keeps explicit plugin-level disable authoritative", () => {
|
||||
const normalized = normalizePluginsConfig({
|
||||
enabled: true,
|
||||
entries: {
|
||||
telegram: {
|
||||
enabled: false,
|
||||
},
|
||||
},
|
||||
});
|
||||
const state = resolveEffectiveEnableState({
|
||||
id: "telegram",
|
||||
origin: "bundled",
|
||||
config: normalized,
|
||||
rootConfig: {
|
||||
channels: {
|
||||
telegram: {
|
||||
enabled: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
expect(state).toEqual({ enabled: false, reason: "disabled in config" });
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user