feat(backends): add codex/gemini external runners and wire backend selection
This commit is contained in:
@@ -0,0 +1,40 @@
|
||||
import { describe, expect, it } from 'vitest';
|
||||
|
||||
import { configSchema } from '../config/schema.js';
|
||||
import { createConfiguredExternalBackend } from './index.js';
|
||||
|
||||
describe('createConfiguredExternalBackend', () => {
|
||||
const base = configSchema.parse({
|
||||
telegram: { bot_token: 'test', allowed_chat_ids: [1] },
|
||||
models: { default: { provider: 'anthropic', model: 'claude-3' } },
|
||||
});
|
||||
|
||||
it('returns undefined when no external backend is enabled', () => {
|
||||
const backend = createConfiguredExternalBackend(base);
|
||||
expect(backend).toBeUndefined();
|
||||
});
|
||||
|
||||
it('selects codex when enabled', () => {
|
||||
const cfg = {
|
||||
...base,
|
||||
backends: {
|
||||
...base.backends,
|
||||
codex: { enabled: true, path: '/usr/bin/codex' },
|
||||
},
|
||||
};
|
||||
const backend = createConfiguredExternalBackend(cfg);
|
||||
expect(backend?.name).toBe('codex');
|
||||
});
|
||||
|
||||
it('selects gemini when enabled and higher-priority backends are disabled', () => {
|
||||
const cfg = {
|
||||
...base,
|
||||
backends: {
|
||||
...base.backends,
|
||||
gemini: { enabled: true, path: '/usr/bin/gemini' },
|
||||
},
|
||||
};
|
||||
const backend = createConfiguredExternalBackend(cfg);
|
||||
expect(backend?.name).toBe('gemini');
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user