audit follow-up: continue warning burn-down in factory and service tests

This commit is contained in:
William Valentin
2026-02-15 22:51:20 -08:00
parent e16c0bc2c7
commit 8c94bb51d0
4 changed files with 41 additions and 23 deletions
+17 -5
View File
@@ -2,6 +2,11 @@ import { describe, it, expect } from 'vitest';
import { discoverServices } from './services.js';
import { ChannelRegistry } from '../../channels/registry.js';
import type { Config } from '../../config/index.js';
import type { CronJobConfig } from '../../config/schema.js';
function withMutableConfig(config: Config): Config & Record<string, unknown> {
return config as Config & Record<string, unknown>;
}
function makeBaseConfig(): Config {
return {
@@ -47,7 +52,7 @@ describe('discoverServices', () => {
it('marks configured channels as disconnected when adapter is not registered', () => {
const cfg = makeBaseConfig();
(cfg as any).telegram = { bot_token: 'x', allowed_chat_ids: [123] };
withMutableConfig(cfg).telegram = { bot_token: 'x', allowed_chat_ids: [123] };
const reg = new ChannelRegistry();
const services = discoverServices(cfg, reg);
@@ -57,7 +62,7 @@ describe('discoverServices', () => {
it('uses adapter status when channel adapter is registered', () => {
const cfg = makeBaseConfig();
(cfg as any).telegram = { bot_token: 'x', allowed_chat_ids: [123] };
withMutableConfig(cfg).telegram = { bot_token: 'x', allowed_chat_ids: [123] };
const reg = new ChannelRegistry();
reg.register({
@@ -77,8 +82,8 @@ describe('discoverServices', () => {
const cfg = makeBaseConfig();
cfg.automation.cron = [
{ name: 'job', schedule: '0 0 * * *', message: 'hi', output: { channel: 'webchat', peer: 'x' }, enabled: true },
] as any;
cfg.mcp.servers = [{ name: 'srv', command: 'x', args: [] }] as any;
] as CronJobConfig[];
cfg.mcp.servers = [{ name: 'srv', command: 'x', args: [] }];
const reg = new ChannelRegistry();
const services = discoverServices(cfg, reg);
@@ -90,7 +95,14 @@ describe('discoverServices', () => {
it('marks audio transcription as configured and includes endpoint metadata', () => {
const cfg = makeBaseConfig();
(cfg as any).audio = { enabled: true, provider: { type: 'custom', endpoint: 'http://localhost:18801/v1/audio/transcriptions', model: 'whisper-1' } };
withMutableConfig(cfg).audio = {
enabled: true,
provider: {
type: 'custom',
endpoint: 'http://localhost:18801/v1/audio/transcriptions',
model: 'whisper-1',
},
};
const reg = new ChannelRegistry();
const services = discoverServices(cfg, reg);