feat(channels): add mattermost adapter and wiring
This commit is contained in:
@@ -0,0 +1,39 @@
|
||||
import { describe, expect, it, vi } from 'vitest';
|
||||
import { configSchema } from '../config/schema.js';
|
||||
import { ChannelRegistry } from '../channels/index.js';
|
||||
import { HookEngine } from '../hooks/index.js';
|
||||
import { registerChannels } from './channels.js';
|
||||
|
||||
describe('registerChannels', () => {
|
||||
it('registers Mattermost adapter when configured', () => {
|
||||
const config = configSchema.parse({
|
||||
telegram: { bot_token: 'test-token', allowed_chat_ids: [1] },
|
||||
models: { default: { provider: 'anthropic', model: 'claude-3' } },
|
||||
mattermost: {
|
||||
server_url: 'https://mattermost.example.com',
|
||||
bot_token: 'mm-token',
|
||||
allowed_channel_ids: ['chan-1'],
|
||||
},
|
||||
});
|
||||
|
||||
const channelRegistry = new ChannelRegistry();
|
||||
const gateway = {
|
||||
setWebhookHandler: vi.fn(),
|
||||
setGmailHandler: vi.fn(),
|
||||
setTeamsHandler: vi.fn(),
|
||||
setGoogleChatHandler: vi.fn(),
|
||||
setBlueBubblesHandler: vi.fn(),
|
||||
};
|
||||
|
||||
registerChannels({
|
||||
config,
|
||||
channelRegistry,
|
||||
hookEngine: new HookEngine(config.hooks),
|
||||
gateway: gateway as unknown as Parameters<typeof registerChannels>[0]['gateway'],
|
||||
});
|
||||
|
||||
const names = channelRegistry.list().map((adapter) => adapter.name);
|
||||
expect(names).toContain('mattermost');
|
||||
expect(names).toContain('webchat');
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user