mirror of
https://github.com/openclaw/openclaw.git
synced 2026-04-28 17:43:05 +00:00
fix: honor feishu setup adapter default
This commit is contained in:
@@ -3,6 +3,7 @@ import {
|
||||
type ChannelSetupAdapter,
|
||||
type OpenClawConfig,
|
||||
} from "openclaw/plugin-sdk/setup";
|
||||
import { resolveDefaultFeishuAccountId } from "./accounts.js";
|
||||
import type { FeishuConfig } from "./types.js";
|
||||
|
||||
export function setFeishuNamedAccountEnabled(
|
||||
@@ -30,7 +31,7 @@ export function setFeishuNamedAccountEnabled(
|
||||
}
|
||||
|
||||
export const feishuSetupAdapter: ChannelSetupAdapter = {
|
||||
resolveAccountId: ({ accountId }) => accountId?.trim() || DEFAULT_ACCOUNT_ID,
|
||||
resolveAccountId: ({ cfg, accountId }) => accountId?.trim() || resolveDefaultFeishuAccountId(cfg),
|
||||
applyAccountConfig: ({ cfg, accountId }) => {
|
||||
const isDefault = !accountId || accountId === DEFAULT_ACCOUNT_ID;
|
||||
if (isDefault) {
|
||||
|
||||
@@ -71,6 +71,28 @@ describe("feishu setup wizard", () => {
|
||||
).toBe("work");
|
||||
});
|
||||
|
||||
it("setup adapter uses configured defaultAccount when accountId is omitted", () => {
|
||||
expect(
|
||||
feishuPlugin.setup?.resolveAccountId?.({
|
||||
cfg: {
|
||||
channels: {
|
||||
feishu: {
|
||||
defaultAccount: "work",
|
||||
accounts: {
|
||||
work: {
|
||||
appId: "work-app",
|
||||
appSecret: "work-secret", // pragma: allowlist secret
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
} as never,
|
||||
accountId: undefined,
|
||||
input: {},
|
||||
} as never),
|
||||
).toBe("work");
|
||||
});
|
||||
|
||||
it("does not throw when config appId/appSecret are SecretRef objects", async () => {
|
||||
const text = vi
|
||||
.fn()
|
||||
|
||||
Reference in New Issue
Block a user