mirror of
https://github.com/openclaw/openclaw.git
synced 2026-03-30 09:50:39 +00:00
test: share slack config snapshot helper
This commit is contained in:
@@ -15,6 +15,18 @@ vi.mock("./runtime.js", () => ({
|
||||
|
||||
import { slackPlugin } from "./channel.js";
|
||||
|
||||
async function getSlackConfiguredState(cfg: OpenClawConfig) {
|
||||
const account = slackPlugin.config.resolveAccount(cfg, "default");
|
||||
return {
|
||||
configured: slackPlugin.config.isConfigured?.(account, cfg),
|
||||
snapshot: await slackPlugin.status?.buildAccountSnapshot?.({
|
||||
account,
|
||||
cfg,
|
||||
runtime: undefined,
|
||||
}),
|
||||
};
|
||||
}
|
||||
|
||||
describe("slackPlugin actions", () => {
|
||||
it("prefers session lookup for announce target routing", () => {
|
||||
expect(slackPlugin.meta.preferSessionLookupForAnnounceTarget).toBe(true);
|
||||
@@ -189,13 +201,7 @@ describe("slackPlugin config", () => {
|
||||
},
|
||||
};
|
||||
|
||||
const account = slackPlugin.config.resolveAccount(cfg, "default");
|
||||
const configured = slackPlugin.config.isConfigured?.(account, cfg);
|
||||
const snapshot = await slackPlugin.status?.buildAccountSnapshot?.({
|
||||
account,
|
||||
cfg,
|
||||
runtime: undefined,
|
||||
});
|
||||
const { configured, snapshot } = await getSlackConfiguredState(cfg);
|
||||
|
||||
expect(configured).toBe(true);
|
||||
expect(snapshot?.configured).toBe(true);
|
||||
@@ -211,13 +217,7 @@ describe("slackPlugin config", () => {
|
||||
},
|
||||
};
|
||||
|
||||
const account = slackPlugin.config.resolveAccount(cfg, "default");
|
||||
const configured = slackPlugin.config.isConfigured?.(account, cfg);
|
||||
const snapshot = await slackPlugin.status?.buildAccountSnapshot?.({
|
||||
account,
|
||||
cfg,
|
||||
runtime: undefined,
|
||||
});
|
||||
const { configured, snapshot } = await getSlackConfiguredState(cfg);
|
||||
|
||||
expect(configured).toBe(false);
|
||||
expect(snapshot?.configured).toBe(false);
|
||||
|
||||
Reference in New Issue
Block a user