feat(config): add Matrix channel config
This commit is contained in:
@@ -181,6 +181,47 @@ describe('configSchema — models auth_mode', () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe('configSchema — matrix', () => {
|
||||
const minimalConfig = {
|
||||
telegram: { bot_token: 'test', allowed_chat_ids: [1] },
|
||||
models: { default: { provider: 'anthropic', model: 'claude-3' } },
|
||||
};
|
||||
|
||||
it('accepts matrix config and defaults sync_timeout_ms', () => {
|
||||
const result = configSchema.parse({
|
||||
...minimalConfig,
|
||||
matrix: {
|
||||
homeserver_url: 'https://matrix.example.org',
|
||||
access_token: 'syt_test_token',
|
||||
allowed_room_ids: ['!room1:example.org'],
|
||||
require_mention: true,
|
||||
},
|
||||
});
|
||||
|
||||
expect(result.matrix).toBeDefined();
|
||||
expect(result.matrix!.homeserver_url).toBe('https://matrix.example.org');
|
||||
expect(result.matrix!.access_token).toBe('syt_test_token');
|
||||
expect(result.matrix!.sync_timeout_ms).toBe(30000);
|
||||
});
|
||||
|
||||
it('matrix config is optional', () => {
|
||||
const result = configSchema.parse(minimalConfig);
|
||||
expect(result.matrix).toBeUndefined();
|
||||
});
|
||||
|
||||
it('rejects invalid homeserver_url', () => {
|
||||
expect(() => {
|
||||
configSchema.parse({
|
||||
...minimalConfig,
|
||||
matrix: {
|
||||
homeserver_url: 'not-a-url',
|
||||
access_token: 'token',
|
||||
},
|
||||
});
|
||||
}).toThrow(/homeserver/i);
|
||||
});
|
||||
});
|
||||
|
||||
describe('configSchema — skills watcher', () => {
|
||||
const minimalConfig = {
|
||||
telegram: { bot_token: 'test', allowed_chat_ids: [1] },
|
||||
|
||||
Reference in New Issue
Block a user