Files
openclaw/extensions/mattermost/src/channel.message-tool.test.ts
wangmiao0668000666 9dbfeb7e61 fix(channels): keep healthy accounts' message actions when one credential SecretRef fails (#110329)
* fix(channels): isolate unavailable account discovery

Co-authored-by: wangmiao0668000666 <wang.miao86@xydigit.com>

* refactor(channels): remove stale discovery exports

* test(pr): provide ripgrep fixture command

---------

Co-authored-by: Peter Steinberger <steipete@gmail.com>
2026-07-28 01:50:51 -04:00

37 lines
1.1 KiB
TypeScript

// Mattermost tests cover account-isolated message-tool discovery.
import { describe, expect, it } from "vitest";
import type { OpenClawConfig } from "../runtime-api.js";
import { mattermostPlugin } from "./channel.js";
describe("Mattermost message-tool SecretRef inspection", () => {
const cfg = {
channels: {
mattermost: {
accounts: {
broken: {
botToken: {
source: "env",
provider: "default",
id: "OPENCLAW_TEST_MISSING_MATTERMOST_TOKEN",
},
baseUrl: "https://mm.example.com",
},
healthy: { botToken: "healthy-token", baseUrl: "https://mm.example.com" },
},
},
},
} as OpenClawConfig;
it("keeps healthy account actions discoverable", () => {
expect(mattermostPlugin.actions?.describeMessageTool({ cfg })?.actions).toEqual(
expect.arrayContaining(["send", "react"]),
);
});
it("does not advertise actions for the unavailable selected account", () => {
expect(
mattermostPlugin.actions?.describeMessageTool({ cfg, accountId: "broken" })?.actions,
).toEqual([]);
});
});