feat(config): add Matrix channel config

This commit is contained in:
William Valentin
2026-02-15 18:02:14 -08:00
parent 8323fa6763
commit 5fdb9e5a83
2 changed files with 52 additions and 0 deletions
+41
View File
@@ -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] },