@@ -28,6 +28,9 @@ vi.mock("../channels/plugins/configured-state.js", async (importOriginal) => {
|
28 | 28 | cfg: OpenClawConfig; |
29 | 29 | env?: NodeJS.ProcessEnv; |
30 | 30 | }) => { |
| 31 | +if (params.channelId === "cache-channel") { |
| 32 | +return Boolean(params.env?.CACHE_CHANNEL_TOKEN?.trim()); |
| 33 | +} |
31 | 34 | if (params.channelId === "irc") { |
32 | 35 | return Boolean(params.env?.IRC_HOST?.trim() && params.env?.IRC_NICK?.trim()); |
33 | 36 | } |
@@ -1198,10 +1201,11 @@ describe("applyPluginAutoEnable core", () => {
|
1198 | 1201 | it("does not reuse same-turn auto-enable results after discovery mutates in place", () => { |
1199 | 1202 | const config: OpenClawConfig = {}; |
1200 | 1203 | const mutableDiscovery: PluginDiscoveryResult = { candidates: [], diagnostics: [] }; |
1201 | | -const manifestRegistry = makeRegistry([{ id: "irc-plugin", channels: ["irc"] }]); |
| 1204 | +const manifestRegistry = makeRegistry([ |
| 1205 | +{ id: "cache-channel-plugin", channels: ["cache-channel"] }, |
| 1206 | +]); |
1202 | 1207 | const configuredEnv = makeIsolatedEnv({ |
1203 | | -IRC_HOST: "irc.libera.chat", |
1204 | | -IRC_NICK: "openclaw-bot", |
| 1208 | +CACHE_CHANNEL_TOKEN: "configured", |
1205 | 1209 | }); |
1206 | 1210 | |
1207 | 1211 | const first = applyPluginAutoEnable({ |
@@ -1211,7 +1215,10 @@ describe("applyPluginAutoEnable core", () => {
|
1211 | 1215 | manifestRegistry, |
1212 | 1216 | }); |
1213 | 1217 | mutableDiscovery.candidates.push( |
1214 | | -makeBundledChannelCandidate({ pluginId: "irc-plugin", channelId: "irc" }), |
| 1218 | +makeBundledChannelCandidate({ |
| 1219 | +pluginId: "cache-channel-plugin", |
| 1220 | +channelId: "cache-channel", |
| 1221 | +}), |
1215 | 1222 | ); |
1216 | 1223 | const second = applyPluginAutoEnable({ |
1217 | 1224 | config, |
@@ -1220,8 +1227,8 @@ describe("applyPluginAutoEnable core", () => {
|
1220 | 1227 | manifestRegistry, |
1221 | 1228 | }); |
1222 | 1229 | |
1223 | | -expect(first.config.plugins?.entries?.["irc-plugin"]).toBeUndefined(); |
1224 | | -expect(second.config.plugins?.entries?.["irc-plugin"]?.enabled).toBe(true); |
| 1230 | +expect(first.config.plugins?.entries?.["cache-channel-plugin"]).toBeUndefined(); |
| 1231 | +expect(second.config.plugins?.entries?.["cache-channel-plugin"]?.enabled).toBe(true); |
1225 | 1232 | expect(second).not.toBe(first); |
1226 | 1233 | }); |
1227 | 1234 | |
|