mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-13 13:50:34 +00:00
refactor(config): unify streaming config across channels
This commit is contained in:
@@ -145,4 +145,81 @@ describe("normalizeLegacyConfigValues", () => {
|
||||
"Moved channels.discord.accounts.work.dm.allowFrom → channels.discord.accounts.work.allowFrom.",
|
||||
]);
|
||||
});
|
||||
|
||||
it("migrates Discord streaming boolean alias to streaming enum", () => {
|
||||
const res = normalizeLegacyConfigValues({
|
||||
channels: {
|
||||
discord: {
|
||||
streaming: true,
|
||||
accounts: {
|
||||
work: {
|
||||
streaming: false,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
expect(res.config.channels?.discord?.streaming).toBe("partial");
|
||||
expect(res.config.channels?.discord?.streamMode).toBeUndefined();
|
||||
expect(res.config.channels?.discord?.accounts?.work?.streaming).toBe("off");
|
||||
expect(res.config.channels?.discord?.accounts?.work?.streamMode).toBeUndefined();
|
||||
expect(res.changes).toEqual([
|
||||
"Normalized channels.discord.streaming boolean → enum (partial).",
|
||||
"Normalized channels.discord.accounts.work.streaming boolean → enum (off).",
|
||||
]);
|
||||
});
|
||||
|
||||
it("migrates Discord legacy streamMode into streaming enum", () => {
|
||||
const res = normalizeLegacyConfigValues({
|
||||
channels: {
|
||||
discord: {
|
||||
streaming: false,
|
||||
streamMode: "block",
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
expect(res.config.channels?.discord?.streaming).toBe("block");
|
||||
expect(res.config.channels?.discord?.streamMode).toBeUndefined();
|
||||
expect(res.changes).toEqual([
|
||||
"Moved channels.discord.streamMode → channels.discord.streaming (block).",
|
||||
"Normalized channels.discord.streaming boolean → enum (block).",
|
||||
]);
|
||||
});
|
||||
|
||||
it("migrates Telegram streamMode into streaming enum", () => {
|
||||
const res = normalizeLegacyConfigValues({
|
||||
channels: {
|
||||
telegram: {
|
||||
streamMode: "block",
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
expect(res.config.channels?.telegram?.streaming).toBe("block");
|
||||
expect(res.config.channels?.telegram?.streamMode).toBeUndefined();
|
||||
expect(res.changes).toEqual([
|
||||
"Moved channels.telegram.streamMode → channels.telegram.streaming (block).",
|
||||
]);
|
||||
});
|
||||
|
||||
it("migrates Slack legacy streaming keys to unified config", () => {
|
||||
const res = normalizeLegacyConfigValues({
|
||||
channels: {
|
||||
slack: {
|
||||
streaming: false,
|
||||
streamMode: "status_final",
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
expect(res.config.channels?.slack?.streaming).toBe("progress");
|
||||
expect(res.config.channels?.slack?.nativeStreaming).toBe(false);
|
||||
expect(res.config.channels?.slack?.streamMode).toBeUndefined();
|
||||
expect(res.changes).toEqual([
|
||||
"Moved channels.slack.streamMode → channels.slack.streaming (progress).",
|
||||
"Moved channels.slack.streaming (boolean) → channels.slack.nativeStreaming (false).",
|
||||
]);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user