mirror of
https://github.com/openclaw/openclaw.git
synced 2026-08-28 05:16:23 -06:00
9dbfeb7e61
* 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>
37 lines
1.1 KiB
TypeScript
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([]);
|
|
});
|
|
});
|