fix wecom channel (#530)

This commit is contained in:
paisley
2026-03-16 18:08:50 +08:00
committed by GitHub
Unverified
parent 7e54aad9e6
commit f1e2e9fa01
9 changed files with 475 additions and 162 deletions

View File

@@ -124,7 +124,7 @@ describe('parseDoctorValidationOutput', () => {
expect(out.undetermined).toBe(true);
expect(out.errors).toEqual([]);
expect(out.warnings.some((w) => w.includes('falling back to local channel config checks'))).toBe(true);
expect(out.warnings.some((w: string) => w.includes('falling back to local channel config checks'))).toBe(true);
});
it('falls back with hint when output is empty', async () => {
@@ -134,6 +134,27 @@ describe('parseDoctorValidationOutput', () => {
expect(out.undetermined).toBe(true);
expect(out.errors).toEqual([]);
expect(out.warnings.some((w) => w.includes('falling back to local channel config checks'))).toBe(true);
expect(out.warnings.some((w: string) => w.includes('falling back to local channel config checks'))).toBe(true);
});
});
describe('WeCom plugin configuration', () => {
beforeEach(async () => {
vi.resetAllMocks();
vi.resetModules();
await rm(testHome, { recursive: true, force: true });
await rm(testUserData, { recursive: true, force: true });
});
it('sets plugins.entries.wecom.enabled when saving wecom config', async () => {
const { saveChannelConfig } = await import('@electron/utils/channel-config');
await saveChannelConfig('wecom', { botId: 'test-bot', secret: 'test-secret' }, 'agent-a');
const config = await readOpenClawJson();
const plugins = config.plugins as { allow: string[], entries: Record<string, { enabled?: boolean }> };
expect(plugins.allow).toContain('wecom');
expect(plugins.entries['wecom'].enabled).toBe(true);
});
});