Files
openclaw/src/gateway/server.startup-matrix-migration.integration.test.ts
2026-04-27 21:02:26 +01:00

62 lines
1.7 KiB
TypeScript

import { describe, expect, it } from "vitest";
import { resolveGatewayStartupMaintenanceConfig } from "./server-startup-plugins.js";
describe("gateway startup channel maintenance wiring", () => {
it("uses channels from the resolved startup config when startup config repaired them", () => {
const resolved = resolveGatewayStartupMaintenanceConfig({
cfgAtStart: {
plugins: { enabled: true },
},
startupRuntimeConfig: {
plugins: { enabled: true },
channels: {
matrix: {
homeserver: "https://matrix.example.org",
userId: "@bot:example.org",
accessToken: "tok-123",
},
},
},
});
expect(resolved.channels).toEqual({
matrix: {
homeserver: "https://matrix.example.org",
userId: "@bot:example.org",
accessToken: "tok-123",
},
});
});
it("preserves explicit startup channel config", () => {
const resolved = resolveGatewayStartupMaintenanceConfig({
cfgAtStart: {
plugins: { enabled: true },
channels: {
matrix: {
homeserver: "https://matrix.original.example",
userId: "@original:example.org",
accessToken: "original-token",
},
},
},
startupRuntimeConfig: {
plugins: { enabled: true },
channels: {
matrix: {
homeserver: "https://matrix.repaired.example",
userId: "@repaired:example.org",
accessToken: "repaired-token",
},
},
},
});
expect(resolved.channels?.matrix).toEqual({
homeserver: "https://matrix.original.example",
userId: "@original:example.org",
accessToken: "original-token",
});
});
});