refactor(config): unify streaming config across channels

This commit is contained in:
Peter Steinberger
2026-02-21 19:53:23 +01:00
parent 747bb581b3
commit 2c14b0cf4c
26 changed files with 885 additions and 156 deletions

View File

@@ -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).",
]);
});
});